feat(ai-anthropic): first-class Claude Sonnet 5 and Claude Fable 5 support#884
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughThis PR adds Claude Sonnet 5 and Claude Fable 5 support to the Anthropic adapter. It updates model metadata, provider option typing, combined tools+schema capability registration, tests, and docs, and adds the ChangesSonnet 5 / Fable 5 support
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Changeset Version Preview3 package(s) bumped directly, 20 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
|
View your CI Pipeline Execution ↗ for commit 3fbdd67
☁️ Nx Cloud last updated this comment at |
…pport The claude-sonnet-5 and claude-fable-5 entries landed mechanically via the OpenRouter metadata sync (#772) but were never wired into the adapter's capability maps, so the models were selectable without per-model type safety or the native combined tools+schema path. - Per-model provider options now match the API surface: Fable 5 accepts only adaptive thinking (explicit disabled/budget_tokens 400), Sonnet 5 accepts adaptive or disabled, and neither accepts temperature/top_p/top_k - output_config.effort gains the 'xhigh' level (Opus 4.7+, Sonnet 5, Fable 5) - Both models registered in ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS (plus the missing claude-opus-4.8 / 4.8-fast entries) - Tool-capability type map covers sonnet-5, fable-5, opus-4-7-fast, opus-4.8, opus-4.8-fast so provider tools type-check on those models - Model metadata: adaptive_thinking flags; Sonnet 5 sticker pricing ($3/$15) - Docs, adapter-configuration skill reference, and changeset updated Closes #880 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
3fbdd67 to
e548186
Compare
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-skills
@tanstack/ai-codex
@tanstack/ai-devtools-core
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-mcp
@tanstack/ai-mistral
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-sandbox
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-vercel
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/ai-anthropic/src/model-meta.ts (1)
769-808: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winSet
priority_tiertofalsefor Claude Sonnet 5. Anthropic lists Sonnet 5 as not supporting Priority Tier, so leaving thistrueadvertises a capability the API rejects.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ai-anthropic/src/model-meta.ts` around lines 769 - 808, The CLAUDE_SONNET_5 metadata incorrectly advertises Priority Tier support via supports.priority_tier. Update the CLAUDE_SONNET_5 entry in model-meta.ts to set this capability to false so the ModelMeta definition matches Anthropic’s actual API support and doesn’t expose an unsupported option.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ai-anthropic/src/text/text-provider-options.ts`:
- Around line 245-249: The `effort` doc note is too broad for the current public
typings in `AnthropicChatModelProviderOptionsByName`, since the Claude Opus
4.7/4.7 Fast/4.8/4.8 Fast entries still use `AnthropicThinkingOptions &
AnthropicSamplingOptions` and do not expose `output_config.effort`. Update the
model-specific option mapping so those entries also include
`AnthropicOutputConfigOptions` and `AnthropicMaxTokensOptions`, or narrow the
`xhigh` comment in `text-provider-options.ts` to only the models whose type
actually exposes `output_config.effort`.
---
Outside diff comments:
In `@packages/ai-anthropic/src/model-meta.ts`:
- Around line 769-808: The CLAUDE_SONNET_5 metadata incorrectly advertises
Priority Tier support via supports.priority_tier. Update the CLAUDE_SONNET_5
entry in model-meta.ts to set this capability to false so the ModelMeta
definition matches Anthropic’s actual API support and doesn’t expose an
unsupported option.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7caa1b00-50ff-4927-9d40-b4cf3c31a9f2
📒 Files selected for processing (9)
.changeset/anthropic-sonnet-5-fable-5-support.mddocs/adapters/anthropic.mddocs/config.jsonpackages/ai-anthropic/src/model-meta.tspackages/ai-anthropic/src/text/text-provider-options.tspackages/ai-anthropic/tests/anthropic-adapter.test.tspackages/ai-anthropic/tests/chat-per-model-type-safety.test.tspackages/ai-anthropic/tests/tools-per-model-type-safety.test.tspackages/ai/skills/ai-core/adapter-configuration/references/anthropic-adapter.md
🎯 Changes
Closes #880.
The
claude-sonnet-5andclaude-fable-5entries landed mechanically via the OpenRouter metadata sync (#772), but the models were never wired into the adapter's capability maps — they were selectable without per-model type safety, provider-tool typing, or the native combined tools+schema path. This PR adds proper support:claude-fable-5: thinking is always on — only{ type: 'adaptive' }is accepted (disabledandbudget_tokensboth 400 on the API and are now type errors).claude-sonnet-5: adaptive thinking by default with an explicitdisabledopt-out;budget_tokensrejected.temperature/top_p/top_k(the API rejects them);max_tokensis kept via a newAnthropicMaxTokensOptions.output_config.effortgains the'xhigh'level (Opus 4.7+, Sonnet 5, Fable 5).ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS, plus the missingclaude-opus-4.8/claude-opus-4.8-fastentries.claude-sonnet-5,claude-fable-5,claude-opus-4-7-fast,claude-opus-4.8, andclaude-opus-4.8-fast— previously these resolved to an empty capability list, so provider tools (web search, bash, etc.) failed to type-check on them.adaptive_thinkingflags on both entries; Sonnet 5 pricing corrected to the sticker $3/$15 per MTok (the synced values were the introductory $2/$10 that expires 2026-08-31).supportsCombinedToolsAndSchema()is true for them.docs/adapters/anthropic.mdgains an Adaptive Thinking section covering the per-model rules (kiira-checked snippet), and theadapter-configurationskill reference is updated in the same PR.E2E note: the aimock-based e2e suite pins a fixed recorded model per provider, so model-metadata additions have no e2e-observable surface; coverage follows the repo's established pattern of compile-time per-model tests plus adapter unit tests. Full e2e suite run locally to confirm no regressions (339 passed, 1 skipped).
✅ Checklist
pnpm run test:pr.🚀 Release Impact
🤖 Generated with Claude Code
Summary by CodeRabbit
output_config.effortwith a newxhighlevel for supported models.xhigheffort behavior.