From 56fd16e5c0653f2f59a8396f672e885dc68855fd Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Fri, 24 Apr 2026 10:49:33 -0400 Subject: [PATCH 1/4] fix: add anthropic transform for deepseek --- packages/opencode/src/provider/transform.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index 7fcfcd250153..908858bdafb1 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -594,6 +594,27 @@ export function variants(model: Provider.Model): Record [ From 153d53cbfdc8691a3e40ef6c401eb6b482a5b181 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Fri, 24 Apr 2026 11:03:54 -0400 Subject: [PATCH 2/4] anthropic patches --- bun.lock | 1 + package.json | 1 + patches/@ai-sdk%2Fanthropic@3.0.71.patch | 100 +++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 patches/@ai-sdk%2Fanthropic@3.0.71.patch diff --git a/bun.lock b/bun.lock index 06a5cfdb4c5a..208b2f013c7c 100644 --- a/bun.lock +++ b/bun.lock @@ -662,6 +662,7 @@ "solid-js@1.9.10": "patches/solid-js@1.9.10.patch", "@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch", "@npmcli/agent@4.0.0": "patches/@npmcli%2Fagent@4.0.0.patch", + "@ai-sdk/anthropic@3.0.71": "patches/@ai-sdk%2Fanthropic@3.0.71.patch", }, "overrides": { "@types/bun": "catalog:", diff --git a/package.json b/package.json index f918bcd025f5..7a9652a17a5d 100644 --- a/package.json +++ b/package.json @@ -127,6 +127,7 @@ "@types/node": "catalog:" }, "patchedDependencies": { + "@ai-sdk/anthropic@3.0.71": "patches/@ai-sdk%2Fanthropic@3.0.71.patch", "@npmcli/agent@4.0.0": "patches/@npmcli%2Fagent@4.0.0.patch", "@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch", "solid-js@1.9.10": "patches/solid-js@1.9.10.patch" diff --git a/patches/@ai-sdk%2Fanthropic@3.0.71.patch b/patches/@ai-sdk%2Fanthropic@3.0.71.patch new file mode 100644 index 000000000000..8611258498ac --- /dev/null +++ b/patches/@ai-sdk%2Fanthropic@3.0.71.patch @@ -0,0 +1,100 @@ +diff --git a/dist/index.js b/dist/index.js +--- a/dist/index.js ++++ b/dist/index.js +@@ -934,6 +934,10 @@ var anthropicLanguageModelOptions = import_v43.z.object({ + */ + effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(), + /** ++ * Raw Anthropic `output_config` passthrough for Anthropic-compatible endpoints. ++ */ ++ output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.any()).optional(), ++ /** + * Task budget for agentic turns. Informs the model of the total token budget + * available for the current task, allowing it to prioritize work and wind down + * gracefully as the budget is consumed. +@@ -3070,8 +3074,9 @@ var AnthropicMessagesLanguageModel = class { + ...thinkingDisplay != null && { display: thinkingDisplay } + } + }, +- ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { ++ ...(Object.keys((anthropicOptions == null ? void 0 : anthropicOptions.output_config) ?? {}).length > 0 || (anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { + output_config: { ++ ...(anthropicOptions == null ? void 0 : anthropicOptions.output_config), + ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && { + effort: anthropicOptions.effort + }, +diff --git a/dist/index.mjs b/dist/index.mjs +--- a/dist/index.mjs ++++ b/dist/index.mjs +@@ -929,6 +929,10 @@ var anthropicLanguageModelOptions = z3.object({ + */ + effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(), + /** ++ * Raw Anthropic `output_config` passthrough for Anthropic-compatible endpoints. ++ */ ++ output_config: z3.record(z3.string(), z3.any()).optional(), ++ /** + * Task budget for agentic turns. Informs the model of the total token budget + * available for the current task, allowing it to prioritize work and wind down + * gracefully as the budget is consumed. +@@ -3107,8 +3111,9 @@ var AnthropicMessagesLanguageModel = class { + ...thinkingDisplay != null && { display: thinkingDisplay } + } + }, +- ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { ++ ...(Object.keys((anthropicOptions == null ? void 0 : anthropicOptions.output_config) ?? {}).length > 0 || (anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { + output_config: { ++ ...(anthropicOptions == null ? void 0 : anthropicOptions.output_config), + ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && { + effort: anthropicOptions.effort + }, +diff --git a/dist/internal/index.js b/dist/internal/index.js +--- a/dist/internal/index.js ++++ b/dist/internal/index.js +@@ -926,6 +926,10 @@ var anthropicLanguageModelOptions = import_v43.z.object({ + */ + effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(), + /** ++ * Raw Anthropic `output_config` passthrough for Anthropic-compatible endpoints. ++ */ ++ output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.any()).optional(), ++ /** + * Task budget for agentic turns. Informs the model of the total token budget + * available for the current task, allowing it to prioritize work and wind down + * gracefully as the budget is consumed. +@@ -3062,8 +3066,9 @@ var AnthropicMessagesLanguageModel = class { + ...thinkingDisplay != null && { display: thinkingDisplay } + } + }, +- ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { ++ ...(Object.keys((anthropicOptions == null ? void 0 : anthropicOptions.output_config) ?? {}).length > 0 || (anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { + output_config: { ++ ...(anthropicOptions == null ? void 0 : anthropicOptions.output_config), + ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && { + effort: anthropicOptions.effort + }, +diff --git a/dist/internal/index.mjs b/dist/internal/index.mjs +--- a/dist/internal/index.mjs ++++ b/dist/internal/index.mjs +@@ -913,6 +913,10 @@ var anthropicLanguageModelOptions = z3.object({ + */ + effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(), + /** ++ * Raw Anthropic `output_config` passthrough for Anthropic-compatible endpoints. ++ */ ++ output_config: z3.record(z3.string(), z3.any()).optional(), ++ /** + * Task budget for agentic turns. Informs the model of the total token budget + * available for the current task, allowing it to prioritize work and wind down + * gracefully as the budget is consumed. +@@ -3091,8 +3095,9 @@ var AnthropicMessagesLanguageModel = class { + ...thinkingDisplay != null && { display: thinkingDisplay } + } + }, +- ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { ++ ...(Object.keys((anthropicOptions == null ? void 0 : anthropicOptions.output_config) ?? {}).length > 0 || (anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && { + output_config: { ++ ...(anthropicOptions == null ? void 0 : anthropicOptions.output_config), + ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && { + effort: anthropicOptions.effort + }, From 7d60e47e19ba7ab004a352142c920e09a88f471a Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sat, 25 Apr 2026 14:18:02 -0400 Subject: [PATCH 3/4] fix: ensure output config maps correctly --- packages/opencode/src/provider/transform.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index 9de1b1debf11..a5eb0adc1788 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -619,7 +619,7 @@ export function variants(model: Provider.Model): Record Date: Sat, 25 Apr 2026 14:29:33 -0400 Subject: [PATCH 4/4] add patch for .d.ts --- patches/@ai-sdk%2Fanthropic@3.0.71.patch | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/patches/@ai-sdk%2Fanthropic@3.0.71.patch b/patches/@ai-sdk%2Fanthropic@3.0.71.patch index 8611258498ac..086aaba9aa1e 100644 --- a/patches/@ai-sdk%2Fanthropic@3.0.71.patch +++ b/patches/@ai-sdk%2Fanthropic@3.0.71.patch @@ -48,6 +48,34 @@ diff --git a/dist/index.mjs b/dist/index.mjs ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && { effort: anthropicOptions.effort }, +diff --git a/dist/index.d.ts b/dist/index.d.ts +--- a/dist/index.d.ts ++++ b/dist/index.d.ts +@@ -178,9 +178,10 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{ + high: "high"; + xhigh: "xhigh"; + max: "max"; + }>>; ++ output_config: z.ZodOptional>; + taskBudget: z.ZodOptional; + total: z.ZodNumber; + remaining: z.ZodOptional; + }, z.core.$strip>>; +diff --git a/dist/index.d.mts b/dist/index.d.mts +--- a/dist/index.d.mts ++++ b/dist/index.d.mts +@@ -178,9 +178,10 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{ + high: "high"; + xhigh: "xhigh"; + max: "max"; + }>>; ++ output_config: z.ZodOptional>; + taskBudget: z.ZodOptional; + total: z.ZodNumber; + remaining: z.ZodOptional; + }, z.core.$strip>>; diff --git a/dist/internal/index.js b/dist/internal/index.js --- a/dist/internal/index.js +++ b/dist/internal/index.js