fix(ai-claude-code): honor chat({ reasoning }) for Claude 5 models #2229
main fromrefs/pull/2229/head·merged by tombeckenham View on GitHubFixes #2224
🎯 Changes#
Root cause: CLAUDE_CODE_REASONING in packages/ai-claude-code/src/model-meta.ts only listed the Claude 4.x models and the opus/sonnet/haiku aliases. For an id that is not in the table, resolveReasoning returns undefined, so chat({ reasoning }) never became --effort for claude-opus-5 and the other Claude 5 ids, and no warning was shown.
Fix: add the Claude 5 models that ai-anthropic lists (claude-opus-5, claude-opus-5-5, claude-sonnet-5, claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5, claude-fable-5-1) to CLAUDE_CODE_MODELS and to the reasoning table with EFFORT_LOW_TO_MAX. EFFORT_MODELS in adapters/text.ts already matched the Opus, Sonnet and Fable 5 ids; it now also matches haiku-5, so Haiku 5.5 gets --effort instead of a thinking-token budget. off is left out for now, as for the 4.7/4.8 effort models in this table (ai-anthropic maps off to none for claude-sonnet-5 and claude-haiku-5-5).
Test: a parametrised test in tests/reasoning-options.test.ts checks that each Claude 5 id (including claude-haiku-5-5) is in the table and that high maps to --effort high. It fails on main and passes with the change. test:lib and test:types pass for ai-claude-code.
Updates the reasoning table in the adapter docs. Includes a changeset.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with
pnpm run test:pr, or these tests do not apply to this pull request. (Ran the packagetest:libandtest:typesinstead.) - I fully understand the code in this pull request, including any code generated with AI assistance.
- Docs: I updated
docs/for this change, or this change is not user-facing. - Changeset: I added a changeset (
pnpm changeset), or this PR does not change a published package.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
This PR was prepared with AI assistance (Claude Code) and the changes were submitted by the contributor.
Summary by CodeRabbit#
- New Features
- Added support for seven Claude 5 models: Opus 5-5, Opus 5, Sonnet 5-5, Sonnet 5, Haiku 5-5, Fable 5-1, and Fable 5.
- These models support configurable reasoning levels from low to max. Haiku 5 models now use effort settings for reasoning requests.
- 1
- 2
Pushed54003f5
tombeckenham approved these changes
Thanks. I checked the Claude 5 reasoning table and the haiku-5 effort regex against issue 2224. On main, reasoning high for claude-opus-5-5 and claude-haiku-5-5 sends no --effort flag. On this branch both send --effort high.
tombeckenham merged thise64c7af
tombeckenham closed this
Sign in to join this conversation.
Open in StackBlitz
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-cartesia
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-cloudflare
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-computer-local
@tanstack/ai-computer-playwright
@tanstack/ai-computer-sandbox
@tanstack/ai-computer-use
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-effect
@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-harness
@tanstack/ai-harness-cli
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-e2b
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-memory
@tanstack/ai-meshy
@tanstack/ai-mistral
@tanstack/ai-muse
@tanstack/ai-neon
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-ollaya
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-optimize
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-reactor
@tanstack/ai-remix
@tanstack/ai-sandbox
@tanstack/ai-sandbox-blaxel
@tanstack/ai-sandbox-boxd
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-e2b
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-railway
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-upstash-box
@tanstack/ai-sandbox-vercel
@tanstack/ai-skills
@tanstack/ai-solid
@tanstack/ai-svelte
@tanstack/ai-typesafe
@tanstack/ai-uthana
@tanstack/ai-utils
@tanstack/ai-vercel-compat
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-worldlabs
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit:
54003f5