Amazon Bedrock

Amazon Bedrock Integration

Drop-in wrapper for the AWS Bedrock client. Every InvokeModel and Converse API call is traced with token usage, cost, and latency — no proxy required.

Amazon Bedrock is a fully managed AWS service for accessing and deploying foundation models from AWS, Anthropic, Meta, Mistral, and other providers.

zespan.com — amazon bedrock trace
Zespan cost attribution showing Amazon Bedrock model costs by model and agent

Getting Started

1

Install the SDK

Install @zespan/sdk alongside the AWS SDK for Bedrock.

bash
npm install @zespan/sdk @aws-sdk/client-bedrock-runtime
2

Wrap the Bedrock client

Pass your BedrockRuntimeClient to wrapBedrock(). All calls (InvokeModel, Converse, ConverseStream) are traced automatically.

typescript
import { BedrockRuntimeClient } from '@aws-sdk/client-bedrock-runtime';
import { Zespan, wrapBedrock } from '@zespan/sdk';

const lt = new Zespan({ apiKey: process.env.ZESPAN_API_KEY });
const bedrock = wrapBedrock(
  new BedrockRuntimeClient({ region: 'us-east-1' }),
  lt
);

// All Bedrock calls now traced
const response = await bedrock.send(new ConverseCommand({
  modelId: 'anthropic.claude-3-5-sonnet-20241022-v2:0',
  messages: [{ role: 'user', content: [{ text: 'Hello' }] }],
}));
3

View traces in Zespan

Open Trace Explorer. Bedrock calls appear with modelId, token usage, cost, and latency. Cost Attribution breaks down spend by Bedrock model.

What's captured automatically

  • All Bedrock models: Claude, Titan, Llama 3, Mistral, Jamba, and more
  • InvokeModel and Converse API: both APIs supported including streaming
  • Per-model cost: USD cost tracked per modelId and attributed by agent and user
  • No proxy required: direct SDK instrumentation — no gateway in your request path
  • Multi-model comparison: compare Claude vs Llama via Bedrock in Cost Attribution

FAQ

Do I need to configure AWS credentials separately?

No. wrapBedrock() wraps your existing BedrockRuntimeClient — it inherits whatever credentials you've already configured (environment variables, IAM role, etc.).

Does this support Bedrock Guardrails?

Zespan guardrails run at the Zespan SDK level and work alongside AWS Bedrock Guardrails. Both can be active simultaneously.

Start for free — 10K traces/month, no card needed

Amazon Bedrock integration works on all plans including the free tier.

← All integrations