Skip to content

Support Amazon Bedrock API Keys #3283

Description

@gaiar

AWS recently launched API keys for Amazon Bedrock (announced July 8, 2025), offering a much simpler authentication method than the current IAM role setup.

We propose adding support for these API keys to streamline the initial configuration for claude-code users on AWS. This would significantly improve the developer experience by providing a straightforward alternative to manual IAM policy and principal configuration.

Suggested Implementation

Support could be implemented by having claude-code recognize and use a new environment variable containing the Bedrock API key. The AWS SDK for Python (Boto3) can automatically use the AWS_BEARER_TOKEN_BEDROCK environment variable to authenticate.

For example:

import boto3

# Boto3 client automatically uses the key set in the environment variable:
# export AWS_BEARER_TOKEN_BEDROCK=${your-bedrock-api-key}

client = boto3.client(
    service_name="bedrock-runtime",
    region_name="us-east-1"
)

response = client.converse(
    modelId="us.anthropic.claude-3-5-haiku-20241022-v1:0",
    messages=[{"role": "user", "content": [{"text": "Hello"}]}],
)

print(response['output']['message']['content'][0]['text'])

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions