Repository navigation
fix(ai): Anthropic Messages default endpoint rendered /v1/v1/messages (claude-code 404) - #1813
Merged
Merged
Conversation
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).
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while enabling the claude-code provider fleet-side (code#6117 follow-through, 2026-11-06):
HTTP 404: Not Found(plain body) - for fleet ids (claude-sonnet-5-5) and catalog ids alike.https://api.anthropic.com/v1/messagesreturns 200 for both id classes (the 2026-11-05oauth_not_allowed_for_organization403 is gone since Claude Max was enabled), and against/v1/v1/messagesreturns the same JSON not_found shape the server surfaced.AnthropicMessages.DEFAULT_BASE_URL = "https://api.anthropic.com/v1"+PATH = "/messages"+Endpoint.renderverbatim concatenation =/v1/v1/messageson the configured route. The unit test renders the route DEFINITION endpoint (baseAnthropicMessages.DEFAULT_BASE_URLin claude-code-messages.ts is NOT the slot the provider config overrides - the provider'sconfiguredRoutesetsendpoint: { 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 testin 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 URLhttps://api.anthropic.com/v1/messagespasses unchanged.