Skip to main content

llm-prices

Dated, source-cited LLM API prices for Python: the same table as the Rust crate llm-prices, generated from prices.json. Pure Python, no dependencies, no network access. Prices are USD per 1M tokens, and every row carries the provider's pricing page and the date it was checked.

import llm_prices
from llm_prices import Usage

p = llm_prices.lookup("claude-sonnet-4-6")          # also dated, Bedrock, Vertex, prefixed ids
groq = llm_prices.lookup_provider("groq", "openai/gpt-oss-120b")

usage = Usage(input=2_048, cache_read=45_000, cache_write_5m=3_500, output=1_024)
p.cost_usage(usage).total                 # 0.048129 (float)
p.cost_usage(usage, exact=True).total     # Decimal('0.048129')

cost_usage prices prompt-cache reads, cache writes by lifetime, batch discounts, the long-context switch, service tiers (tier="flex", "priority", "fast") and data residency (inference_geo="us").

Moving from tokencost is one import line, same functions and signatures:

from llm_prices.compat.tokencost import calculate_prompt_cost, calculate_completion_cost

llm_prices.litellm.model_cost() is the table in LiteLLM's model_prices_and_context_window.json schema, for litellm.register_model. Source and docs: https://github.com/Mattbusel/llm-prices

Metadata

Release files for llm-prices 1.4.0

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-prices 1.4.0
File Size Uploaded Provenance Actions
llm_prices-1.4.0.tar.gz 42.8 kB With provenance Details for llm_prices-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-prices 1.4.0
File Interpreter ABI Platform Actions
llm_prices-1.4.0-py3-none-any.whl Python 3 none any Details for llm_prices-1.4.0-py3-none-any.whl

Total release size: 76.9 kB

Release files / llm_prices-1.4.0.tar.gz

Download URL llm_prices-1.4.0.tar.gz
Size 42.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b80e3c2de773d7bdc661caed7d4375f1b0c31d2153449411390cd5aa7e22b7ed
BLAKE2b-256 checksum
How to use checksums
1b4d72d0b8776044a382a38d2fd64a2a4422ac538cc3310092dddbdfe758816f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / llm_prices-1.4.0-py3-none-any.whl

Download URL llm_prices-1.4.0-py3-none-any.whl
Size 34.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a11e45387d277ccb12b0cfa5141bcc2f5ed5dc9aa968e5e1722dc26c458a4f8
BLAKE2b-256 checksum
How to use checksums
84e0c9aff0833b371375c72809d89a46ebedeac51408c036f07d03d1b6146f64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Security for llm-prices 1.4.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_prices-1.4.0.tar.gz

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 Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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