Amazon Bedrock API keys

25 community-sourced Amazon Bedrock keys, re-checked against the API. Copy a key below, export it as AWS_BEARER_TOKEN_BEDROCK, and send requests to https://bedrock-runtime.us-east-1.amazonaws.com.

Keys

Using your Amazon Bedrock key

Export the key as AWS_BEARER_TOKEN_BEDROCK, then call the API at https://bedrock-runtime.us-east-1.amazonaws.com.

export AWS_BEARER_TOKEN_BEDROCK="your-key-here"

curl

curl https://bedrock-runtime.us-east-1.amazonaws.com/chat/completions \
  -H "Authorization: Bearer $AWS_BEARER_TOKEN_BEDROCK" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "us.anthropic.claude-sonnet-5-v1:0",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

Python (OpenAI SDK)

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["AWS_BEARER_TOKEN_BEDROCK"],
    base_url="https://bedrock-runtime.us-east-1.amazonaws.com",
)

resp = client.chat.completions.create(
    model="us.anthropic.claude-sonnet-5-v1:0",
    messages=[{"role": "user", "content": "Say hello"}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AWS_BEARER_TOKEN_BEDROCK,
  baseURL: "https://bedrock-runtime.us-east-1.amazonaws.com",
});

const resp = await client.chat.completions.create({
  model: "us.anthropic.claude-sonnet-5-v1:0",
  messages: [{ role: "user", content: "Say hello" }],
});
console.log(resp.choices[0].message.content);