Bastio
Providers

AWS Bedrock Integration

Complete guide to using AWS Bedrock with Bastio for Claude and other foundation models.

AWS Bedrock Integration

Use Claude and other foundation models through AWS Bedrock while maintaining Bastio's security protection.

Overview

AWS Bedrock provides access to Claude and other foundation models through Amazon's managed infrastructure. Bastio offers full support for AWS Bedrock, allowing you to:

  • Use existing AWS infrastructure - Leverage your AWS account and billing
  • Maintain compliance - Keep data within your AWS environment
  • Access multiple models - Claude, Titan, Jurassic, and more
  • Full security coverage - All Bastio security features work with Bedrock
  • 100% feature parity - Identical to direct Anthropic integration

Supported Models

Bastio supports all Claude models available on AWS Bedrock:

ModelBedrock IDContextInput/Output Price
Claude 3.5 Sonnet (Latest)anthropic.claude-3-5-sonnet-20241022-v2:0200K$3/$15 per 1M tokens
Claude 3.5 Sonnetanthropic.claude-3-5-sonnet-20240620-v1:0200K$3/$15 per 1M tokens
Claude 3 Opusanthropic.claude-3-opus-20240229-v1:0200K$15/$75 per 1M tokens
Claude 3 Sonnetanthropic.claude-3-sonnet-20240229-v1:0200K$3/$15 per 1M tokens
Claude 3 Haikuanthropic.claude-3-haiku-20240307-v1:0200K$0.25/$1.25 per 1M tokens
Claude 2.1anthropic.claude-v2:1200K$8/$24 per 1M tokens
Claude Instantanthropic.claude-instant-v1100K$0.80/$2.40 per 1M tokens

You can use either standard model names (e.g., claude-3-5-sonnet-20241022) or Bedrock model IDs - Bastio automatically maps between them.

Quick Start

Prerequisites

  1. AWS account with Bedrock access
  2. Claude model access enabled in AWS Console
  3. IAM credentials with Bedrock permissions

Step 1: Enable Bedrock in AWS

  1. Go to AWS Console → Bedrock
  2. Navigate to Model access
  3. Request access to Anthropic Claude models
  4. Wait for approval (usually instant)

Step 2: Create IAM Credentials

Create an IAM user or role with these permissions:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": [
      "bedrock:InvokeModel",
      "bedrock:InvokeModelWithResponseStream"
    ],
    "Resource": "arn:aws:bedrock:*::foundation-model/anthropic.claude-*"
  }]
}

Save your credentials:

  • Access Key ID: AKIA...
  • Secret Access Key: wJalrXUtn...
  • Region: us-east-1 (or your preferred region)

BYOK Mode (Bring Your Own Key)

Use your own AWS credentials with Bastio.

Via Dashboard

  1. Go to Dashboard → Proxies → Create New Proxy
  2. Select AWS Bedrock as provider
  3. Enter your AWS credentials as JSON:
{
  "access_key_id": "AKIA...",
  "secret_access_key": "wJalrXUtn...",
  "region": "us-east-1"
}
  1. Click Create Proxy

Via API

# Create Bedrock proxy
curl -X POST https://api.bastio.ai/proxy \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Bedrock",
    "provider": "bedrock",
    "llm_mode": "byok",
    "model_behavior": "passthrough"
  }'

# Add AWS credentials
curl -X POST https://api.bastio.ai/keys/provider \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "bedrock",
    "key_name": "AWS Production",
    "api_key": "{\"access_key_id\":\"AKIA...\",\"secret_access_key\":\"wJalrXUtn...\",\"region\":\"us-east-1\"}"
  }'

Platform Mode

Let Bastio manage AWS credentials for you.

How It Works

  • Bastio provides pre-configured AWS credentials
  • Pay with Bastio credits
  • No AWS account needed
  • Simplified billing

Enable Platform Mode

  1. Create proxy with LLM Mode: Platform
  2. Select AWS Bedrock as provider
  3. Choose your model
  4. Purchase credits in Billing section

Making Requests

Python Example

from openai import OpenAI

client = OpenAI(
    base_url="https://api.bastio.ai/v1/guard/{PROXY_ID}/v1",
    api_key="your-bastio-api-key"
)

# Use standard model name
response = client.chat.completions.create(
    model="claude-3-5-sonnet-20241022",
    messages=[
        {"role": "user", "content": "Explain AWS Bedrock benefits"}
    ]
)

print(response.choices[0].message.content)

