Skip to content

Claude Desktop takeover: follow the model-name rule of the current Claude Desktop - #282

Merged
fylorn merged 1 commit into
devfrom
claude-desktop-current-rules
Oct 4, 2026
Merged

fylorn merged 1 commit into
devfrom
claude-desktop-current-rules

Conversation

@fylorn

@fylorn fylorn commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

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: only claude-<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-*.js and .vite/build/index.pre.js, which carry identical copies):

  • For a gateway provider, a name is lowercased and rejected if it matches this denylist of other vendors' name fragments, even when it also contains "claude":
    /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/
  • Otherwise it is accepted if it is a bare tier name, ^(sonnet|opus|haiku|fable|mythos)(-[\d.]+)?$, or contains claude, sonnet, opus, haiku, fable, mythos or anthropic.
  • inferenceModels entries are trimmed and a trailing [1m] (case-insensitive) is stripped before the check. X[1m] stands for "X, with a 1M-context variant", and X listed next to X[1m] is folded into one picker entry.
  • An entry that fails the check is dropped on its own, with the configuration error 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.
  • The same rule also filters the list Desktop builds from the gateway's own GET /v1/models.

Changes in Lite

  • looks_like_claude now matches the denylist first and the allowlist second. The denylist is copied verbatim; JS \b and \d are translated to their ASCII meaning ((?-u:\b), [0-9]) so non-ASCII names behave as they do in Desktop. This adds regex to tw-adopt, which was already in Cargo.lock.
  • [1m] spellings are no longer refused. A gateway that lists both X and X[1m] now gets one model with a 1M variant in Desktop's picker.
  • Names Desktop would drop are still left out of inferenceModels, because each one would produce a configuration error. The fallback (claude-sonnet-5 plus 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.
  • The comments that described the old behaviour have been rewritten.
  • No user-visible strings changed (no new or changed message codes).

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], bare sonnet / 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 --check
  • cargo clippy -p tw-adopt --all-targets -- -D warnings
  • cargo clippy -p thinkwatch-lite --all-targets -- -D warnings
  • cargo test -p tw-adopt: 260 unit tests and all integration tests pass, including the new one_m_spellings_are_written_and_other_vendors_are_left_out and the extended fallback test.
  • cargo test -p thinkwatch-lite: 410 unit tests, control_plane, msg_codes and ts_bindings pass. control_plane was run against twcore 0.61.0.

The changed code isn't platform-specific (no cfg(windows)).

🤖 Generated with Claude Code

…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>
@fylorn
fylorn merged commit e2666ee into dev Oct 4, 2026
4 checks passed
@fylorn
fylorn deleted the claude-desktop-current-rules branch October 4, 2026 17:25
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