Fetch, normalise, snapshot, and diff official LLM API token pricing.
Project description
llm-price-tracker
llm-price-tracker fetches official published API token prices for major LLM
providers, normalises them into one schema, and supports JSON snapshots and
snapshot diffs.
Prices are collected from official provider pages only. Provider page structures can change without notice, so review fetched prices before using them for production billing or customer-facing estimates.
Supported providers
- OpenAI GPT API models: https://developers.openai.com/api/docs/pricing
- Anthropic Claude models: https://docs.anthropic.com/en/docs/about-claude/pricing
- Google Gemini models: https://ai.google.dev/gemini-api/docs/pricing
- Kimi / Moonshot AI models: https://platform.kimi.ai/docs/pricing/chat
- MiniMax models: https://platform.minimax.io/docs/guides/pricing-paygo
- Qwen / DashScope models: https://www.alibabacloud.com/help/en/model-studio/models
Installation
pip install llm-price-tracker
For local development:
python3 -m pip install -e ".[dev]"
Python 3.10 or newer is required.
Python usage
from llm_price_tracker import (
diff_snapshots,
fetch_all_prices,
fetch_provider_prices,
load_snapshot,
save_snapshot,
)
prices = fetch_all_prices()
openai_prices = fetch_provider_prices("openai")
save_snapshot(prices, "prices.json")
old = load_snapshot("prices-old.json")
new = load_snapshot("prices.json")
diff = diff_snapshots(old, new)
CLI usage
llm-price-tracker list-providers
llm-price-tracker fetch --provider openai --output openai-prices.json
llm-price-tracker fetch --provider all --output prices.json
llm-price-tracker diff --old prices-old.json --new prices.json
llm-price-tracker diff --old prices-old.json --new prices.json --fail-on-change
The CLI exits non-zero when fetching, parsing, validation, or diff
--fail-on-change checks fail. Use --ignore-errors with fetch --provider all
to write successful providers while reporting skipped provider errors.
Output schema
Snapshots are JSON arrays of ModelPrice objects. Decimal prices are serialized
as strings to avoid floating-point precision loss.
[
{
"provider": "openai",
"model": "gpt-4.1",
"input_per_1m": "2.00",
"output_per_1m": "8.00",
"cached_input_per_1m": "0.50",
"cache_write_5m_per_1m": null,
"cache_write_1h_per_1m": null,
"cache_storage_per_1m_hour": null,
"currency": "USD",
"unit": "1M tokens",
"source_url": "https://developers.openai.com/api/docs/pricing",
"source_type": "html",
"fetched_at": "2026-06-12T09:00:00Z",
"modality": null,
"billing_tier": null,
"price_condition": null,
"notes": null
}
]
Some providers publish tiered or modality-specific prices. Those variants use
optional modality, billing_tier, and price_condition fields instead of
inventing new model names.
Provider adapters include lightweight required-model sanity checks for current official pages. Those checks are adapter arguments so downstream users can override them when providers rename, add, or deprecate models.
Development
python3 -m pip install -e ".[dev]"
pytest
ruff check .
black --check .
Normal tests use saved fixtures and do not call live provider pages. Live tests, when added, should be opt-in:
LLM_PRICE_TRACKER_LIVE_TESTS=1 pytest tests/live
Author
Eugene Evstafev hi@eugene.plus
Project details
Release history Release notifications | RSS feed
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 llm_price_tracker-2026.6.121349.tar.gz.
File metadata
- Download URL: llm_price_tracker-2026.6.121349.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71390469cc4aa76481ce8165c3645b3354cfdff9b0d6e1111eb557a6868dc7ec
|
|
| MD5 |
648bfaa262e01ebfd6c2dd80bb51fc32
|
|
| BLAKE2b-256 |
f8d76787ccdcfa24161c1169d9a4479ed04441f27acb05cb61837af5976fd192
|
File details
Details for the file llm_price_tracker-2026.6.121349-py3-none-any.whl.
File metadata
- Download URL: llm_price_tracker-2026.6.121349-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3930a6783ec74d27e9ce2d78aaef173393f52d6be8ba04b4ff9902837f5c7ee9
|
|
| MD5 |
b86493e7194173c8f430542ae835f2c8
|
|
| BLAKE2b-256 |
450c5973c0617be48f22a864557e63d43ded20eeb77dc58a9f63b5cfe6a78c02
|