JavaScript Example

import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.bastio.ai/v1/guard/{PROXY_ID}/v1',
  apiKey: process.env.BASTIO_API_KEY,
});

const response = await client.chat.completions.create({
  model: 'claude-3-5-sonnet-20241022',
  messages: [
    { role: 'user', content: 'Hello from Bedrock!' }
  ],
});

console.log(response.choices[0].message.content);

Streaming Example

# Python streaming
stream = client.chat.completions.create(
    model="claude-3-haiku-20240307",
    messages=[{"role": "user", "content": "Write a short story"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Using Bedrock Model IDs

You can also use Bedrock's native model IDs:

response = client.chat.completions.create(
    model="anthropic.claude-3-5-sonnet-20241022-v2:0",  # Bedrock ID
    messages=[{"role": "user", "content": "Hello!"}]
)

Both formats work identically - Bastio automatically handles the mapping.

Model Validation

Bastio validates models for you:

# Both of these work:
curl -X POST https://api.bastio.ai/v1/guard/{PROXY_ID}/v1/chat/completions \
  -d '{"model": "claude-3-haiku-20240307", ...}'

curl -X POST https://api.bastio.ai/v1/guard/{PROXY_ID}/v1/chat/completions \
  -d '{"model": "anthropic.claude-3-haiku-20240307-v1:0", ...}'

AWS Credential Format

Required Fields

{
  "access_key_id": "AKIA...",
  "secret_access_key": "wJalrXUtn...",
  "region": "us-east-1"
}

With Temporary Credentials

For STS temporary credentials, add session token:

{
  "access_key_id": "ASIA...",
  "secret_access_key": "wJalrXUtn...",
  "region": "us-west-2",
  "session_token": "FwoGZXIvYX..."
}

Supported Regions

  • us-east-1 (N. Virginia) ✅ Recommended
  • us-west-2 (Oregon)
  • eu-west-1 (Ireland)
  • eu-central-1 (Frankfurt)
  • ap-southeast-1 (Singapore)
  • ap-northeast-1 (Tokyo)

Pricing & Cost Tracking

Bedrock vs Direct Anthropic

Most models have identical pricing:

ModelDirectBedrock
Claude 3.5 Sonnet$3/$15$3/$15
Claude 3 Opus$15/$75$15/$75
Claude 3 Haiku$0.25/$1.25$0.25/$1.25

Cost Tracking

Bastio automatically tracks costs:

  • Dashboard - Real-time spending
  • Analytics - Historical cost analysis
  • Billing - Detailed breakdowns

Troubleshooting

Invalid AWS Credentials

Error: Invalid AWS credentials or Access denied

Solutions:

  • Verify JSON format is correct (no trailing commas)
  • Check credentials haven't expired
  • Test with AWS CLI: aws bedrock list-foundation-models --region us-east-1

Model Access Denied

Error: Model access denied or AccessDeniedException

Solutions:

  • Go to AWS Console → Bedrock → Model access
  • Enable Anthropic Claude models
  • Wait for approval (usually instant)

Region Not Supported

Error: Region not supported or EndpointUnavailable

Solutions:

Throttling Exception

Error: ThrottlingException or Rate exceeded

Solutions:

  • Check AWS Service Quotas dashboard
  • Request quota increase for Bedrock
  • Implement rate limiting in your app

Frequently Asked Questions

Q: Can I use both Bedrock and direct Anthropic? A: Yes! Create separate proxies for each and route requests as needed.

Q: Does streaming work? A: Yes, streaming is fully supported with identical functionality.

Q: Are there feature limitations? A: No, Bedrock has 100% feature parity with direct Anthropic.

Q: How do I switch from Anthropic to Bedrock? A: Create a new Bedrock proxy, update your proxy ID in your app, and test in staging before switching production.

Q: Can I use temporary AWS credentials? A: Yes, include the session_token field in your credentials JSON.

Q: What if my credentials expire? A: Requests will fail with authentication errors. Update credentials in the Bastio dashboard.

When to Use Bedrock

Choose Bedrock if you:

  • Already have AWS infrastructure
  • Need AWS compliance/certifications
  • Want consolidated AWS billing
  • Require private VPC endpoints
  • Have AWS enterprise agreements

Choose Direct Anthropic if you:

  • Want simplest setup
  • Don't have AWS account
  • Prefer direct vendor relationship
  • Need latest models immediately

Additional Resources


Need help? Contact support@bastio.ai or visit our support page.