Skip to content

fix(ai): Anthropic Messages default endpoint rendered /v1/v1/messages (claude-code 404) - #1813

Merged
dezren39 merged 1 commit into
mainfrom
fix/claude-code-base-url
Nov 6, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/claude-code-base-url

Conversation

@dezren39

@dezren39 dezren39 commented Nov 6, 2026

Copy link
Copy Markdown

Found while enabling the claude-code provider fleet-side (code#6117 follow-through, 2026-11-06):

  • Every request from the deployed server's claude-code provider failed HTTP 404: Not Found (plain body) - for fleet ids (claude-sonnet-5-5) and catalog ids alike.
  • Replay of the provider's exact wire shape with curl against https://api.anthropic.com/v1/messages returns 200 for both id classes (the 2026-11-05 oauth_not_allowed_for_organization 403 is gone since Claude Max was enabled), and against /v1/v1/messages returns the same JSON not_found shape the server surfaced.
  • Root cause: AnthropicMessages.DEFAULT_BASE_URL = "https://api.anthropic.com/v1" + PATH = "/messages" + Endpoint.render verbatim concatenation = /v1/v1/messages on the configured route. The unit test renders the route DEFINITION endpoint (base AnthropicMessages.DEFAULT_BASE_URL in claude-code-messages.ts is NOT the slot the provider config overrides - the provider's configuredRoute sets endpoint: { baseURL: DEFAULT_BASE_URL } from anthropic-messages.ts line 1673's route definition... in short the test and the runtime read different compositions) and stays green.

Fix: DEFAULT_BASE_URL = "https://api.anthropic.com" (bare origin), PATH = "/v1/messages" (version segment exactly once, in the path). Consumers passing explicit baseURLs are unaffected.

Tests: bun test in packages/ai over claude-code, claude-code-auth, anthropic-messages (+cache recorded, thinking-binding, compaction): 126 pass, 0 fail. The existing test asserting the rendered URL https://api.anthropic.com/v1/messages passes unchanged.

DEFAULT_BASE_URL was https://api.anthropic.com/v1 and Endpoint.render
concatenates baseURL + PATH (/messages) verbatim, so every consumer on
the default endpoint posted to https://api.anthropic.com/v1/v1/messages
and got Anthropic's plain 404. The claude-code provider (which always
uses the default) could never complete a request; the unit test masked
it by rendering the route endpoint (DEFINITION base /v1/messages - a
different slot from the configured route's base).

Fix: DEFAULT_BASE_URL is the bare origin and PATH carries the version
segment (/v1/messages), each exactly once. Consumers that pass their
own baseURL (anthropic provider, kimi/moonshot compatibles) are
unaffected - their bases already pair with the versioned path shape.

Also updates the claude-code provider header: the 2026-11-05 org OAuth
denial is resolved (Claude Max enabled 2026-11-06; the provider's exact
wire shape now returns 200 for the fleet model ids).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant