fix: Bedrock routing for OpenAI-compatible endpoints#2219
fix: Bedrock routing for OpenAI-compatible endpoints#2219paylm wants to merge 2 commits intoWei-Shaw:mainfrom
Conversation
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA). To sign, please reply with the following comment:
You only need to sign once — it will be valid for all your future contributions to this project. I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
I have read the CLA Document and I hereby sign the CLA |
Problem
Bedrock accounts can be selected for Anthropic-platform groups, but OpenAI-compatible routes such as
/v1/chat/completionsand/v1/responseswere forwarding through the generic Anthropic upstream builder.That path does not use Bedrock Runtime signing or API-key handling. When a Bedrock account is selected on
/v1/chat/completions, the request can be sent as if it were a normal Anthropic API request, causing upstream authentication failures such as:This is especially visible after the platform-based routing split for
/v1/chat/completions, where non-OpenAI groups route toGatewayHandler.ChatCompletionsand can schedule Bedrock accounts.Fix
account.IsBedrock()insideGatewayService.ForwardAsChatCompletionsandGatewayService.ForwardAsResponses.NewBedrockSignerFromAccount.Authorization: Bearer <api_key>.Tests
/v1/chat/completionsand/v1/responses, asserting requests go tobedrock-runtimewithAuthorization: Bearerand nox-api-key.go/gofmtbinary is available, and Docker daemon access is denied.