AWS Bedrock with the OpenAI SDK: an LLM gateway for Claude, Nova and Llama on Bedrock
Call AWS Bedrock models (Claude, Amazon Nova, Llama, Mistral) with the OpenAI SDK through one gateway. SigV4 signing, Converse API translation, streaming and tool calls handled for you, with per-feature cost tracking and budgets.
Bedrock speaks its own API (Converse) and needs every request signed with AWS Signature Version 4. Cognocient AI does both, so your application keeps using the OpenAI SDK and a Bedrock model ID.
Setup
- In Settings → AI Providers → AWS Bedrock enter an access key ID, secret access key and the region where you have model access enabled.
- Give that IAM user
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamon the models you use, and enable those models in the Bedrock console for that region. - Send Bedrock model IDs through the gateway:
How model IDs are recognised
No prefix is needed. A model is sent to Bedrock when it has the Bedrock shape <vendor>.<model> with one of these vendors: anthropic, amazon, meta, mistral, cohere, ai21, deepseek, writer, luma, stability, openai, qwen. An optional inference-profile prefix (us., eu., apac., global., us-gov., jp., au., ca.) is allowed, and is ignored for pricing.
A Bedrock ID needs a Bedrock key
Bedrock-shaped IDs only route to Bedrock when a Bedrock key is connected. Without one, the ID falls through to the default (OpenAI) route, which rejects it as an unknown model; if no OpenAI key exists either, the error names Bedrock as the missing provider. Connect the Bedrock key first.
What works
| Feature | Notes |
|---|---|
| Chat, streaming | Converse and ConverseStream; OpenAI-format responses and SSE |
| Tool calling | OpenAI tools translated to Bedrock tool config; streamed tool calls supported |
| Token usage and cost | From Bedrock's own usage report |
| Responses API | Translated to chat like every provider |
Why route Bedrock through a gateway?
- Real-time limits. AWS Budgets and Cost Anomaly Detection report after the spend has happened. A budget here is checked before the call.
- Attribution below the account level. Bedrock's bill shows one line per model. Headers like
X-Cost-FeatureandX-Cost-Usersplit it by feature, team, user and your customers (Growth). - One client for everything. The same OpenAI client reaches Bedrock, Anthropic direct, OpenAI and Gemini, so moving a feature between them is a model-name change.
- Reconcile against the AWS bill. Shadow Spend Reconciliation (Growth plan) compares what passed through the gateway with what AWS actually billed.
Related articles
Supported Providers
OpenAI, Anthropic, Gemini, Mistral, Groq, Together, Azure, AWS Bedrock, Vertex AI, and custom OpenAI-compatible endpoints.
OpenAI
OpenAI SDK through the gateway: chat, Responses, embeddings, images, audio and batches with per-feature cost and budgets.
Anthropic (Claude)
Claude through the OpenAI SDK (translated) or the native Anthropic SDK (passthrough), with prompt-cache-aware cost.