Zum Inhalt

KIVA-Plattform – Komponenten

Überblick

Die KIVA-Plattform besteht aus vier Hauptkomponenten, die zusammen eine souveräne, skalierbare AI-Gateway-Lösung bilden:

  1. LLM Gateway - Zentrale Intelligenz
  2. Inference Engine - Lokale Modell-Inferenz (vLLM)
  3. Infrastructure & Deployment - Kubernetes-basiertes Cloud-Native Deployment mit integriertem Monitoring
  4. IAM Provider - Identity & Access Management (in Planung)

1. LLM Gateway

Das Herzstück der Plattform

Beschreibung

Die KIVA-Plattform basiert auf einem eigenen Fork von LiteLLM v1.74.4, der als zentraler LLM Gateway alle Kernfunktionen bereitstellt. Dieser Fork wurde speziell für die Anforderungen der öffentlichen Verwaltung in Baden-Württemberg angepasst.

Fork-Details

  • Basis: LiteLLM v1.74.4 (MIT-Lizenz)
  • Anpassungen:
    • Enterprise-Ordner entfernt (Lizenz-Compliance)
    • Fokus auf Grundfunktionalitäten
    • Schlanke Referenzimplementierung
  • Souveränität: Volle Kontrolle über Code und Weiterentwicklung
  • Repository: /litellm/ in der KIVA-Codebasis
  • Upstream-Kompatibilität: Orientierung an LiteLLM-Standards

Kernfunktionen

API & Integration

  • OpenAI-kompatible API - Einheitliche Schnittstelle für alle LLM-Provider
  • 100+ Provider-Support - OpenAI, Anthropic, Azure, AWS Bedrock, Google Vertex AI, lokale Modelle
  • Seamless Integration - Keine Code-Änderungen für bestehende OpenAI-Clients

Sicherheit & Zugriffskontrolle

  • API Key Management - Zentrale Verwaltung von Zugriffsschlüsseln
  • User & Team Accounts - Multi-Tenant-Unterstützung
  • Rate Limiting - Token Limits pro User/Team (TPM, RPM)
  • Authentication & Authorization - Rollenbasierte Zugriffskontrolle

Budget & Kostenmanagement

  • Echtzeit-Kostenberechnung - Transparente Kosten pro Request
  • Team-basierte Budgets - Monatliche Limits mit automatischer Durchsetzung
  • Cost Tracking - Detaillierte Aufschlüsselung nach User, Modell, Zeitraum
  • Automatische Warnungen - Bei 80%, 90%, 100% Budget-Auslastung

Intelligentes Routing

  • Load Balancing - Verteilung über mehrere Modell-Instanzen
  • Fallback-Strategien - Automatische Umschaltung bei Ausfall
  • Routing-Modi:
    • simple-shuffle - Zufällige Verteilung
    • lowest-latency - Schnellstes Modell bevorzugen
    • lowest-cost - Günstigstes Modell bevorzugen
    • usage-based - Lastverteilung optimieren

Performance-Optimierung

  • Response Caching - Redis-basiert, konfigurierbare TTL
  • Cache-Hit-Rate: 30-50% (typisch)
  • Cache-Latenz: < 50ms
  • Batch Processing - Effiziente Verarbeitung mehrerer Anfragen

Monitoring & Observability

  • Prometheus Metrics - Requests, Latency, Costs, Token Usage
  • Audit Logging - Vollständige Request/Response-Historie
  • Web-Dashboard - Administration und Monitoring-UI

Technologie-Stack

Sprache: Python 3.10+
Framework: FastAPI
API-Standard: OpenAI-compatible
Datenbank: PostgreSQL (Metadaten, Users, Budgets)
Cache: Redis (Response Caching, Rate Limiting)
Container: Docker

Deployment

Skalierung:

  • 2-8 Pods (Horizontal Auto-Scaling)
  • Stateless Design (State in PostgreSQL/Redis)
  • CPU-basiertes Scaling (> 70% Auslastung)

Ressourcen:

requests:
  cpu: 500m
  memory: 1Gi
limits:
  cpu: 2000m
  memory: 4Gi

Integration

Client-Beispiele:

# Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://kiva.example.com/v1",
    api_key="<kiva-api-key>"
)

