Try Bifrost Enterprise free for 14 days.
Request access

[ Provider Guide ]

AWS Bedrock Provider on Bifrost

Bifrost routes AWS Bedrock models with comprehensive OpenAI-compatible support. The integration handles Claude, Nova, Mistral, Llama, Cohere, and Titan models with automatic parameter conversion and flexible authentication.

Bedrock provider summary

Bifrost routes AWS Bedrock models with full OpenAI compatibility. Support includes multiple model families (Anthropic Claude, Meta Llama, Mistral, Cohere, Amazon Titan) with extensive parameter conversion and flexible authentication.

Supported model families:

  • Anthropic Claude - Claude 3.5 Sonnet, Opus, Haiku
  • Meta Llama - Llama 3.1, 3, 2
  • Mistral - Mistral Large, 7B
  • Cohere - Command R+, Command R
  • Amazon Titan - Embeddings, Text, Image
PropertyDetails
DescriptionAWS Bedrock fully managed service for accessing foundation models.
Provider route on Bifrostbedrock/<model>
Provider docAWS Bedrock
AWS RegionConfigurable per API key
Supported endpoints/v1/chat/completions, /v1/responses, /v1/embeddings, /v1/images/*, /v1/batches, /v1/files

Supported operations

Bedrock supports comprehensive operations across chat, embeddings, and image generation. Text completion streaming not supported by upstream Bedrock API.

OperationNon-streamingStreamingUpstream endpoint
Chat CompletionsYesYes/v1/chat/completions
Responses APIYesYes/v1/responses
Text CompletionsYes (Claude/Mistral)No/v1/completions
EmbeddingsYes (Titan, Cohere)No/v1/embeddings
Image GenerationYesNo/v1/images/generations
Image EditYesNo/v1/images/edits
Image VariationYesNo/v1/images/variations
BatchYesNo/v1/batches
FilesYes (S3-backed)No/v1/files

Supported OpenAI parameters

Quick reference of OpenAI parameters accepted when routing through Bedrock via Bifrost.

[
  "stream",
  "temperature",
  "top_p",
  "top_k",
  "max_tokens",
  "max_completion_tokens",
  "stop",
  "response_format",
  "tools",
  "tool_choice",
  "user",
  "reasoning"
]

Supported Bedrock models

Use the provider prefix bedrock/ in Bifrost model routes for deterministic provider targeting.

FamilyModel IDBifrost routeTypical usage
Claude 3.5 Sonnetanthropic.claude-3-5-sonnet-20241022-v2:0bedrock/claude-3-5-sonnetLatest Claude
Claude 3 Opusanthropic.claude-3-opus-20240229-v1:0bedrock/claude-3-opusHigh capability
Claude 3 Haikuanthropic.claude-3-haiku-20240307-v1:0bedrock/claude-3-haikuFast, low-cost
Llama 3.1 70Bmeta.llama3-1-70b-instruct-v1:0bedrock/llama-3-1-70bMeta model
Mistral Largemistral.mistral-large-2402-v1:0bedrock/mistral-largeMistral model
Titan Embeddingsamazon.titan-embed-text-v2:0bedrock/titan-embed-textEmbeddings

Setup & configuration

Bedrock supports SigV4 signing and direct API-key (Bearer) authentication. Choose the flow that matches your deployment. Bifrost signs every Bedrock request with AWS Signature Version 4; STS AssumeRole can layer on top of explicit or inherited credentials. See Setup & configuration in Bifrost docs.

Aliases vs deployments

The top-level aliases field (mapping model names to inference profile IDs, ARNs, or deployment identifiers) requires v1.5.0-prerelease2 or later. On v1.4.x, use deployments inside bedrock_key_config instead.

1. Explicit credentials

Provide access_key and secret_key in bedrock_key_config. Optionally set session_token for temporary credentials.

Web UI

  1. Go to Model ProvidersConfigurationsAWS Bedrock
  2. Click Add Key (or edit an existing key)
  3. Under Authentication Method, select Explicit Credentials
  4. Set Access Key, Secret Key, optional Session Token, and Region (e.g. us-east-1)
  5. Configure Aliases to map model names to inference profile IDs
  6. Save

Gateway API

# Step 1: Create the provider
curl -X POST http://localhost:8080/api/providers \
  -H "Content-Type: application/json" \
  -d '{"provider": "bedrock"}'

# Step 2: Create a key (explicit credentials)
curl -X POST http://localhost:8080/api/providers/bedrock/keys \
  -H "Content-Type: application/json" \
  -d '{
    "name": "bedrock-key",
    "models": ["*"],
    "weight": 1.0,
    "aliases": {
      "claude-3-5-sonnet": "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
    },
    "bedrock_key_config": {
      "access_key": "env.AWS_ACCESS_KEY_ID",
      "secret_key": "env.AWS_SECRET_ACCESS_KEY",
      "session_token": "env.AWS_SESSION_TOKEN",
      "region": "us-east-1"
    }
  }'

config.json

{
  "providers": {
    "bedrock": {
      "keys": [
        {
          "name": "bedrock-key",
          "models": ["*"],
          "weight": 1.0,
          "aliases": {
            "claude-3-5-sonnet": "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
          },
          "bedrock_key_config": {
            "access_key": "env.AWS_ACCESS_KEY_ID",
            "secret_key": "env.AWS_SECRET_ACCESS_KEY",
            "session_token": "env.AWS_SESSION_TOKEN",
            "region": "us-east-1"
          }
        }
      ]
    }
  }
}

2. Inherited AWS credentials / IAM role

When static credentials are omitted, Bifrost uses the AWS default credential chain: IAM roles (IRSA on EKS, ECS task role, EC2 instance profile), environment variables, and shared credential files.

Web UI

  1. Go to Model ProvidersConfigurationsAWS Bedrock
  2. Click Add Key
  3. Select IAM Role (Inherited)
  4. Set Region and optional Aliases
  5. Optional: Assume Role ARN, External ID, Session Name (default bifrost-session)
  6. Save — for system identity, leave Assume Role fields blank and attach a Bedrock-capable IAM role to the workload

Gateway API — system identity

curl -X POST http://localhost:8080/api/providers/bedrock/keys \
  -H "Content-Type: application/json" \
  -d '{
    "name": "bedrock-iam",
    "models": ["*"],
    "weight": 1.0,
    "aliases": {
      "claude-3-5-sonnet": "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
    },
    "bedrock_key_config": {
      "region": "us-east-1"
    }
  }'

Gateway API — STS AssumeRole

curl -X POST http://localhost:8080/api/providers/bedrock/keys \
  -H "Content-Type: application/json" \
  -d '{
    "name": "bedrock-assume-role",
    "models": ["*"],
    "weight": 1.0,
    "bedrock_key_config": {
      "region": "us-east-1",
      "role_arn": "env.AWS_ROLE_ARN",
      "external_id": "env.AWS_EXTERNAL_ID",
      "session_name": "bifrost-session"
    }
  }'

3. API key

Set the key-level value to a Bearer token for direct API key auth. This path does not use SigV4 or STS AssumeRole.

Web UI

  1. Go to Model ProvidersConfigurationsAWS Bedrock
  2. Click Add Key
  3. Select API Key
  4. Set API Key (Bearer token) and Region
  5. Configure Aliases if needed, then save
curl -X POST http://localhost:8080/api/providers/bedrock/keys \
  -H "Content-Type: application/json" \
  -d '{
    "name": "bedrock-api-key",
    "value": "env.BEDROCK_API_KEY",
    "models": ["*"],
    "weight": 1.0,
    "bedrock_key_config": {
      "region": "us-east-1"
    }
  }'

bedrock_key_config fields

FieldRequiredDefaultDescription
regionYes-AWS region (e.g., us-east-1)
access_keyNo-AWS access key ID
secret_keyNo-AWS secret access key
session_tokenNo-Session token for temporary credentials
arnNo-ARN prefix for inference profile URLs (not the full model ARN)
role_arnNo-IAM role ARN for STS AssumeRole
external_idNo-External ID when required by trust policy
session_nameNobifrost-sessionAssumeRole session name for CloudTrail

Key-level fields

FieldRequiredDescription
aliasesNoMap model names to inference profile IDs or Bedrock model IDs (v1.5.0-prerelease2+)
modelsYesModels this key serves; use ["*"] for all

For application or cross-region inference profiles, put the ARN prefix in bedrock_key_config.arn and only the resource ID or model identifier in aliases — not the full ARN. See Inference profiles & ARN configuration.

API reference

OpenAI-compatible gateway endpoints routed to AWS Bedrock (Converse, Invoke, and control-plane APIs). Content aligned with Bifrost Bedrock provider docs.

1) Chat Completions

Primary path for Claude, Nova, Mistral, Llama, Cohere, and Titan chat models. Bifrost maps OpenAI parameters to Bedrock converse. Upstream: Converse API. Images must be base64 or data URI (remote URLs are not supported).

ParameterBedrock handlingNotes
max_completion_tokens→ inferenceConfig.maxTokensRequired in Bedrock converse
temperature, top_pDirect pass-throughinferenceConfig
stop→ inferenceConfig.stopSequencesArray of strings
response_format→ Structured output toolCreates bf_so_* tool
tools / tool_choiceBedrock ToolConfigSchema restructured
reasoningModel-specific thinking configClaude vs Nova mapping
user→ metadata.userIDWhen provided
top_kVia extra_paramsModel-specific sampling

Silently dropped: frequency_penalty, presence_penalty, logit_bias, logprobs, seed, parallel_tool_calls.

curl -X POST http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_completion_tokens": 1024,
    "temperature": 0.7
  }'

2) Responses API

Uses the same underlying converse endpoint with conversion between OpenAI Responses format and Bedrock messages. Gateway: POST /v1/responses.

ParameterTransformationNotes
max_output_tokens→ maxTokens via inferenceConfigRenamed for Bedrock
temperature, top_pDirect pass-through
instructionsBecomes system messageSame as chat extraction
tools / tool_choiceSame as Chat Completions
reasoningThinking/reasoning configModel-family specific
stopVia extra_paramsRenamed to stopSequences
  • String input wraps as a user message; arrays convert to messages
  • stopReason maps to response status (completed / incomplete)
  • Streaming: response.createdcontent_part.deltaoutput_item.done
curl -X POST http://localhost:8080/v1/responses \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
    "input": "Hello, how are you?",
    "instructions": "You are a helpful assistant",
    "max_output_tokens": 1024
  }'

3) Text Completions

Legacy completions via Bedrock invoke. Streaming is not supported. Only Claude (Anthropic) and Mistral models are supported.

  • Claude: prompt wrapped as \n\nHuman: {prompt}\n\nAssistant:; max_tokensmax_tokens_to_sample
  • Mistral: standard mapping; multiple outputs in choices[]
  • Response: choices[].text; stopReasonfinish_reason
curl -X POST http://localhost:8080/v1/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bedrock/anthropic.claude-3-haiku-20240307-v1:0",
    "prompt": "The capital of France is",
    "max_tokens": 64
  }'

4) Embeddings

Titan and Cohere embedding models via invoke. Gateway: POST /v1/embeddings. Non-streaming only.

ParameterHandlingNotes
inputDirect pass-throughText or array of texts
dimensionsNot supported (Titan)Fixed size per model
encoding_formatVia extra_paramsbase64 or float
curl -X POST http://localhost:8080/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bedrock/amazon.titan-embed-text-v2:0",
    "input": "Hello world"
  }'

5) Image Generation

Titan Image Generator v1/v2, Nova Canvas, and Stability AI models (flat JSON when model ID contains stability.). Upstream: invoke. Non-streaming.

ParameterBedrock fieldNotes
prompttextToImageParams.text
nimageGenerationConfig.numberOfImages
negative_prompttextToImageParams.negativeText
sizewidth & heightParsed from WxH
qualityimageGenerationConfig.qualitylow/medium → standard, high → premium
curl -X POST http://localhost:8080/v1/images/generations \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bedrock/amazon.nova-canvas-v1:0",
    "prompt": "A futuristic cityscape with a flying car",
    "size": "1024x1024",
    "n": 1
  }'

6) Image Edit

multipart/form-data (not JSON). Titan / Nova Canvas task types:

typeBedrock taskTypeNotes
inpaintingINPAINTINGprompt + image; optional mask
outpaintingOUTPAINTINGprompt + image; optional mask
background_removalBACKGROUND_REMOVALimage only

Stability AI edit models (model ID contains stability.) support inpaint, outpaint, remove-background, upscale, and more. See Image Edit.

curl -X POST http://localhost:8080/v1/images/edits \
  -F "model=bedrock/amazon.nova-canvas-v1:0" \
  -F "type=inpainting" \
  -F "image[]=@photo.png;type=image/png" \
  -F "mask=@mask.png;type=image/png" \
  -F "prompt=Replace the masked area with a garden"

7) Image Variation

multipart/form-data. Titan Image Generator and Nova Canvas models. Task type IMAGE_VARIATION. Optional similarityStrength (0.2–1.0) via extra params. Non-streaming.

curl -X POST http://localhost:8080/v1/images/variations \
  -F "model=bedrock/amazon.nova-canvas-v1:0" \
  -F "image[]=@source.png;type=image/png" \
  -F "n=2" \
  -F "size=1024x1024"

8) Files API

S3-backed file operations integrated with Bedrock. Upload uses multipart/form-data. File purpose is always batch; status is always processed.

  • POST /v1/files — multipart upload (file required, filename optional)
  • GET /v1/files — list (cursor pagination)
  • GET /v1/files/{file_id} — retrieve metadata
  • DELETE /v1/files/{file_id} — delete
  • GET /v1/files/{file_id}/content — download content
curl -X POST http://localhost:8080/v1/files \
  -F "file=@document.pdf" \
  -F "filename=report.pdf"

9) List Models

Lists foundation models via Bedrock control plane (listFoundationModels). No request body. Results respect region, aliases/deployments, and per-key models allowlists; multi-key configs aggregate results.

curl http://localhost:8080/v1/models
  • id — model name (with deployment prefix when configured)
  • display_namename
  • Pagination via NextPageToken

10) Error handling

Bedrock HTTP errors map to Bifrost error types. Special cases: context cancellation → RequestCancelled; timeouts → ErrProviderRequestTimedOut; streaming errors sent on the stream channel.

HTTP statusBifrost error typeNotes
400invalid_request_errorBad request parameters
401authentication_errorInvalid or expired credentials
403permission_denied_errorAccess denied to model or resource
404not_found_errorModel or resource not found
429rate_limit_errorRate limit exceeded
500api_errorServer error
529overloaded_errorService overloaded

Implementation caveats

CaveatImpactSeverity
Image format limitationOnly base64/data URI supported; remote URLs not acceptedHigh
Reasoning budget minimumClaude reasoning requires minimum 1024-token budgetHigh
Text completion streamingNot supported by upstream Bedrock APIMedium
System message extractionSystem messages removed from array, placed in separate fieldHigh
Tool message groupingConsecutive tool messages merged into single user messageMedium
Model-specific parametersAliases required v1.5.0+; earlier versions use deployments configMedium

Authoritative references

[ BIFROST FEATURES ]

Open Source & Enterprise

Everything you need to run AI in production, from free open source to enterprise-grade features.

01 Governance

SAML support for SSO and Role-based access control and policy enforcement for team collaboration.

02 Adaptive Load Balancing

Automatically optimizes traffic distribution across provider keys and models based on real-time performance metrics.

03 Cluster Mode

High availability deployment with automatic failover and load balancing. Peer-to-peer clustering where every instance is equal.

04 Alerts

Real-time notifications for budget limits, failures, and performance issues on Email, Slack, PagerDuty, Teams, Webhook and more.

05 Log Exports

Export and analyze request logs, traces, and telemetry data from Bifrost with enterprise-grade data export capabilities for compliance, monitoring, and analytics.

06 Audit Logs

Comprehensive logging and audit trails for compliance and debugging.

07 Vault Support

Secure API key management with HashiCorp Vault, AWS Secrets Manager, Google Secret Manager, and Azure Key Vault integration.

08 VPC Deployment

Deploy Bifrost within your private cloud infrastructure with VPC isolation, custom networking, and enhanced security controls.

09 Guardrails

Automatically detect and block unsafe model outputs with real-time policy enforcement and content moderation across all agents.

[ SHIP RELIABLE AI ]

Try Bifrost Enterprise with a 14-day Free Trial

[quick setup]

Drop-in replacement for any AI SDK

Change just one line of code. Works with OpenAI, Anthropic, Vercel AI SDK, LangChain, and more.

1import os
2from anthropic import Anthropic
3
4anthropic = Anthropic(
5 api_key=os.environ.get("ANTHROPIC_API_KEY"),
6 base_url="https://<bifrost_url>/anthropic",
7)
8
9message = anthropic.messages.create(
10 model="claude-3-5-sonnet-20241022",
11 max_tokens=1024,
12 messages=[
13 {"role": "user", "content": "Hello, Claude"}
14 ]
15)
Drop in once, run everywhere.