feat(2.0): Phase 6c — eingebauter OpenAI-Gateway (model:auto) statt LiteLLM

LiteLLM baut auf Python 3.14 nicht (orjson-Pin ohne cp314-Wheel). Stattdessen
eingebauter Gateway in MC2: routers/gateway_proxy.py (/v1/chat/completions,
/completions, /models) + services/router_logic.py (Komplexitaets-Routing
fast<->heavy, Streaming-Passthrough). gateway.py/routing.py/connect.py auf
builtin umgestellt (Endpunkt = MC :PORT/v1). Gleicher OpenAI-Vertrag,
spaeter gegen LiteLLM austauschbar.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-25 12:54:19 +02:00
parent db1f62227b
commit ceca2ae8e3
10 changed files with 143 additions and 99 deletions
+2 -18
View File
@@ -1,7 +1,6 @@
"""Routing-Endpoints: Gateway-Übersicht (welcher Alias = fast/heavy/…) + Mapping setzen."""
"""Routing-Endpoint: zeigt den eingebauten Gateway (model:auto fastheavy)."""
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
from fastapi import APIRouter
from services import gateway
@@ -11,18 +10,3 @@ router = APIRouter(prefix="/api")
@router.get("/routing")
def routing() -> dict:
return {**gateway.routing_summary(), "gateway_reachable": gateway.gateway_reachable()}
class RouteReq(BaseModel):
name: str # Gateway-Modellname, z.B. "fast" / "heavy" / "vision" / "coder"
target_alias: str # llama-swap-Alias, der bedient wird
api_base: str = "http://127.0.0.1:8080/v1"
@router.put("/routing/route")
def set_route(req: RouteReq) -> dict:
try:
gateway.set_route(req.name, req.target_alias, api_base=req.api_base)
except Exception as exc: # noqa: BLE001
raise HTTPException(500, str(exc))
return {"ok": True}