fix(anthropic): show current models in the picker instead of a stale canonical subset - #10722
fix(anthropic): show current models in the picker instead of a stale canonical subset#10722kojiromike wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eedebff119
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 005daad974
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a741c727b0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
28e00d0 to
33a4279
Compare
…canonical subset The built-in Anthropic provider fetches /v1/models live, but the picker path (fetch_recommended_models) filtered every result through the bundled canonical registry and silently dropped anything not present there. That registry is generated from models.dev at build time and lags Anthropic releases — e.g. claude-opus-5 and claude-opus-4-8 are absent — so brand-new models the API key can actually use never appear in the dropdown. Trust the first-party /v1/models list for the built-in provider: - skip canonical filtering so the live list flows straight to the picker - sort returned models newest-first by created_at (was alphabetical) - add claude-sonnet-5 / claude-fable-5 to the static fallback list Refs aaif-goose#8321 Assisted-by: Claude Code
Lexical RFC 3339 comparison misorders models when a compatible endpoint returns mixed UTC offsets or fractional seconds; parse into DateTime<Utc> so the picker's newest-first ordering holds for declarative/custom Anthropic providers too. Assisted-by: Claude Code
A custom ANTHROPIC_HOST may front an Anthropic-compatible proxy that also serves non-chat/non-tool models; gate the filter skip on the host being the first-party endpoint so proxied hosts keep the canonical capability filter. Assisted-by: Claude Code
…point Compare parsed scheme/host/effective port/path instead of raw text, so equivalent spellings (https://API.ANTHROPIC.COM, https://api.anthropic.com:443/) still opt into the unfiltered /v1/models list. Assisted-by: Claude Code
33a4279 to
9be4677
Compare
| /// Compare against the official endpoint on normalized components rather than raw text, so | ||
| /// equivalent spellings (`https://API.ANTHROPIC.COM`, `https://api.anthropic.com:443/`) are | ||
| /// recognized as first party. | ||
| fn is_first_party_anthropic_host(host: &str) -> bool { |
There was a problem hiding this comment.
Do we need this? Couldn't we check for the specific endpoint we use in our direct-to-anthropic provider?
There was a problem hiding this comment.
No, it's pretty much obsolete anyway.
Since #10756 resolved many of the same things as this PR, I think it's OK to close it outright. I can open a followup ticket to address the missing models in ANTHROPIC_KNOWN_MODELS.
Problem
The built-in Anthropic provider already fetches
/v1/modelslive, but the picker path (fetch_recommended_models) runs every returned model through the bundledCanonicalModelRegistryand silently drops any model that isn't in it (base.rs,map_to_canonical_model(...)?).That registry is generated from models.dev at build time, so it lags Anthropic releases. Today the bundled data has 0 entries for
claude-opus-5andclaude-opus-4-8— so those models never appear in the dropdown even though the user's key returns them from/v1/models. This is the first-party instance of the broader problem in #8321.Change
Trust the first-party
/v1/modelslist for the built-in Anthropic provider:anthropic_def.rs) so the live list flows straight to the picker. The flag already exists; this just opts the first-party provider in. Third-party/declarative providers are unchanged (they still honor their ownskip_canonical_filteringconfig).created_atinfetch_models_from_api(was alphabetical), so the freshest models are at the top of the dropdown.claude-sonnet-5/claude-fable-5to the staticANTHROPIC_KNOWN_MODELSfallback (shown before an API key is set).Canonical filtering exists to tame huge aggregated catalogs (OpenRouter's thousands of models); for a first-party endpoint that already returns the correct small list, it's pure downside.
Scope / non-goals
claude-acp), which resolves models via theclaude-agent-acpadapter, not/v1/models— that's Claude Code (ACP) model picker is a silent no-op — selection never reaches the adapter #10669's territory./v1/modelsmax_input_tokensis a sensible follow-up.Testing
fetch_models_from_api_sorts_newest_first(wiremock) asserts newest-first ordering and that entries withoutcreated_atstay deterministic.anthropic_deftests pass;cargo clippyclean on both touched crates.Refs #8321