Skip to content

Backport: fix(anthropic): allow both temperature and topP for non-Anthropic models#14056

Merged
gr2m merged 1 commit intomainfrom
backport/fix-anthropic-temp-top-p-main
Apr 2, 2026
Merged

Backport: fix(anthropic): allow both temperature and topP for non-Anthropic models#14056
gr2m merged 1 commit intomainfrom
backport/fix-anthropic-temp-top-p-main

Conversation

@gr2m
Copy link
Copy Markdown
Collaborator

@gr2m gr2m commented Apr 2, 2026

Background

Port of #14052 to main.

The @ai-sdk/anthropic provider enforces temperature/topP mutual exclusivity for all models, matching a constraint in the Anthropic API. However, providers like Minimax use the Anthropic-compatible API endpoint with non-Anthropic models (e.g. MiniMax-M2.7) that require both temperature and top_p to be set simultaneously.

Summary

  • Introduce isAnthropicModel variable derived from isKnownModel || modelId.startsWith('claude-')
  • Only enforce temperature/topP mutual exclusivity for Anthropic models
  • Non-Anthropic models using the Anthropic-compatible API can now send both parameters

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

Backport of #14052

…hropic models

The temperature/topP mutual exclusivity check was applied to all models
using the @ai-sdk/anthropic provider, but providers like Minimax that
use the Anthropic-compatible API may require both parameters.

- Introduce `isAnthropicModel` derived from `isKnownModel` or `claude-` prefix
- Only enforce temperature/topP mutual exclusivity for Anthropic models

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tigent tigent bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/anthropic Issues related to the @ai-sdk/anthropic provider labels Apr 2, 2026
@gr2m gr2m merged commit f57c702 into main Apr 2, 2026
27 checks passed
@gr2m gr2m deleted the backport/fix-anthropic-temp-top-p-main branch April 2, 2026 16:06
@vercel-ai-sdk
Copy link
Copy Markdown
Contributor

vercel-ai-sdk bot commented Apr 2, 2026

🚀 Published in:

Package Version
@ai-sdk/amazon-bedrock 5.0.0-beta.19
@ai-sdk/anthropic 4.0.0-beta.15
@ai-sdk/google-vertex 5.0.0-beta.29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/anthropic Issues related to the @ai-sdk/anthropic provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants