This quick guide shows how to use the AWS Pricing API via the AWS CLI to retrieve Amazon Bedrock on‑demand inference prices for Anthropic models (e.g., Claude). It includes a ready-to-run example that filters by provider, region, feature, and extracts usable price fields with jq.
- https://aws.amazon.com/bedrock/pricing
- https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/using-price-list-query-api.html
- Use the AWS Pricing API (
aws pricing get-products) with--service-code "AmazonBedrock". - The Pricing API returns large JSON; use
jqto parse and extract model, usage type, and USD price per unit. - The Pricing API is commonly queried from
us-east-1(--region us-east-1) because pricing data is centrally available there. - Attribute names can vary slightly across accounts/regions (e.g.,
modelvsmodelName,inferenceTypecapitalization). If a query returns nothing, first inspect attributes to confirm names.
Copy/paste this one-liner. It filters for Anthropic + On‑demand Inference in the N. Virginia region and returns model, usageType, inferenceType, location, price per unit (USD) and unit:
aws pricing get-products \
--service-code "AmazonBedrock" \
--filters Type=TERM_MATCH,Field=provider,Value="Anthropic" \
Type=TERM_MATCH,Field=feature,Value="On-demand Inference" \
Type=TERM_MATCH,Field=location,Value="US East (N. Virginia)" \
--region us-east-1 \
--output json \
| jq -r '.PriceList[]
| fromjson
| .product.attributes as $a
| (.terms.OnDemand // {})
| to_entries[]?
| .value.priceDimensions
| to_entries[]?
| {model:$a.model, provider:$a.provider, usageType:$a.usagetype, inferenceType:$a.inferenceType, location:$a.location, price_per_unit:.value.pricePerUnit.USD, unit:.value.unit}'Example simplified one-liner (no line breaks):
aws pricing get-products --service-code "AmazonBedrock" --filters Type=TERM_MATCH,Field=provider,Value="Anthropic" Type=TERM_MATCH,Field=feature,Value="On-demand Inference" Type=TERM_MATCH,Field=location,Value="US East (N. Virginia)" --region us-east-1 --output json | jq -r '.PriceList[] | fromjson | .product.attributes as $a | (.terms.OnDemand // {}) | to_entries[]? | .value.priceDimensions | to_entries[]? | {model:$a.model,provider:$a.provider,usageType:$a.usagetype,inferenceType:$a.inferenceType,location:$a.location,price_per_unit:.value.pricePerUnit.USD,unit:.value.unit}'Explanation:
--service-code "AmazonBedrock": Restricts to Bedrock pricing.--filters Type=TERM_MATCH,Field=provider,Value="Anthropic": Only Anthropic models.--filters Type=TERM_MATCH,Field=location,Value="US East (N. Virginia)": Set region as needed.--filters Type=TERM_MATCH,Field=feature,Value="On-demand Inference": Only on-demand inference pricing.- Output is parsed with jq to show the model, usage type, inference type, and price.