Expand description
§bedrock-cost
Calculate AWS Bedrock invocation cost across the non-Anthropic vendors
that Bedrock hosts: Meta Llama, Mistral, Cohere, Amazon Titan, and AI21
Jurassic. For Anthropic Claude models on Bedrock, use the companion
claude-cost crate, which
handles the cache_creation / cache_read fields Claude exposes.
Bedrock IDs are normalized so cross-region inference profile prefixes
(us., eu., apac.) and ARN paths resolve to the same base model.
§Quick example
use bedrock_cost::{Usage, default_pricing};
let pricing = default_pricing("meta.llama3-70b-instruct-v1:0").unwrap();
let usage = Usage { input_tokens: 1_000_000, output_tokens: 500_000 };
let cost = pricing.cost_for(&usage);
assert!(cost > 0.0);§Cross-region inference profile
use bedrock_cost::default_pricing;
assert_eq!(
default_pricing("us.meta.llama3-70b-instruct-v1:0"),
default_pricing("meta.llama3-70b-instruct-v1:0")
);Pricing is best-effort and dated; verify against https://aws.amazon.com/bedrock/pricing/ before using these numbers for billing.
Structs§
- Pricing
- Per-model rates, USD per 1M tokens.
- Usage
- Token usage as returned by Bedrock Converse (
inputTokens/outputTokens).
Constants§
- DEFAULT_
PRICING_ TABLE - Built-in pricing table. Source: aws.amazon.com/bedrock/pricing as of 2026-Q2 for the us-east-1 region. VERIFY before billing — Bedrock pricing varies by region.
Functions§
- default_
pricing - Look up the price table entry for a Bedrock model id.
- normalize_
model_ id - Strip ARN, inference-profile, and version suffixes from a Bedrock model id.