Access AWS Bedrock's unified API for multiple AI model families including Anthropic Claude, Cohere Command R, OpenAI OSS, and Meta Llama.
AWS Bedrock supports two authentication methods: API Keys (introduced July 2025) for simplified development, and traditional IAM credentials with AWS Signature V4.
Generate short-term (up to 12 hours) or long-term API keys from the Bedrock console.
Environment Variable:
AWS_BEARER_TOKEN_BEDROCK=your-api-key
AWS_REGION=us-east-1For the full model-spec workflow, see Model Specs.
Use exact Bedrock IDs from LLMDB.xyz when possible. For inference profiles, custom deployments, or new Bedrock model IDs, use a full explicit model spec when the registry has not caught up yet.
Provider Options:
ReqLLM.generate_text(
"bedrock:anthropic.claude-3-sonnet-20240229-v1:0",
"Hello",
provider_options: [api_key: "your-api-key", region: "us-east-1"]
)Limitations: Cannot be used with InvokeModelWithBidirectionalStream, Agents, or Data Automation operations.
Recommendation: Use short-term keys for production, long-term keys for exploration only.
Traditional AWS authentication using IAM access keys with Signature V4.
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=us-east-1ReqLLM.put_key(:aws_bedrock, %{
access_key_id: "AKIA...",
secret_access_key: "...",
region: "us-east-1"
})ReqLLM.generate_text(
"bedrock:anthropic.claude-3-sonnet-20240229-v1:0",
"Hello",
provider_options: [
region: "us-east-1",
access_key_id: "AKIA...",
secret_access_key: "..."
]
)Session tokens from AWS Security Token Service (STS) for temporary access:
provider_options: [
access_key_id: "ASIA...",
secret_access_key: "...",
session_token: "FwoGZXIv...", # From STS AssumeRole
region: "us-east-1"
]Passed via :provider_options keyword:
- Type: String
- Purpose: Bedrock API key for simplified authentication
- Fallback:
AWS_BEARER_TOKEN_BEDROCKenv var - Example:
provider_options: [api_key: "your-api-key"] - Note: Alternative to IAM credentials (access_key_id/secret_access_key)
- Type: String
- Default:
"us-east-1" - Purpose: AWS region where Bedrock is available
- Example:
provider_options: [region: "us-west-2"]
- Type: String
- Purpose: AWS Access Key ID
- Fallback:
AWS_ACCESS_KEY_IDenv var - Example:
provider_options: [access_key_id: "AKIA..."]
- Type: String
- Purpose: AWS Secret Access Key
- Fallback:
AWS_SECRET_ACCESS_KEYenv var - Example:
provider_options: [secret_access_key: "..."]
- Type: String
- Purpose: AWS Session Token for temporary credentials
- Example:
provider_options: [session_token: "..."]
- Type: Boolean
- Purpose: Force use of Bedrock Converse API
- Default: Auto-detect based on tools presence
- Example:
provider_options: [use_converse: true]
- Type: Map
- Purpose: Additional model-specific request fields
- Example:
provider_options: [additional_model_request_fields: %{thinking: %{type: "enabled", budget_tokens: 4096}}] - Use Case: Claude extended thinking configuration
- Type: Boolean
- Purpose: Enable Anthropic prompt caching for Claude models
- Example:
provider_options: [anthropic_prompt_cache: true]
- Type: String (e.g.,
"1h") - Purpose: Cache TTL (default ~5min if omitted)
- Example:
provider_options: [anthropic_prompt_cache_ttl: "1h"]
- All capabilities: Tool calling, streaming with tools, attachments, reasoning, prompt caching
- Inference profiles: Supports region-specific routing (
global.,us.,eu.) - Models: Claude 3.x, 4.x (Sonnet, Opus, Haiku)
- Example:
bedrock:global.anthropic.claude-sonnet-4-5-20250929-v1:0
- Tool calling: Full support including streaming with tools
- RAG-optimized: Excellent for production RAG workloads with citations
- Works with Converse API directly without custom formatter
- Example:
bedrock:cohere.command-r-plus-v1:0
- Smart routing: Native
/invokefor simple requests,/conversewhen tools present - Tool calling: Full support in non-streaming mode
- Models: gpt-oss-20b, gpt-oss-120b
- Example:
bedrock:openai.gpt-oss-120b-1:0
- Inference profiles only: us.meta.llama3-2-3b-instruct-v1:0
- No tool calling: Basic text generation only
- Example:
bedrock:us.meta.llama3-2-3b-instruct-v1:0
- Streaming: AWS Event Stream format (binary framed, not SSE)
- Auth: AWS Signature V4 with 5-minute signature expiry
- Endpoints: Model-specific paths (
/model/{model_id}/invokeor/converse) - API Routing: Auto-detects between native and Converse API based on tools
All differences handled automatically by ReqLLM.
AWS Signature V4 has a hardcoded 5-minute expiry that cannot be extended:
- AWS validates signatures when responding, not when receiving requests
- Requests taking >5 minutes fail with HTTP 403 "Signature expired"
- Real-world impact: Slow models with large outputs can timeout
- Example: Claude Opus 4.1 with extended thinking + high token limits
- Recording
token_limit.jsonfixture took >6 minutes → 403 error
Workaround: Use faster model variants or lower token limits for time-critical applications.