Skip to main content

Model Info for Amazon Bedrock

Latest Version Supported Python Versions Code Style: Ruff

A lightweight Python helper to simplify retrieving metadata about AI models on Amazon Bedrock.

This early release is focussed on fetching pricing information in particular, although we hope to expand to other metadata in future and contributions are welcome!

⚠️ WARNING: This helper library is provided "as is", as described in the LICENSE.

  • The data aggregations it performs are non-trivial and may contain bugs.
  • No warranty is provided or liability accepted for the correctness of results.
  • Users should validate against authoritative sources like the Amazon Bedrock Pricing page and Amazon Bedrock model cards before using results for contractual, billing-critical, or other high-impact decisions.

Although the underlying AWS Price List API provides authoritative information, its listings for Amazon Bedrock are distributed across multiple service codes, and their attributes don't correspond directly to unique model or inference profile IDs used by Amazon Bedrock inference APIs. This library provides a simpler way to look up current pricing records by model ID.

Installation

Because this library uses the AWS Price List API, the environment where it runs needs AWS credentials configured with appropriate IAM permissions to list services and products.

Install on Python 3.11+ with your preferred package manager. For example, with uv:

uv add model-info-amazon-bedrock

Or with pip:

pip install model-info-amazon-bedrock

Usage

Many factors can affect the final price of a foundation model on Amazon Bedrock, including for example:

  • Which service tier you use for to balance between cost, speed, and predictability.
  • Which Region or inference scope you target, including global cross-region inference which can be cheaper.
  • Whether you use a longer-context variant of a model or the standard context length.
  • Private pricing agreements or any other account-specific arrangements that are not represented by public list prices.

It's important to consider these complexities for detailed assessments and high-impact decisions.

However, this library mainly helps retrieve indicative list pricing, including standard on-demand pricing, by foundation model or cross-Region inference profile ID:

from model_info_amazon_bedrock import BedrockModelInfoClient

client = BedrockModelInfoClient()

pricing = client.get_model_pricing(
    "global.anthropic.claude-sonnet-5",
    region="us-east-1",
)

# Standard on-demand token pricing, when available.
print(f"Input:  ${pricing.input_tokens:.2f} per million tokens")
print(f"Output: ${pricing.output_tokens:.2f} per million tokens")

Example output:

Input:  $2.00 per million tokens
Output: $10.00 per million tokens

You can inspect all pricing dimensions matched and classified for the model:

for dim in pricing.dimensions:
    print(
        f"{dim.direction.value} ({dim.tier.value}, {dim.scope.value}): "
        f"${dim.price:.4f} per {dim.unit.value}"
    )

Price Records

get_model_pricing returns a ModelPricing object. Each PriceDimension in ModelPricing.dimensions contains:

Field Description
direction Direction.INPUT or Direction.OUTPUT
modality Modality.TOKENS or Modality.IMAGE
cache CacheOperation.NONE, .READ, .WRITE, or .WRITE_1H
tier ServiceTier.STANDARD, .BATCH, .FLEX, .PRIORITY, or .LATENCY_OPTIMIZED
scope InferenceScope.REGIONAL, .CROSS_REGION_GLOBAL, or .CROSS_REGION_GEO
context ContextLength.STANDARD or .LONG
unit PricingUnit.MILLION_TOKENS, .IMAGE, .SECOND, .SEARCH_UNIT, or .UNKNOWN
price Normalized price for the classified unit, or the raw value for an unknown unit
rate_code AWS Price List API rate code for traceability
source_service AWS service code from which the dimension was resolved

The convenience properties input_tokens, output_tokens, input_images, and output_images return the standard tier pricing, or None when that value couldn't be identified. Use get_price or filter_dimensions when you need a specific tier, scope, cache operation, modality, or context length.

Matching and classification are heuristic. The returned dimensions reflect AWS Price List records the library recognized for the requested model/profile; they are not a guarantee that every AWS pricing dimension for every model is represented.

Caching

Pricing data is fetched lazily by source and cached per Region on each client instance:

client = BedrockModelInfoClient()

# First lookup fetches the required AWS pricing source data (so may take a few seconds)
pricing = client.get_model_pricing("anthropic.claude-sonnet-4-20250514-v1:0")

# Later lookups in the same Region reuse cached source data when possible (faster)
pricing = client.get_model_pricing("meta.llama3-70b-instruct-v1:0")

# Force fresh source data for this lookup.
pricing = client.get_model_pricing(
    "anthropic.claude-sonnet-4-20250514-v1:0",
    refresh=True,
)

# Clear cached pricing data for a Region.
client.invalidate_pricing_cache("us-east-1")

A failed refresh raises the underlying error and preserves existing cached data.

Custom boto3 Session

import boto3

from model_info_amazon_bedrock import BedrockModelInfoClient

session = boto3.Session(
    profile_name="my-profile",
    region_name="us-west-2",
)
client = BedrockModelInfoClient(session=session)

Error Handling

from model_info_amazon_bedrock import (
    BedrockModelInfoClient,
    PricingNotFoundError,
)

client = BedrockModelInfoClient()

try:
    pricing = client.get_model_pricing("nonexistent.model-id")
except PricingNotFoundError as exc:
    print(f"No pricing for {exc.model_id} in {exc.region}")
except ValueError as exc:
    print(f"Invalid input: {exc}")

AWS credential, service, throttling, and network exceptions from boto3/botocore propagate to the caller.

Development

See CONTRIBUTING.md for guidance including how best to engage with our community, setting up your local development environment for the project, tips on testing & debugging, and architectural guidance.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

model_info_amazon_bedrock-0.0.1.tar.gz (58.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

model_info_amazon_bedrock-0.0.1-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file model_info_amazon_bedrock-0.0.1.tar.gz.

File metadata

File hashes

Hashes for model_info_amazon_bedrock-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2bbc78a296378e930878c590468e8a02e9531d42238760ba22bda1fbd5f0ae33
MD5 72955ae595013bf1344779c50c2ec513
BLAKE2b-256 0780d7e44b2db1e3aead484faa1c1d441a0908ca53184b969da3362380c95556

See more details on using hashes here.

Provenance

The following attestation bundles were made for model_info_amazon_bedrock-0.0.1.tar.gz:

Publisher: pypi.yaml on awslabs/model-info-amazon-bedrock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file model_info_amazon_bedrock-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for model_info_amazon_bedrock-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68cb47627f6819d4344790a99fb0aa342f9a7f05781c15ab575ab0020f36a8e8
MD5 40138894852d90f5974fb49b31f66496
BLAKE2b-256 c361dd6b47ace09d14c2d03145490bcc98d46a81f07f144b1460d73125138664

See more details on using hashes here.

Provenance

The following attestation bundles were made for model_info_amazon_bedrock-0.0.1-py3-none-any.whl:

Publisher: pypi.yaml on awslabs/model-info-amazon-bedrock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page