Repository navigation
fix(server): custom Claude models named like a Claude Code alias reach the API unchanged - #34938
Merged
Merged
Conversation
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.
Claude Code expands the bare aliases opus, sonnet, haiku and fable to its own built-in models. When a custom Claude model has one of those names, scopeClaudeModelCatalog removes the alias from the built-in entry, so T3 sends the custom slug (for example
opus) unchanged, and the CLI then swapped it for claude-opus-5-5. makeClaudeQueryOptions now adds ANTHROPIC_DEFAULT__MODEL= to the flag settings env whenever the outgoing apiModelId is one of those four aliases. This is the same merge path the ENABLE_TOOL_SEARCH override uses, so a user's settings.json env cannot override it. A built-in alias selection never reaches this branch because it resolves to the full slug first. The alias list and env var names were read from the installed Claude Code CLI binary. Checked against a local recording proxy:claude -p --model opussent claude-opus-5-5, and adding--settings '{"env":{"ANTHROPIC_DEFAULT_OPUS_MODEL":"opus"}}'made it send opus. No new regex or parser: the check is a lookup in a fixed set of four names.Fixes #22326
Reproduction on main
Commit 4e0b528 (origin/main). Started a local recording proxy that logs the
modelof each Anthropic request and replies with it. RanT3CODE_DEV_SEED=0 vp run devwith ANTHROPIC_BASE_URL pointing at the proxy and a dummy API key; Settings > Providers showed Claude 'Authenticated · Custom API endpoint'. In Settings > Providers > Claude, added the custom modelopus. Opened a new thread, pickedopusunder Claude in the model picker, sent 'Say hi'. The proxy received POST /v1/messages with modelclaude-opus-5-5, and the thread reply showed 'proxy saw model=claude-opus-5-5'. T3's provider event log showed the outgoing query.open had options.model = "opus", so T3 passes the custom slug through unchanged (the missing-catalog cause in the report was fixed by #27034). Running the Claude CLI 2.1.322 directly against the proxy:claude -p --model opussent claude-opus-5-5,--model xpussent xpus, andANTHROPIC_DEFAULT_OPUS_MODEL=opus claude -p --model opussent opus. Claude Code expands its own built-in alias.Evidence
Select custom Claude model
opusin a new thread and sendSay hi. Both sides use fresh isolated databases, Claude CLI 2.1.322, the same local recording endpoint, and a 1280×800 light-theme web browser. The endpoint streams a diagnostic response determined by the actual request model.Recording endpoint script · Reproduction instructions · Sanitized runtime transcript
Base sent an expanded built-in identifier; head sent exactly
opus. AI-assisted; verified with the tests and tools listed above.Not shown:
Tests
vp test run src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts (apps/server): 399 passed, including the repro test from factory/repro-22326. vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and test (2 files, 401 tests) all passed. Manual: Claude CLI against a local recording proxy, with and without the alias override in flag settings env (claude-opus-5-5 vs opus).
Not in this change
AI-assisted; verified with the tests and tools listed above.