Skip to content

fix(anthropic): show current models in the picker instead of a stale canonical subset - #10722

Closed
kojiromike wants to merge 4 commits into
aaif-goose:mainfrom
kojiromike:anthropic-current-models
Closed

fix(anthropic): show current models in the picker instead of a stale canonical subset#10722
kojiromike wants to merge 4 commits into
aaif-goose:mainfrom
kojiromike:anthropic-current-models

Conversation

@kojiromike

Copy link
Copy Markdown
Contributor

Problem

The built-in Anthropic provider already fetches /v1/models live, but the picker path (fetch_recommended_models) runs every returned model through the bundled CanonicalModelRegistry and 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-5 and claude-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/models list for the built-in Anthropic provider:

  • Skip canonical filtering for the built-in 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 own skip_canonical_filtering config).
  • Sort newest-first by created_at in fetch_models_from_api (was alphabetical), so the freshest models are at the top of the dropdown.
  • Add claude-sonnet-5 / claude-fable-5 to the static ANTHROPIC_KNOWN_MODELS fallback (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

Testing

  • New test fetch_models_from_api_sorts_newest_first (wiremock) asserts newest-first ordering and that entries without created_at stay deterministic.
  • Existing anthropic_def tests pass; cargo clippy clean on both touched crates.

Refs #8321

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/goose-providers/src/anthropic.rs Outdated
@kojiromike

Copy link
Copy Markdown
Contributor Author

Addressed the timestamp-parsing feedback in 005daad. @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/goose/src/providers/anthropic_def.rs Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

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".

@kojiromike

Copy link
Copy Markdown
Contributor Author

Addressed the host-filtering feedback in a741c72. @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/goose/src/providers/anthropic_def.rs Outdated
@kojiromike

Copy link
Copy Markdown
Contributor Author

Addressed the URL-normalization feedback in 28e00d0. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 28e00d0b05

ℹ️ 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".

@kojiromike
kojiromike force-pushed the anthropic-current-models branch from 28e00d0 to 33a4279 Compare July 30, 2026 13:28
@alexhancock alexhancock self-assigned this Jul 30, 2026
…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
@kojiromike
kojiromike force-pushed the anthropic-current-models branch from 33a4279 to 9be4677 Compare July 31, 2026 18:17
/// 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 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Couldn't we check for the specific endpoint we use in our direct-to-anthropic provider?

@kojiromike kojiromike Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants