feat: add x-anthropic-beta header to OpenRouter requests

This commit is contained in:
Roo Code 2025-11-26 22:58:22 +00:00
parent fb9c57e1d9
commit c88f48b45d
2 changed files with 9 additions and 1 deletions

View file

@ -75,6 +75,7 @@ describe("OpenRouterHandler", () => {
"HTTP-Referer": "https://github.com/RooVetGit/Roo-Cline",
"X-Title": "Roo Code",
"User-Agent": `RooCode/${Package.version}`,
"x-anthropic-beta": "fine-grained-tool-streaming-2025-05-14",
},
})
})

View file

@ -72,7 +72,14 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
const baseURL = this.options.openRouterBaseUrl || "https://openrouter.ai/api/v1"
const apiKey = this.options.openRouterApiKey ?? "not-provided"
this.client = new OpenAI({ baseURL, apiKey, defaultHeaders: DEFAULT_HEADERS })
this.client = new OpenAI({
baseURL,
apiKey,
defaultHeaders: {
...DEFAULT_HEADERS,
"x-anthropic-beta": "fine-grained-tool-streaming-2025-05-14",
},
})
// Load models asynchronously to populate cache before getModel() is called
this.loadDynamicModels().catch((error) => {