[GH-ISSUE #55] POST /v1/messages?beta=true returns 404 (query string not stripped in do_POST) — blocks Claude Code #33

Closed
opened 2026-11-04 01:39:10 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Nicolas0315 on GitHub (Sep 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/55

Summary

do_POST compares self.path without stripping the query string, so POST /v1/messages?beta=true (and /v1/chat/completions?...) returns 404 {"error": {"message": "not found"}}.

Claude Code always calls the Anthropic endpoint as /v1/messages?beta=true, so it cannot talk to Strata at all. Claude Code reports this only as "There's an issue with the selected model … It may not exist or you may not have access to it", which makes it look like a model-name problem.

Repro (commit d551edf, engine 0.1.13)

curl -s -w ' HTTP%{http_code}\n' 'http://127.0.0.1:8080/v1/messages?beta=true' \
  -H 'Content-Type: application/json' -H 'anthropic-version: 2023-06-01' \
  -d '{"model":"x","max_tokens":50,"messages":[{"role":"user","content":"hi"}]}'
# {"error": {"message": "not found"}} HTTP404

Without ?beta=true the same request returns 200.

Cause / fix

do_GET already does path = self.path.split("?")[0].rstrip("/") (serve/server.py ~L916), but do_POST uses self.path.rstrip("/") (~L994/L996). Using the same normalisation in do_POST fixes it:

-                if self.path.rstrip("/") == "/v1/chat/completions":
+                if self.path.split("?")[0].rstrip("/") == "/v1/chat/completions":
                     self._openai(req)
-                elif self.path.rstrip("/") == "/v1/messages":
+                elif self.path.split("?")[0].rstrip("/") == "/v1/messages":
                     self._anthropic(req)

(/settings in do_POST has the same pattern.)

Verified locally on Windows / RTX 4090 / IQ3_S: with this change Claude Code 2.1.283 (ANTHROPIC_BASE_URL=http://127.0.0.1:<port>) reaches the engine. It then hits a second problem, filed separately (mid-conversation system messages).

Side note for the docs: Claude Code rejects model names it does not know, so users need ANTHROPIC_MODEL=<a known Claude model id>; Strata ignores the name anyway.

Originally created by @Nicolas0315 on GitHub (Sep 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/55 ## Summary `do_POST` compares `self.path` without stripping the query string, so `POST /v1/messages?beta=true` (and `/v1/chat/completions?...`) returns `404 {"error": {"message": "not found"}}`. Claude Code always calls the Anthropic endpoint as `/v1/messages?beta=true`, so it cannot talk to Strata at all. Claude Code reports this only as *"There's an issue with the selected model … It may not exist or you may not have access to it"*, which makes it look like a model-name problem. ## Repro (commit d551edf, engine 0.1.13) ```bash curl -s -w ' HTTP%{http_code}\n' 'http://127.0.0.1:8080/v1/messages?beta=true' \ -H 'Content-Type: application/json' -H 'anthropic-version: 2023-06-01' \ -d '{"model":"x","max_tokens":50,"messages":[{"role":"user","content":"hi"}]}' # {"error": {"message": "not found"}} HTTP404 ``` Without `?beta=true` the same request returns 200. ## Cause / fix `do_GET` already does `path = self.path.split("?")[0].rstrip("/")` (serve/server.py ~L916), but `do_POST` uses `self.path.rstrip("/")` (~L994/L996). Using the same normalisation in `do_POST` fixes it: ```diff - if self.path.rstrip("/") == "/v1/chat/completions": + if self.path.split("?")[0].rstrip("/") == "/v1/chat/completions": self._openai(req) - elif self.path.rstrip("/") == "/v1/messages": + elif self.path.split("?")[0].rstrip("/") == "/v1/messages": self._anthropic(req) ``` (`/settings` in `do_POST` has the same pattern.) Verified locally on Windows / RTX 4090 / IQ3_S: with this change Claude Code 2.1.283 (`ANTHROPIC_BASE_URL=http://127.0.0.1:<port>`) reaches the engine. It then hits a second problem, filed separately (mid-conversation `system` messages). Side note for the docs: Claude Code rejects model names it does not know, so users need `ANTHROPIC_MODEL=<a known Claude model id>`; Strata ignores the name anyway.
Author
Owner

@Niko1221 commented on GitHub (Sep 28, 2026):

Thanks for the precise report and the fix - fixed in v0.1.17: every POST route now ignores the query string (/v1/messages?beta=true, /v1/chat/completions?..., /settings), with a test using your request. The docs now say how to point Claude Code at Strata, including your ANTHROPIC_MODEL note. Please reopen if it still does not connect.

<!-- gh-comment-id:5871074603 --> @Niko1221 commented on GitHub (Sep 28, 2026): Thanks for the precise report and the fix - fixed in [v0.1.17](https://github.com/Niko1221/Strata/releases/tag/v0.1.17): every POST route now ignores the query string (`/v1/messages?beta=true`, `/v1/chat/completions?...`, `/settings`), with a test using your request. The docs now say how to point Claude Code at Strata, including your `ANTHROPIC_MODEL` note. Please reopen if it still does not connect.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#33
No description provided.