genai-prices
Calculate prices for calling LLM inference APIs.
Install
genai-prices on PyPI
pip
pip install genai-pricesuv
uv add genai-pricespoetry
poetry add genai-pricesPackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — httpx2, pydantic |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: genai_prices-0.1.2-py3-none-any.whl
About genai-prices
from the package's own PyPI description — quoted content, verbatim
<div align="center"> <h1>genai-prices</h1> </div> <div align="center"> <a href="https://github.com/pydantic/genai-prices/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://github.com/pydantic/genai-prices/actions/workflows/ci.yml/badge.svg?event=push" alt="CI"></a> <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/pydantic/genai-prices"><img src="https://coverage-badge.samuelcolvin.workers.dev/pydantic/genai-prices.svg" alt="Coverage"></a> <a href="https://pypi.python.org/pypi/genai-prices"><img src="https://img.shields.io/pypi/v/genai-prices.svg" alt="PyPI"></a> <a href="https://github.com/pydantic/genai-prices"><img src="https://img.shields.io/pypi/pyversions/genai-prices.svg" alt="versions"></a> <a href="https://github.com/pydantic/genai-prices/blob/main/LICENSE"><img src="https://img.shields.io/github/license/pydantic/genai-prices.svg" alt="license"></a> <a href="https://logfire.pydantic.dev/docs/join-slack/"><img src="https://img.shields.io/badge/Slack-Join%20Slack-4A154B?logo=slack" alt="Join Slack" /></a> </div>
<br/> <div align="center"> Python package for <a...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Calculates pricing for generative AI API calls across multiple providers (OpenAI, Anthropic, etc.) by accepting token usage data and model references, with optional automatic price data updates from GitHub.
Low friction: pure Python wheel with only two runtime dependencies (httpx2 and pydantic). Actively maintained with release one day old and 343 repository stars; supports Python 3.10–3.14.
MIT license (permissive) places no restrictions on commercial or private use, modification, or redistribution.
Usage
pip install genai-prices
from genai_prices import Usage, calc_price
price_data = calc_price(
Usage(input_tokens=1000, output_tokens=100),
model_ref='gpt-4o',
provider_id='openai',
)
print(f"Total: ${price_data.total_price}")
Requires Python ≥3.10. Price data is embedded at package build time and may not reflect current API rates; the project explicitly warns prices will not be 100% accurate.
Verdict: A lightweight, actively maintained tool for estimating LLM API costs with minimal dependencies and permissive licensing. Well-suited for cost tracking in applications using multiple AI providers, though users must accept that embedded pricing data may lag behind actual provider rates—the project recommends using UpdatePrices for periodic refreshes if accuracy is critical.
Needs verification
- Whether httpx2 is a typo for httpx or a distinct package, and what its maintenance status is
- How frequently the embedded price data is updated relative to actual provider rate changes
- Whether the optional CLI extras introduce additional dependencies beyond those listed
Similar packages
permissive · top 1,000 on PyPI
yfinancepermissive · top 1,000 on PyPI
litellmpermissive · top 100 on PyPI
mlflowpermissive · top 1,000 on PyPI
mlflow-skinnypermissive · top 1,000 on PyPI
browser-usepermissive · top 1,000 on PyPI
strands-agentspermissive · top 1,000 on PyPI
langchain-anthropicpermissive · top 1,000 on PyPI
typing-inspectionpermissive · top 100 on PyPI
jsonschemapermissive · top 100 on PyPI