@ai-sdk/anthropic 4.0.91 → 4.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.92
4
+
5
+ ### Patch Changes
6
+
7
+ - 61a315e: fix: map the top-level `reasoning` option consistently across providers
8
+
9
+ Providers now resolve reasoning the same way:
10
+
11
+ 1. A provider-specific reasoning setting in `providerOptions` is sent unchanged. OpenAI no longer drops `providerOptions.openai.reasoningEffort` values that are not in its list for the model, and Fireworks no longer rewrites `providerOptions.fireworks.reasoningEffort`. Fireworks also sends top-level `reasoning` values directly instead of rounding them to `'high'` at most, except for model families known to reject `'none'` (GPT-OSS, GLM-5.3, Muse Spark) or `'minimal'` (Nemotron, Inkling).
12
+ 2. Otherwise, `reasoning` maps to the closest level the model supports, rounding down, and rounds up only when there is no lower level. For example, `'xhigh'` now maps to `'high'` instead of `'max'` on Anthropic and Bedrock models without `xhigh` effort, and `'medium'` maps to `'low'` instead of `'high'` on DeepSeek, Kimi K3, and Mistral GLM-5.3 models.
13
+ 3. `'none'` on a model that cannot disable reasoning maps to the model's lowest level with a compatibility warning, instead of being dropped or sending a request the API rejects. This affects GPT-6 models without `'none'`, xAI grok-4.5 and later, Groq GPT-OSS, Kimi K3, Perplexity, QuiverAI, Bedrock OpenAI `gpt-oss` models, and Gemini 2.5 Pro (minimum thinking budget). Gemini 3 and Anthropic and Bedrock `between_tools` mappings now emit the compatibility warning too.
14
+
15
+ `mapReasoningToProviderEffort` now accepts any `reasoning` value, returns an optional `providerOptionsEffort` unchanged, and rounds levels that are missing from the effort map to the closest supported level. `mapReasoningToProviderBudget` maps `'none'` to the minimum reasoning budget, always returns a budget, and uses the default percentage for levels missing from `budgetPercentages`. `OpenAICompatibleChatConfig` adds an optional `mapReasoning` function for mapping the top-level `reasoning` option.
16
+
17
+ - Updated dependencies [61a315e]
18
+ - @ai-sdk/provider-utils@5.0.71
19
+
3
20
  ## 4.0.91
4
21
 
5
22
  ### Patch Changes
package/dist/index.js CHANGED
@@ -5541,7 +5541,14 @@ function hasDynamicFilteringWebToolWithoutCodeExecution(tools) {
5541
5541
  function resolveAnthropicReasoningConfig({ reasoning, modelId, supportsAdaptiveThinking, supportsXhighEffort, rejectsThinkingDisabled, supportsBetweenToolsThinking, maxOutputTokensForModel, warnings }) {
5542
5542
  if (!isCustomReasoning(reasoning)) return;
5543
5543
  if (reasoning === "none") {
5544
- if (supportsBetweenToolsThinking) return { thinking: { type: "between_tools" } };
5544
+ if (supportsBetweenToolsThinking) {
5545
+ warnings.push({
5546
+ type: "compatibility",
5547
+ feature: "reasoning",
5548
+ details: `reasoning 'none' is not supported by ${modelId}; thinking cannot be disabled. Using 'between_tools' thinking, the lowest thinking setting, instead.`
5549
+ });
5550
+ return { thinking: { type: "between_tools" } };
5551
+ }
5545
5552
  if (rejectsThinkingDisabled) {
5546
5553
  warnings.push({
5547
5554
  type: "compatibility",
@@ -5560,26 +5567,23 @@ function resolveAnthropicReasoningConfig({ reasoning, modelId, supportsAdaptiveT
5560
5567
  effort: mapReasoningToProviderEffort({
5561
5568
  reasoning,
5562
5569
  effortMap: {
5563
- minimal: "low",
5564
5570
  low: "low",
5565
5571
  medium: "medium",
5566
5572
  high: "high",
5567
- xhigh: supportsXhighEffort ? "xhigh" : "max",
5573
+ ...supportsXhighEffort && { xhigh: "xhigh" },
5568
5574
  max: "max"
5569
5575
  },
5570
5576
  warnings
5571
5577
  })
5572
5578
  };
5573
- const budgetTokens = mapReasoningToProviderBudget({
5574
- reasoning,
5575
- maxOutputTokens: maxOutputTokensForModel,
5576
- maxReasoningBudget: maxOutputTokensForModel,
5577
- warnings
5578
- });
5579
- if (budgetTokens == null) return;
5580
5579
  return { thinking: {
5581
5580
  type: "enabled",
5582
- budgetTokens
5581
+ budgetTokens: mapReasoningToProviderBudget({
5582
+ reasoning,
5583
+ maxOutputTokens: maxOutputTokensForModel,
5584
+ maxReasoningBudget: maxOutputTokensForModel,
5585
+ warnings
5586
+ })
5583
5587
  } };
5584
5588
  }
5585
5589
  function mapAnthropicResponseContextManagement$1(contextManagement) {
@@ -7021,7 +7025,7 @@ var AnthropicSkills = class {
7021
7025
  };
7022
7026
  //#endregion
7023
7027
  //#region src/version.ts
7024
- const VERSION = "4.0.91";
7028
+ const VERSION = "4.0.92";
7025
7029
  //#endregion
7026
7030
  //#region src/anthropic-provider.ts
7027
7031
  const ANTHROPIC_API_URL = "https://api.anthropic.com";