response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hallo!"}]
)
# cURL
curl https://kiva.example.com/v1/chat/completions \
  -H "Authorization: Bearer <kiva-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Hallo!"}]
  }'

2. Inference Engine

vLLM - GPU-beschleunigte lokale Inferenz

Die detaillierte Dokumentation zur Inference Engine (vLLM) finden Sie hier: Inference Engine (vLLM)


3. Infrastructure & Deployment

Kubernetes-basiertes Cloud-Native Deployment mit GitOps

Die detaillierte Dokumentation zur Infrastructure & Deployment finden Sie hier: Infrastructure & Deployment


4. IAM Provider

Identity & Access Management (in Planung)

Beschreibung

Zukünftige Integration eines zentralen Identity & Access Management Systems für erweiterte Authentifizierung und Autorisierung.

Geplante Features

Single Sign-On (SSO):

  • Integration mit bestehenden Verwaltungs-Identity-Providern
  • SAML 2.0 / OAuth 2.0 / OIDC Support
  • Kein separates User-Management in LiteLLM

Role-Based Access Control (RBAC):

  • Fein-granulare Berechtigungen
  • Rollen: Admin, Team-Lead, User, Read-Only
  • Policy-basierte Zugriffskontrolle

Multi-Factor Authentication (MFA):

  • Zusätzliche Sicherheitsebene
  • TOTP (Time-based One-Time Password)
  • SMS/Email-basierte Verifizierung (optional)

Audit & Compliance:

  • Zentrale Audit-Logs für alle Zugriffe
  • Compliance-Reports
  • DSGVO-konforme Datenhaltung

Technologie-Optionen (in Evaluierung)

Option 1: Keycloak

  • Open Source IAM
  • SAML, OAuth, OIDC Support
  • Self-hosted, volle Kontrolle

Option 2: Azure Active Directory (Entra ID)

  • Cloud-basiert (Azure)
  • Enterprise-Features
  • Integration mit bestehenden Azure-Services

Option 3: Authentik

  • Open Source, moderne UI
  • Kubernetes-native
  • GitOps-ready

Integrations-Plan

Phase 1 (Q2 2025): Evaluierung & POC
Phase 2 (Q3 2025): Integration mit LiteLLM
Phase 3 (Q4 2025): Produktiv-Deployment

Aktueller Stand:

  • LiteLLM verwendet internes User-Management
  • API Keys manuell vergeben
  • Team-Zuordnung in PostgreSQL

Komponenten-Zusammenfassung

Komponente Status Technologie Funktion
LLM Gateway ✅ Produktiv LiteLLM Fork v1.74.4 Zentraler AI Gateway
Inference Engine ✅ Produktiv vLLM + NVIDIA GPU Lokale Modell-Inferenz
Infrastructure & Deployment ✅ Produktiv Kubernetes, Helm, ArgoCD, Prometheus, Grafana Cloud-Native Deployment & Monitoring
IAM Provider 🔄 In Planung Keycloak / Azure AD / Authentik Identity & Access Management

Komponenten-Interaktion

flowchart TD Client["Client Applications
Open WebUI, F13, Custom Apps"] Gateway["LLM Gateway (Fork v1.74.4)
• API Key Auth
• Budget Control
• Model Routing"] vLLM["Inference Engine (vLLM)
• GPU-Inferenz
• Open Source"] APIs["Externe APIs
• OpenAI
• Anthropic
• Azure"] Prometheus["Monitoring (Prometheus)
Metrics, Logs, Alerts"] Grafana["Grafana Dashboards
Visualisierung"] Client -->|HTTPS / OpenAI API| Gateway Gateway --> vLLM Gateway --> APIs vLLM --> Prometheus APIs --> Prometheus Prometheus --> Grafana Grafana ~~~ Infra Grafana ~~~ Future subgraph Infra[Infrastructure & Deployment] K8s["• Kubernetes (AKS)
• Helm + Helmfile
• ArgoCD (GitOps)"] end subgraph Future[Zukunft] IAM["IAM Provider
SSO, RBAC, MFA"] end style Client fill:#e1f5ff style Gateway fill:#fff3e0 style vLLM fill:#f3e5f5 style APIs fill:#f3e5f5 style Prometheus fill:#e8f5e9 style Grafana fill:#e8f5e9 style K8s fill:#fce4ec style IAM fill:#f5f5f5