Repository navigation
Claude Desktop takeover: follow the model-name rule of the current Claude Desktop - #282
Merged
Merged
Conversation
…aude Desktop Claude Desktop 2.19675.0 decides which gateway model names it accepts with a denylist of other vendors' name fragments followed by an allowlist: a name is rejected if it contains any fragment such as deepseek, gpt, qwen or codex (even next to "claude"), and otherwise accepted if it is a bare tier name (sonnet, opus-4.8) or contains claude, anthropic or a tier name (sonnet, opus, haiku, fable, mythos). An invalid inferenceModels entry is now dropped on its own with a configuration error instead of rejecting the whole list, and "X[1m]" is accepted as shorthand for X with a 1M-context variant. looks_like_claude now mirrors that rule, with the denylist copied verbatim from the app bundle (JS \b and \d translated to their ASCII meaning). Names Desktop would drop are still left out of inferenceModels, since each one produces a configuration error, and the fallback model with its routing rule stays for a gateway that lists nothing Desktop accepts. [1m] spellings are no longer refused: a gateway listing both X and X[1m] gets one model with a 1M variant in Desktop's picker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changed
The Claude Desktop takeover writes the gateway's model names into
inferenceModels, keeping only the names Claude Desktop accepts. The rule Lite applied (looks_like_claude) described an older Claude Desktop: onlyclaude-<sonnet|opus|haiku|fable>-<version>,[1m]spellings refused, and the assumption that one unaccepted entry made Desktop reject the whole list. This PR updates it to the rule of the current app.Rules taken from Claude Desktop 2.19675.0 (macOS,
Contents/Resources/app.asar,.vite/build/index.chunk-*.jsand.vite/build/index.pre.js, which carry identical copies):/ark-code|astron|command-r|deepseek|doubao|gemini|gemma|glm|gpt|grok|hermes|hy3|kimi|lfm|\bling\b|llama|longcat|mimo|minimax|mistral|mixtral|moonshot|nemotron|openai|phi-|qianfan|qwen|tc-code|\bunic\b|yi-|stepfun|step-3|seed-|bytedance|hunyuan|granite|amazon\.nova|nova-|devstral|ministral|ernie|codex|arcee|trinity|abab|phi\d|\bk2\.|\bm2\.|jamba|arctic|solar|mercury|zamba|kat-coder|\bds-|dpsk/^(sonnet|opus|haiku|fable|mythos)(-[\d.]+)?$, or containsclaude,sonnet,opus,haiku,fable,mythosoranthropic.inferenceModelsentries are trimmed and a trailing[1m](case-insensitive) is stripped before the check.X[1m]stands for "X, with a 1M-context variant", andXlisted next toX[1m]is folded into one picker entry.inferenceModels: "<name>" is not an Anthropic model and was removed from the list — <reason>. The other entries are kept. If every entry fails, no model is left to pick.GET /v1/models.Changes in Lite
looks_like_claudenow matches the denylist first and the allowlist second. The denylist is copied verbatim; JS\band\dare translated to their ASCII meaning ((?-u:\b),[0-9]) so non-ASCII names behave as they do in Desktop. This addsregextotw-adopt, which was already inCargo.lock.[1m]spellings are no longer refused. A gateway that lists bothXandX[1m]now gets one model with a 1M variant in Desktop's picker.inferenceModels, because each one would produce a configuration error. The fallback (claude-sonnet-5plus the routing rule spelled out in the plan) stays for a gateway that lists nothing Desktop accepts, because Desktop then has no model to offer.Tests
The examples in the unit test were checked against Desktop's own functions, extracted from the bundle and run under Node. They include accepted names (
claude-sonnet-5[1m],claude-opus-4-8[1M], baresonnet/opus-4.8/mythos-1,my-claude-proxy,claude-sibling) and rejected names (claude-deepseek-v3,DeepSeek-Claude,claude-codex,sonnet-qwen,claude-ling,claude-éling,claude-k2.5,opus-ds-1).cargo fmt --all --checkcargo clippy -p tw-adopt --all-targets -- -D warningscargo clippy -p thinkwatch-lite --all-targets -- -D warningscargo test -p tw-adopt: 260 unit tests and all integration tests pass, including the newone_m_spellings_are_written_and_other_vendors_are_left_outand the extended fallback test.cargo test -p thinkwatch-lite: 410 unit tests,control_plane,msg_codesandts_bindingspass.control_planewas run against twcore 0.61.0.The changed code isn't platform-specific (no
cfg(windows)).🤖 Generated with Claude Code