From 05587b7539c622a07697114a658d7549772182be Mon Sep 17 00:00:00 2001 From: Jeroen <120394814+HalfzwareLinda@users.noreply.github.com> Date: Mon, 13 Apr 2026 11:52:21 +0200 Subject: [PATCH] fix: register routes without /v1 prefix for OpenCLAW compatibility OpenCLAW's openai-completions provider appends /chat/completions to the baseUrl without a /v1 prefix. This causes all requests to hit the 404 handler, which OpenCLAW then classifies as model_not_found. Register both /v1/chat/completions and /chat/completions (and similarly /v1/models and /models) so the proxy works regardless of whether the client includes the /v1 prefix. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/server/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/index.ts b/src/server/index.ts index de8b73d..ddf0f36 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -45,10 +45,13 @@ function createApp(): Express { res.sendStatus(200); }); - // Routes + // Routes — register both /v1/* and /* paths so clients that omit the + // /v1 prefix (e.g. OpenCLAW's openai-completions provider) still work. app.get("/health", handleHealth); app.get("/v1/models", handleModels); + app.get("/models", handleModels); app.post("/v1/chat/completions", handleChatCompletions); + app.post("/chat/completions", handleChatCompletions); // 404 handler app.use((_req: Request, res: Response) => {