Skip to content

feat(bedrock): serve OpenAI models hosted on Bedrock - #439

Open
taciturnaxolotl wants to merge 3 commits into
mainfrom
feat/bedrock-openai-models
Open

taciturnaxolotl wants to merge 3 commits into
mainfrom
feat/bedrock-openai-models

Conversation

@taciturnaxolotl

Copy link
Copy Markdown
Member

Stacked on #386; only the last commit is new here. Merge #386 first.

  • Bedrock hosts OpenAI's GPT models (GPT-6, GPT-5.6, gpt-oss) behind its OpenAI-compatible endpoint, but the Bedrock provider only spoke the Anthropic API. Using GPT-6 on Bedrock meant hand-configuring a separate OpenAI-compatible provider, and picking the wrong API broke tool calls.
  • The Bedrock provider now picks the API by model ID: Anthropic models keep the Anthropic SDK, GPT models use the Responses API on bedrock-runtime, and gpt-oss uses Chat Completions, the only OpenAI API Bedrock serves it on.

Authentication works the same as for Claude: a Bedrock API key, then AWS_BEARER_TOKEN_BEDROCK, then SigV4 with the default AWS credential chain. It's built on the vendored openai-go bedrock package, which handles signing and keeps ambient OPENAI_* environment variables from reaching AWS.

Provider options for these models use the openai key, so callers (Crush included) need to send OpenAI-shaped options when the model is a GPT model.

Tested against a local server: Responses routing, reasoning effort and the developer role, gpt-oss on Chat Completions, SigV4 signing for the bedrock service and region, custom base URLs, and Claude routing unchanged. I don't have Bedrock credentials, so this hasn't been run against real AWS yet.

💘 Generated with Crush

kimnamu and others added 3 commits September 24, 2026 16:46
isReasoningModel (chat completions) and getResponsesModelConfig
(Responses API) only matched "gpt-5", so gpt-6 IDs were handled as
non-reasoning models: chat completions sent max_tokens, which GPT-6
rejects with a 400, and the Responses API dropped the reasoning effort
with an unsupported-setting warning.

Both checks now use reasoningGenerationPattern (gpt-[5-9]), next to the
responsesGenerationPattern added in #354. It stays on a single digit so
Azure's gpt-35-turbo is not caught.

Co-Authored-By: Claude <noreply@anthropic.com>
Reasoning detection was copied between Chat Completions and Responses,
which is how GPT-6 got fixed in one place and missed in the other. Both
now share one classifier. Chat Completions keeps an allow list of known
reasoning families, since it also serves arbitrary compatible models.
Responses only sees OpenAI models, all current generations of which
reason, so it now treats everything as reasoning except the known
gpt-3, gpt-4 and chat snapshots. Prefixed IDs such as Bedrock's
us.openai.o3 are now recognized too.

The client-side flex and priority checks are removed. They were wrong
in both directions (they blocked every GPT-6 model and allowed several
unsupported ones), and OpenAI changes the supported list often, so the
requested tier is now sent as is and the API reports what it rejects.
A fast service tier constant is added, since priority is now an alias.

IsResponsesReasoningModel now returns false for gpt-4 models.

💘 Generated with Crush

Assisted-by: Crush:claude-opus-5-5
Bedrock hosts OpenAI's GPT models behind its OpenAI-compatible endpoint,
but the Bedrock provider only spoke the Anthropic API, so using GPT-6 on
Bedrock meant hand-configuring a separate OpenAI-compatible provider. The
Bedrock provider now picks the API by model: Anthropic models keep the
Anthropic SDK, GPT models use the Responses API, and gpt-oss uses Chat
Completions, the only OpenAI API Bedrock serves it on.

Authentication matches the Anthropic path: a Bedrock API key, then
AWS_BEARER_TOKEN_BEDROCK, then SigV4 with the default AWS credential
chain. Ambient OPENAI_* environment variables are never sent to AWS.

💘 Generated with Crush

Assisted-by: Crush:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants