From 7a0c819eca8a36d1638412737ae57354b160377d Mon Sep 17 00:00:00 2001 From: jze9 Date: Thu, 28 May 2026 20:32:52 +0500 Subject: [PATCH] Add /v1/models endpoint for Open WebUI integration Open WebUI requires this endpoint to discover and list available models from OpenAI-compatible connections. Co-Authored-By: Claude Sonnet 4.6 --- main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.py b/main.py index c32bfae..b03e739 100644 --- a/main.py +++ b/main.py @@ -60,6 +60,20 @@ class IndexRequest(BaseModel): root_dir: str extensions: list[str] = [".py"] +# ── models list endpoint ────────────────────────────────────────────────────── + +@app.get("/v1/models") +async def list_models(): + return { + "object": "list", + "data": [{ + "id": "code-memory", + "object": "model", + "owned_by": "code-memory", + "created": 1700000000, + }] + } + # ── context assembly ────────────────────────────────────────────────────────── async def build_context(request: ChatRequest) -> list[dict]: