@ai-sdk/anthropic 2.0.45 → 2.0.47

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.
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, SharedV2ProviderMetadata, LanguageModelV2
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, SharedV2ProviderMetadata, LanguageModelV2
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -576,7 +576,11 @@ var anthropicProviderOptions = import_v43.z.object({
576
576
  version: import_v43.z.string().optional()
577
577
  })
578
578
  ).optional()
579
- }).optional()
579
+ }).optional(),
580
+ /**
581
+ * @default 'high'
582
+ */
583
+ effort: import_v43.z.enum(["low", "medium", "high"]).optional()
580
584
  });
581
585
 
582
586
  // src/anthropic-prepare-tools.ts
@@ -1843,6 +1847,9 @@ var AnthropicMessagesLanguageModel = class {
1843
1847
  ...isThinking && {
1844
1848
  thinking: { type: "enabled", budget_tokens: thinkingBudget }
1845
1849
  },
1850
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
1851
+ output_config: { effort: anthropicOptions.effort }
1852
+ },
1846
1853
  // container with agent skills:
1847
1854
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
1848
1855
  container: {
@@ -1913,6 +1920,9 @@ var AnthropicMessagesLanguageModel = class {
1913
1920
  });
1914
1921
  }
1915
1922
  }
1923
+ if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
1924
+ betas.add("effort-2025-11-24");
1925
+ }
1916
1926
  const {
1917
1927
  tools: anthropicTools2,
1918
1928
  toolChoice: anthropicToolChoice,
@@ -2716,7 +2726,17 @@ var AnthropicMessagesLanguageModel = class {
2716
2726
  }
2717
2727
  };
2718
2728
  function getMaxOutputTokensForModel(modelId) {
2719
- if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2729
+ if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5")) {
2730
+ return {
2731
+ maxOutputTokens: 64e3,
2732
+ knownModel: true
2733
+ };
2734
+ } else if (modelId.includes("claude-opus-4-1")) {
2735
+ return {
2736
+ maxOutputTokens: 32e3,
2737
+ knownModel: true
2738
+ };
2739
+ } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2720
2740
  return { maxOutputTokens: 64e3, knownModel: true };
2721
2741
  } else if (modelId.includes("claude-opus-4-")) {
2722
2742
  return { maxOutputTokens: 32e3, knownModel: true };