Skip to content

Conversation

@Ashutosh0x
Copy link

feat(bedrock): add support for AWS_BEARER_TOKEN_BEDROCK env var

Summary

This PR adds support for the AWS_BEARER_TOKEN_BEDROCK environment variable in the Bedrock client, enabling bearer token authentication as an alternative to SigV4.

Problem

Currently, the Bedrock client only supports SigV4 authentication. Some users need to use bearer token authentication for specific deployment scenarios.

Solution

  • Added get_bearer_token() function to _auth.py to retrieve the token from the environment
  • Updated _prepare_request in both sync and async Bedrock clients to prioritize bearer token if AWS_BEARER_TOKEN_BEDROCK is set, falling back to SigV4 otherwise

Usage

import os
os.environ["AWS_BEARER_TOKEN_BEDROCK"] = "your-bearer-token"

from anthropic import AnthropicBedrock

client = AnthropicBedrock()
# Client now uses bearer token auth instead of SigV4

Fixes #1079

Adds a get_bearer_token() utility and updates the Bedrock clients
to prioritize this token over SigV4 authentication if present.

Fixes anthropics#1079
@Ashutosh0x Ashutosh0x requested a review from a team as a code owner January 21, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnthropicBedrock: AWS_BEARER_TOKEN_BEDROCK env var not supported

1 participant