LLM_PROVIDER="bedrock" and a few AWS environment variables — Cognee talks to Bedrock natively through its built-in Bedrock adapter.
Prerequisites
- AWS account with Bedrock model access enabled for the models you want to use
- Python 3.10+
- Cognee installed with the AWS extra (see below)
Setup (Native Provider)
1. Install Cognee with the AWS extra
2. Configure your .env
Set LLM_PROVIDER="bedrock" and provide your AWS details:
3. Choose an authentication method
The Bedrock adapter supports three ways to authenticate (it uses the first one it finds, in this order):- API key — generate a Bedrock API key on AWS and set it in
LLM_API_KEY. - AWS credentials — set
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY(you can leaveLLM_API_KEYunset). If you use temporary credentials (an access key ID starting withASIA...), you must also setAWS_SESSION_TOKEN. - AWS profile — set
AWS_PROFILE_NAMEto use a profile from your AWS credentials file (the standard boto3 credential chain).
AWS_REGION is applied with any of these methods, and AWS_BEDROCK_RUNTIME_ENDPOINT optionally overrides the Bedrock runtime endpoint.
Model naming
Use the Bedrock model ID directly inLLM_MODEL — no bedrock/ prefix is needed because the provider is already set to bedrock. Model IDs are region-scoped, so the prefix depends on your region (eu. for Europe, us. for the US, etc.):
- Amazon Nova:
eu.amazon.nova-lite-v1:0,us.amazon.nova-pro-v1:0 - Anthropic Claude:
anthropic.claude-3-5-sonnet-20240620-v1:0 - OpenAI GPT-OSS:
openai.gpt-oss-120b-1:0
The exact model ID (and whether it needs a region prefix) varies by AWS region. Check the AWS Bedrock model catalog for the ID that applies to your region.
Usage Example
Optional: Using a LiteLLM Proxy
A LiteLLM proxy is not required for Bedrock. Use this approach only if you already run a LiteLLM proxy to centralize model routing, credentials, or logging across multiple services. Install and configure the proxy:config.yaml:
http://localhost:4000 by default):
For detailed proxy setup, see the official LiteLLM Bedrock tutorial.
Troubleshooting
- Authentication Errors: Verify your AWS credentials, region, and that Bedrock model access is enabled in the AWS console. For temporary (
ASIA...) credentials, ensureAWS_SESSION_TOKENis set alongsideAWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY— a session token is not used on its own. - Model Not Found: Confirm the model ID matches your region exactly (including any
eu./us.prefix). - Rate Limit / Throttling Errors (
BedrockException): When Bedrock returns throttling errors (e.g.Too many requests,ThrottlingException), Cognee automatically retries them with exponential backoff (up to 5 retries). If errors persist, request a quota increase in the AWS console, or enable client-side rate limiting by settingLLM_RATE_LIMIT_ENABLED="true"and tuningLLM_RATE_LIMIT_REQUESTSto stay within your account’s requests-per-minute limit. See Rate Limiting for details. - Connection Issues (proxy only): Check that the LiteLLM proxy is running on the expected port.
LITELLM_LOG="DEBUG" in your .env.
Resources
LLM Providers
Cognee LLM ConfigurationFull reference for configuring AWS Bedrock and other LLM providers.
AWS Bedrock Models
Available ModelsBrowse all Bedrock models and find the model ID for your region.