Skip to content

feat: add claude-sonnet-4-6 model metadata to Anthropic adapter#378

Open
imsherrill wants to merge 1 commit intoTanStack:mainfrom
imsherrill:add-claude-sonnet-4-6
Open

feat: add claude-sonnet-4-6 model metadata to Anthropic adapter#378
imsherrill wants to merge 1 commit intoTanStack:mainfrom
imsherrill:add-claude-sonnet-4-6

Conversation

@imsherrill
Copy link

@imsherrill imsherrill commented Mar 14, 2026

🎯 Changes

Add claude-sonnet-4-6 to the Anthropic adapter's model metadata. This is a metadata-only addition — no API contract changes.

  • Add CLAUDE_SONNET_4_6 constant with correct specs (1M native context window, 64k max output, adaptive thinking support)
  • Register in ANTHROPIC_MODELS, AnthropicChatModelProviderOptionsByName, and AnthropicModelInputModalitiesByName
  • Add type assertion tests for provider options and input modalities
  • Add Sonnet 4.6 to the ts-react-chat example app model selector

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

Release Notes

  • New Features
    • Added Claude Sonnet 4.6 model to the Anthropic provider with 1M token native context window and extended thinking capabilities. The model is now available for selection in chat applications and supports text, image, and document inputs with adaptive thinking features.

Add CLAUDE_SONNET_4_6 with 1M native context window, 64k max output,
and adaptive thinking support. Register in all model type maps and
add to ts-react-chat example model selector.
@changeset-bot
Copy link

changeset-bot bot commented Mar 14, 2026

🦋 Changeset detected

Latest commit: 58c6336

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@tanstack/ai-anthropic Minor
@tanstack/tests-adapters Patch
ts-svelte-chat Patch
ts-vue-chat Patch
@tanstack/smoke-tests-e2e Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 272e1f12-6988-4fae-b88d-d8f869e6e6b6

📥 Commits

Reviewing files that changed from the base of the PR and between 0e21282 and 58c6336.

📒 Files selected for processing (4)
  • .changeset/add-claude-sonnet-4-6.md
  • examples/ts-react-chat/src/lib/model-selection.ts
  • packages/typescript/ai-anthropic/src/model-meta.ts
  • packages/typescript/ai-anthropic/tests/model-meta.test.ts

📝 Walkthrough

Walkthrough

This PR introduces support for the claude-sonnet-4-6 Anthropic model across the TanStack AI package. Changes include registering model metadata with context window and feature specifications, integrating the model into example applications, and adding comprehensive test coverage validating the model's configuration and input modalities.

Changes

Cohort / File(s) Summary
Changeset & Documentation
.changeset/add-claude-sonnet-4-6.md
Documents a minor version bump to @tanstack/ai-anthropic introducing claude-sonnet-4-6 with 1M context window and adaptive thinking support.
Core Model Metadata
packages/typescript/ai-anthropic/src/model-meta.ts
Adds CLAUDE_SONNET_4_6 model metadata (context window, pricing, supports), registers it in ANTHROPIC_MODELS, and extends AnthropicChatModelProviderOptionsByName and AnthropicModelInputModalitiesByName maps.
Model Tests
packages/typescript/ai-anthropic/tests/model-meta.test.ts
Adds test cases validating claude-sonnet-4-6 provider options (thinking, service_tier, etc.), type completeness, and input modalities (text, image, document).
Example Integration
examples/ts-react-chat/src/lib/model-selection.ts
Adds claude-sonnet-4-6 as a new selectable option in the example chat application's MODEL_OPTIONS array.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit hops with pure delight,
Claude Sonnet 4.6 shines so bright!
One million tokens to explore,
Adaptive thinking forevermore! ✨🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding Claude Sonnet 4.6 model metadata to the Anthropic adapter, which aligns with the changeset and all code modifications.
Description check ✅ Passed The description follows the template structure, clearly documents all changes made, marks all checklist items appropriately, and confirms that a changeset was generated for this feature addition.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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