Skip to content

Commit 3cec579

Browse files
Refactor headers function in AnthropicAPIConfig for improved readability
1 parent 303e20d commit 3cec579

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/providers/anthropic/api.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ import { ProviderAPIConfig } from '../types';
33
const AnthropicAPIConfig: ProviderAPIConfig = {
44
getBaseURL: () => 'https://api.anthropic.com/v1',
55

6-
headers: ({ providerOptions, fn, headers: requestHeaders, gatewayRequestBody }) => {
6+
headers: ({
7+
providerOptions,
8+
fn,
9+
headers: requestHeaders,
10+
gatewayRequestBody,
11+
}) => {
712
const apiKey =
813
providerOptions.apiKey || requestHeaders?.['x-api-key'] || '';
914
const headers: Record<string, string> = {
1015
'X-API-Key': apiKey,
1116
};
12-
17+
1318
// Accept anthropic_beta and anthropic_version in body to support enviroments which cannot send it in headers.
1419
const betaHeader =
1520
providerOptions?.['anthropicBeta'] ??
@@ -42,4 +47,4 @@ const AnthropicAPIConfig: ProviderAPIConfig = {
4247
},
4348
};
4449

45-
export default AnthropicAPIConfig;
50+
export default AnthropicAPIConfig;

0 commit comments

Comments
 (0)