mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
Compare commits
1
Commits
chat
...
anthropicGetFix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3555d05d54 |
@@ -32,6 +32,21 @@ export function createAIClient(provider: AIProvider, user?: NUser, corsProxy?: s
|
||||
request = new Request(request, { headers });
|
||||
}
|
||||
|
||||
// Add Anthropic-specific headers
|
||||
// https://docs.anthropic.com/en/api/versioning
|
||||
if (provider.id === 'anthropic') {
|
||||
const headers = new Headers(request.headers);
|
||||
headers.set('anthropic-version', '2023-06-01');
|
||||
// Required header for direct browser access
|
||||
headers.set('anthropic-dangerous-direct-browser-access', 'true');
|
||||
// Anthropic expects x-api-key header instead of Authorization: Bearer
|
||||
if (provider.apiKey) {
|
||||
headers.set('x-api-key', provider.apiKey);
|
||||
headers.delete('authorization'); // Remove the Bearer token that OpenAI client adds
|
||||
}
|
||||
request = new Request(request, { headers });
|
||||
}
|
||||
|
||||
// If Nostr authentication is required and we have a user, use NIP-98
|
||||
if (provider.nostr && user?.signer) {
|
||||
// Create the NIP98 token
|
||||
|
||||
Reference in new issue
Block a user