mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 13:03:42 +00:00
fix(ai): Add anthropic-dangerous-direct-browser-access header
- Required header for browser-based access to Anthropic API - Added to both OAuth and regular API key authentication - Ensures full browser compatibility
This commit is contained in:
parent
8324cd4192
commit
a62231987c
1 changed files with 7 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ export class AnthropicLLM implements LLM<AnthropicLLMOptions> {
|
|||
if (apiKey.includes("sk-ant-oat")) {
|
||||
const defaultHeaders = {
|
||||
accept: "application/json",
|
||||
"anthropic-dangerous-direct-browser-access": "true",
|
||||
"anthropic-beta": "oauth-2025-04-20,fine-grained-tool-streaming-2025-05-14",
|
||||
};
|
||||
|
||||
|
|
@ -61,7 +62,12 @@ export class AnthropicLLM implements LLM<AnthropicLLMOptions> {
|
|||
});
|
||||
this.isOAuthToken = true;
|
||||
} else {
|
||||
this.client = new Anthropic({ apiKey, baseURL: model.baseUrl, dangerouslyAllowBrowser: true });
|
||||
const defaultHeaders = {
|
||||
accept: "application/json",
|
||||
"anthropic-dangerous-direct-browser-access": "true",
|
||||
"anthropic-beta": "fine-grained-tool-streaming-2025-05-14",
|
||||
};
|
||||
this.client = new Anthropic({ apiKey, baseURL: model.baseUrl, dangerouslyAllowBrowser: true, defaultHeaders });
|
||||
this.isOAuthToken = false;
|
||||
}
|
||||
this.modelInfo = model;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue