fix(ai): drop deprecated fine-grained-tool-streaming beta header, use eager_input_streaming per-tool
Replace the deprecated global anthropic-beta header with per-tool eager_input_streaming: true. Fix empty anthropic-beta header causing 400 errors on models with no beta features. fixes #3175
This commit is contained in:
@@ -762,7 +762,7 @@ function createClient(
|
|||||||
return { client, isOAuthToken: false };
|
return { client, isOAuthToken: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
const betaFeatures = ["fine-grained-tool-streaming-2025-05-14"];
|
const betaFeatures: string[] = [];
|
||||||
if (needsInterleavedBeta) {
|
if (needsInterleavedBeta) {
|
||||||
betaFeatures.push("interleaved-thinking-2025-05-14");
|
betaFeatures.push("interleaved-thinking-2025-05-14");
|
||||||
}
|
}
|
||||||
@@ -778,7 +778,7 @@ function createClient(
|
|||||||
{
|
{
|
||||||
accept: "application/json",
|
accept: "application/json",
|
||||||
"anthropic-dangerous-direct-browser-access": "true",
|
"anthropic-dangerous-direct-browser-access": "true",
|
||||||
"anthropic-beta": `claude-code-20250219,oauth-2025-04-20,${betaFeatures.join(",")}`,
|
"anthropic-beta": ["claude-code-20250219", "oauth-2025-04-20", ...betaFeatures].join(","),
|
||||||
"user-agent": `claude-cli/${claudeCodeVersion}`,
|
"user-agent": `claude-cli/${claudeCodeVersion}`,
|
||||||
"x-app": "cli",
|
"x-app": "cli",
|
||||||
},
|
},
|
||||||
@@ -799,7 +799,7 @@ function createClient(
|
|||||||
{
|
{
|
||||||
accept: "application/json",
|
accept: "application/json",
|
||||||
"anthropic-dangerous-direct-browser-access": "true",
|
"anthropic-dangerous-direct-browser-access": "true",
|
||||||
"anthropic-beta": betaFeatures.join(","),
|
...(betaFeatures.length > 0 ? { "anthropic-beta": betaFeatures.join(",") } : {}),
|
||||||
},
|
},
|
||||||
model.headers,
|
model.headers,
|
||||||
optionsHeaders,
|
optionsHeaders,
|
||||||
@@ -1091,6 +1091,7 @@ function convertTools(
|
|||||||
return {
|
return {
|
||||||
name: isOAuthToken ? toClaudeCodeName(tool.name) : tool.name,
|
name: isOAuthToken ? toClaudeCodeName(tool.name) : tool.name,
|
||||||
description: tool.description,
|
description: tool.description,
|
||||||
|
eager_input_streaming: true,
|
||||||
input_schema: {
|
input_schema: {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: schema.properties ?? {},
|
properties: schema.properties ?? {},
|
||||||
|
|||||||
Reference in New Issue
Block a user