Summary
The AI SDK provider normalizes Anthropic model IDs to dot-form names like anthropic/claude-3.7-sonnet, but the default max_tokens logic still only checks dash-form names like claude-3-7-sonnet.
That means common Anthropic inputs can silently fall back to 4096 instead of the intended model-specific defaults.
Affected code paths
This looks to affect both V2 and V3:
llm/ai-sdk/provider/stripe-provider.ts
llm/ai-sdk/provider/utils.ts
llm/ai-sdk/provider/stripe-language-model.ts
llm/ai-sdk/provider/stripe-language-model-v3.ts
Repro
The provider factory normalizes Anthropic model IDs:
anthropic/claude-3-7-sonnet-20250115 -> anthropic/claude-3.7-sonnet
anthropic/claude-3-5-haiku-20241022 -> anthropic/claude-3.5-haiku
But getDefaultMaxTokens() still checks only dash-form strings such as:
claude-3-7-sonnet
claude-3-5-haiku
haiku-4-5
So after normalization, these models miss their intended branches.
Actual behavior
Examples that appear to fall through to the fallback:
anthropic/claude-3-7-sonnet-20250115 -> normalized to anthropic/claude-3.7-sonnet -> falls back to 4096 instead of 64000
anthropic/claude-3-5-haiku-20241022 -> normalized to anthropic/claude-3.5-haiku -> falls back to 4096 instead of 8192
anthropic/claude-haiku-4-5-* -> normalized to anthropic/claude-haiku-4.5 -> falls back to 4096 instead of 64000
Expected behavior
Normalized Anthropic model IDs should still receive the intended default max_tokens values.
Suggested fix
Either:
- Normalize again inside
getDefaultMaxTokens(), or
- Check both dash-form and dot-form model IDs there
It would also help to add tests that cover the full provider path via createStripe() / createStripeV3(), since the current tests already cover normalization and default token behavior separately but not together.
History
From local history, this appears to have been introduced when the provider was added in #167 and then mirrored into the V3 implementation in #303.
Summary
The AI SDK provider normalizes Anthropic model IDs to dot-form names like
anthropic/claude-3.7-sonnet, but the defaultmax_tokenslogic still only checks dash-form names likeclaude-3-7-sonnet.That means common Anthropic inputs can silently fall back to
4096instead of the intended model-specific defaults.Affected code paths
This looks to affect both V2 and V3:
llm/ai-sdk/provider/stripe-provider.tsllm/ai-sdk/provider/utils.tsllm/ai-sdk/provider/stripe-language-model.tsllm/ai-sdk/provider/stripe-language-model-v3.tsRepro
The provider factory normalizes Anthropic model IDs:
anthropic/claude-3-7-sonnet-20250115->anthropic/claude-3.7-sonnetanthropic/claude-3-5-haiku-20241022->anthropic/claude-3.5-haikuBut
getDefaultMaxTokens()still checks only dash-form strings such as:claude-3-7-sonnetclaude-3-5-haikuhaiku-4-5So after normalization, these models miss their intended branches.
Actual behavior
Examples that appear to fall through to the fallback:
anthropic/claude-3-7-sonnet-20250115-> normalized toanthropic/claude-3.7-sonnet-> falls back to4096instead of64000anthropic/claude-3-5-haiku-20241022-> normalized toanthropic/claude-3.5-haiku-> falls back to4096instead of8192anthropic/claude-haiku-4-5-*-> normalized toanthropic/claude-haiku-4.5-> falls back to4096instead of64000Expected behavior
Normalized Anthropic model IDs should still receive the intended default
max_tokensvalues.Suggested fix
Either:
getDefaultMaxTokens(), orIt would also help to add tests that cover the full provider path via
createStripe()/createStripeV3(), since the current tests already cover normalization and default token behavior separately but not together.History
From local history, this appears to have been introduced when the provider was added in #167 and then mirrored into the V3 implementation in #303.