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.

Metadata

Release files for model-info-amazon-bedrock 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for model-info-amazon-bedrock 0.0.1
File Size Uploaded
model_info_amazon_bedrock-0.0.1.tar.gz 58.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for model-info-amazon-bedrock 0.0.1
File Interpreter ABI Platform
model_info_amazon_bedrock-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 89.2 kB

Release files / model_info_amazon_bedrock-0.0.1.tar.gz

Download URL model_info_amazon_bedrock-0.0.1.tar.gz
Size 58.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2bbc78a296378e930878c590468e8a02e9531d42238760ba22bda1fbd5f0ae33
BLAKE2b-256 checksum
How to use checksums
0780d7e44b2db1e3aead484faa1c1d441a0908ca53184b969da3362380c95556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release files / model_info_amazon_bedrock-0.0.1-py3-none-any.whl

Download URL model_info_amazon_bedrock-0.0.1-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68cb47627f6819d4344790a99fb0aa342f9a7f05781c15ab575ab0020f36a8e8
BLAKE2b-256 checksum
How to use checksums
c361dd6b47ace09d14c2d03145490bcc98d46a81f07f144b1460d73125138664
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page