File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -949,17 +949,25 @@ export function constructConfigFromRequestHeaders(
949949 vertexModelName : requestHeaders [ `x-${ POWERED_BY } -provider-model` ] ,
950950 vertexBatchEndpoint :
951951 requestHeaders [ `x-${ POWERED_BY } -provider-batch-endpoint` ] ,
952- anthropicBeta : requestHeaders [ `x-${ POWERED_BY } -anthropic-beta` ] ,
952+ anthropicBeta :
953+ requestHeaders [ `x-${ POWERED_BY } -anthropic-beta` ] ||
954+ requestHeaders [ `anthropic-beta` ] ,
953955 } ;
954956
955957 const fireworksConfig = {
956958 fireworksAccountId : requestHeaders [ `x-${ POWERED_BY } -fireworks-account-id` ] ,
957959 fireworksFileLength : requestHeaders [ `x-${ POWERED_BY } -file-upload-size` ] ,
958960 } ;
959961
962+ // we also support the anthropic headers without the x-${POWERED_BY}- prefix for claude code support
960963 const anthropicConfig = {
961- anthropicBeta : requestHeaders [ `x-${ POWERED_BY } -anthropic-beta` ] ,
962- anthropicVersion : requestHeaders [ `x-${ POWERED_BY } -anthropic-version` ] ,
964+ anthropicBeta :
965+ requestHeaders [ `x-${ POWERED_BY } -anthropic-beta` ] ||
966+ requestHeaders [ `anthropic-beta` ] ,
967+ anthropicVersion :
968+ requestHeaders [ `x-${ POWERED_BY } -anthropic-version` ] ||
969+ requestHeaders [ `anthropic-version` ] ,
970+ anthropicApiKey : requestHeaders [ `x-api-key` ] ,
963971 } ;
964972
965973 const vertexServiceAccountJson =
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const AnthropicAPIConfig: ProviderAPIConfig = {
1010 gatewayRequestBody,
1111 } ) => {
1212 const apiKey =
13- providerOptions . apiKey || requestHeaders ?. [ 'x-api-key' ] || '' ;
13+ providerOptions . apiKey || providerOptions . anthropicApiKey || '' ;
1414 const headers : Record < string , string > = {
1515 'X-API-Key' : apiKey ,
1616 } ;
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ export interface Options {
152152 /** Anthropic specific headers */
153153 anthropicBeta ?: string ;
154154 anthropicVersion ?: string ;
155+ anthropicApiKey ?: string ;
155156
156157 /** Fireworks finetune required fields */
157158 fireworksAccountId ?: string ;
You can’t perform that action at this time.
0 commit comments