From d6605992bc3cb6da569bab30cd0ef065e346f468 Mon Sep 17 00:00:00 2001 From: inference-bot Date: Fri, 4 Sep 2026 17:33:01 -0600 Subject: [PATCH] Add /v1/models endpoint (no per-user auth) for LibreChat model discovery --- app/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/main.py b/app/main.py index 5783ac5..2cd6ba6 100644 --- a/app/main.py +++ b/app/main.py @@ -241,6 +241,21 @@ async def opencollective_webhook(request: Request): # --- B. Key injector (proxy) --- +@app.get("/v1/models") +async def list_models(): + """List models (same for everyone — no per-user auth needed).""" + async with httpx.AsyncClient() as client: + r = await client.get( + f"{LITELLM_BASE}/v1/models", + headers={"Authorization": f"Bearer {LITELLM_MASTER_KEY}"}, + ) + return Response( + content=r.content, + status_code=r.status_code, + headers={"content-type": r.headers.get("content-type", "application/json")}, + ) + + @app.api_route("/v1/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH"]) async def inject_key(request: Request, path: str): """Read the member's email from a header, inject their key, forward to LiteLLM."""