Model Info for Amazon Bedrock
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file model_info_amazon_bedrock-0.0.1.tar.gz.
File metadata
- Download URL: model_info_amazon_bedrock-0.0.1.tar.gz
- Upload date:
- Size: 58.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bbc78a296378e930878c590468e8a02e9531d42238760ba22bda1fbd5f0ae33
|
|
| MD5 |
72955ae595013bf1344779c50c2ec513
|
|
| BLAKE2b-256 |
0780d7e44b2db1e3aead484faa1c1d441a0908ca53184b969da3362380c95556
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
model_info_amazon_bedrock-0.0.1.tar.gz -
Subject digest:
2bbc78a296378e930878c590468e8a02e9531d42238760ba22bda1fbd5f0ae33 - Sigstore transparency entry: 2598067651
- Sigstore integration time:
-
Permalink:
awslabs/model-info-amazon-bedrock@1831be873505f6beeed6b72cc08b601f838e1939 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/awslabs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@1831be873505f6beeed6b72cc08b601f838e1939 -
Trigger Event:
push
-
Statement type:
File details
Details for the file model_info_amazon_bedrock-0.0.1-py3-none-any.whl.
File metadata
- Download URL: model_info_amazon_bedrock-0.0.1-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68cb47627f6819d4344790a99fb0aa342f9a7f05781c15ab575ab0020f36a8e8
|
|
| MD5 |
40138894852d90f5974fb49b31f66496
|
|
| BLAKE2b-256 |
c361dd6b47ace09d14c2d03145490bcc98d46a81f07f144b1460d73125138664
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
model_info_amazon_bedrock-0.0.1-py3-none-any.whl -
Subject digest:
68cb47627f6819d4344790a99fb0aa342f9a7f05781c15ab575ab0020f36a8e8 - Sigstore transparency entry: 2598067752
- Sigstore integration time:
-
Permalink:
awslabs/model-info-amazon-bedrock@1831be873505f6beeed6b72cc08b601f838e1939 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/awslabs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@1831be873505f6beeed6b72cc08b601f838e1939 -
Trigger Event:
push
-
Statement type: