Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x 1x 1x 1x 1x 1x | import type { InternalProviderAPIConfig } from '@shared/types/ai-providers/config';
import { FunctionName } from '@shared/types/api/request';
export const anthropicAPIConfig: InternalProviderAPIConfig = {
getBaseURL: () => 'https://api.anthropic.com/v1',
headers: ({ saTarget, saRequestData }) => {
const headers: Record<string, string> = {
'X-API-Key': `${saTarget.api_key}`,
};
const betaHeader = saTarget.anthropic_beta ?? 'messages-2023-12-15';
const version = saTarget.anthropic_version ?? '2023-06-01';
if (
saRequestData.functionName === FunctionName.CHAT_COMPLETE ||
saRequestData.functionName === FunctionName.STREAM_CHAT_COMPLETE
) {
headers['anthropic-beta'] = betaHeader;
}
headers['anthropic-version'] = version;
return headers;
},
getEndpoint: ({ saRequestData }) => {
switch (saRequestData.functionName) {
case FunctionName.COMPLETE:
case FunctionName.STREAM_COMPLETE:
return '/complete';
case FunctionName.CHAT_COMPLETE:
case FunctionName.STREAM_CHAT_COMPLETE:
return '/messages';
default:
return '';
}
},
};
|