@ai-sdk/anthropic 2.0.75 → 2.0.77

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,18 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.77
4
+
5
+ ### Patch Changes
6
+
7
+ - 5543cd1: Add AI Gateway hint to provider READMEs
8
+ - e1ed246: fix(anthropic): use default thinking budget when unspecified
9
+
10
+ ## 2.0.76
11
+
12
+ ### Patch Changes
13
+
14
+ - 2fe3997: feat (provider/anthropic): add support for inference_geo provider option
15
+
3
16
  ## 2.0.75
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  The **[Anthropic provider](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Anthropic Messages API](https://docs.anthropic.com/claude/reference/messages_post).
4
4
 
5
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access Anthropic (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
6
+
5
7
  ## Setup
6
8
 
7
9
  The Anthropic provider is available in the `@ai-sdk/anthropic` module. You can install it with
package/dist/index.d.mts CHANGED
@@ -178,6 +178,10 @@ declare const anthropicProviderOptions: z.ZodObject<{
178
178
  fast: "fast";
179
179
  standard: "standard";
180
180
  }>>;
181
+ inferenceGeo: z.ZodOptional<z.ZodEnum<{
182
+ us: "us";
183
+ global: "global";
184
+ }>>;
181
185
  contextManagement: z.ZodOptional<z.ZodObject<{
182
186
  edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
183
187
  type: z.ZodLiteral<"clear_tool_uses_20250919">;
package/dist/index.d.ts CHANGED
@@ -178,6 +178,10 @@ declare const anthropicProviderOptions: z.ZodObject<{
178
178
  fast: "fast";
179
179
  standard: "standard";
180
180
  }>>;
181
+ inferenceGeo: z.ZodOptional<z.ZodEnum<{
182
+ us: "us";
183
+ global: "global";
184
+ }>>;
181
185
  contextManagement: z.ZodOptional<z.ZodObject<{
182
186
  edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
183
187
  type: z.ZodLiteral<"clear_tool_uses_20250919">;
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
31
31
  var import_provider_utils21 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "2.0.75" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.77" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -729,6 +729,15 @@ var anthropicProviderOptions = import_v43.z.object({
729
729
  * Only supported with claude-opus-4-6.
730
730
  */
731
731
  speed: import_v43.z.enum(["fast", "standard"]).optional(),
732
+ /**
733
+ * Controls where model inference runs for this request.
734
+ *
735
+ * - `"global"`: Inference may run in any available geography (default).
736
+ * - `"us"`: Inference runs only in US-based infrastructure.
737
+ *
738
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
739
+ */
740
+ inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
732
741
  /**
733
742
  * Context management configuration for automatic context window management.
734
743
  * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
@@ -2140,6 +2149,9 @@ var AnthropicMessagesLanguageModel = class {
2140
2149
  ...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
2141
2150
  speed: anthropicOptions.speed
2142
2151
  },
2152
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
2153
+ inference_geo: anthropicOptions.inferenceGeo
2154
+ },
2143
2155
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2144
2156
  cache_control: anthropicOptions.cacheControl
2145
2157
  },
@@ -2221,9 +2233,15 @@ var AnthropicMessagesLanguageModel = class {
2221
2233
  };
2222
2234
  if (isThinking) {
2223
2235
  if (thinkingType === "enabled" && thinkingBudget == null) {
2224
- throw new import_provider3.UnsupportedFunctionalityError({
2225
- functionality: "thinking requires a budget"
2236
+ warnings.push({
2237
+ type: "other",
2238
+ message: "thinking budget is required when thinking is enabled. using default budget of 1024 tokens."
2226
2239
  });
2240
+ baseArgs.thinking = {
2241
+ type: "enabled",
2242
+ budget_tokens: 1024
2243
+ };
2244
+ thinkingBudget = 1024;
2227
2245
  }
2228
2246
  if (baseArgs.temperature != null) {
2229
2247
  baseArgs.temperature = void 0;