Skip to main content

llm-price-tracker

PyPI version License: MIT Downloads LinkedIn

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

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

Release files for llm-price-tracker 2026.6.121355

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

Source distribution (sdist)

Source distribution for llm-price-tracker 2026.6.121355
File Size Uploaded
llm_price_tracker-2026.6.121355.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-price-tracker 2026.6.121355
File Interpreter ABI Platform
llm_price_tracker-2026.6.121355-py3-none-any.whl Python 3 none any Details

Total release size: 46.0 kB

Release files / llm_price_tracker-2026.6.121355.tar.gz

Download URL llm_price_tracker-2026.6.121355.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d7c405c1cc50e4c1ed01380de426b82fb9e54ebab029d42a8f13b333a5ebc809
BLAKE2b-256 checksum
How to use checksums
0992b224212667135381a03aba0d36ae563328e95bc4216d2a6e0898cc716449
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / llm_price_tracker-2026.6.121355-py3-none-any.whl

Download URL llm_price_tracker-2026.6.121355-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea8b38b57b86658d496ad8dbb86f9d606698fb2be4a9767fa732741d52d5262b
BLAKE2b-256 checksum
How to use checksums
e9b1deb834344f9fda6774f679d0a4a32df4f83aca1def903333d9bec87d4525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

2026.6.121355 This release

2 release files

0.0.1

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