diff --git a/backend/routers/gateway_proxy.py b/backend/routers/gateway_proxy.py index c8c83fe..8d12a17 100644 --- a/backend/routers/gateway_proxy.py +++ b/backend/routers/gateway_proxy.py @@ -41,10 +41,10 @@ _LANE_LABELS = {"coding": "Coding (Router → coder/heavy/fast)", "chat": "Chat @router.get("/models") -async def models(): - async with httpx.AsyncClient(timeout=10) as c: - r = await c.get(f"{LLAMA_SWAP_URL}/v1/models") - data = r.json() +async def models(request: Request): + client = request.app.state.gw_client # geteilter Keep-Alive-Client (siehe app.py lifespan) + r = await client.get(f"{LLAMA_SWAP_URL}/v1/models", timeout=10.0) + data = r.json() # Lanes ganz oben einblenden, damit IDEs einfach „coding"/„chat" wählen können. lanes = [{"id": lane, "object": "model", "owned_by": "mc2-router", "description": _LANE_LABELS.get(lane, lane)} for lane in LANES]