genai-prices
Calculate prices for calling LLM inference APIs.
Decision gist · record as of 2026-08-14
Yes, if you call LLM APIs and need to estimate or track costs. The package is actively maintained, has low install friction, carries a permissive license, and solves a concrete problem. The caveat is that prices are not guaranteed 100% accurate—verify against your provider's current rates before relying on it for billing automation.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Prices are not 100% accurate per the project README.
- Low friction: pure Python wheel with only httpx2 and pydantic as runtime dependencies.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or redistribution in commercial or private projects.
last release 2026-08-12 (2 days) · last repo commit 2026-08-13 · 342 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 26,502,872 downloads/mo, #881 on PyPI
Alternatives
Verify before relying
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}")- How frequently are the embedded price tables updated, and what is the lag between published API rates and this package's data?
- Does httpx2 differ from httpx, and what is its stability/maintenance status?
- Which LLM providers and models are currently supported beyond the examples shown?
What it is and what it does
genai-prices is a Python library that maps token counts to pricing for LLM inference APIs. It provides a simple interface to calculate the cost of an LLM call given input and output token counts, model identifier, and provider name. The package ships with a built-in price table and can optionally download updated pricing data from GitHub in the background.
The library supports both direct price calculation via `calc_price()` and extraction of usage metadata from API responses via `extract_usage()`, which can then be priced. It includes a CLI for batch pricing queries and optional Rich-formatted output. The package depends on httpx2 for HTTP requests and pydantic for data validation, and is actively maintained with support for Python 3.10 through 3.14.
Use it for
- Calculate per-request costs for LLM API calls in production applications to track spend or implement budget controls.
- Extract token usage from LLM provider responses and immediately compute pricing without manual lookups.
- Batch-price multiple models or scenarios from the command line for cost estimation before deployment.
- Keep pricing data current by periodically downloading updated rates from the project repository.
- Validate or audit LLM billing by comparing calculated costs against provider invoices.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you call LLM APIs and need to estimate or track costs.
The package is actively maintained, has low install friction, carries a permissive license, and solves a concrete problem. The caveat is that prices are not guaranteed 100% accurate—verify against your provider's current rates before relying on it for billing automation.
Install
genai-prices on PyPI
Before you install
Low friction: pure Python wheel with only httpx2 and pydantic as runtime dependencies. Active maintenance with a release 2 days ago; repository shows 342 stars and current Python version support (3.10–3.14).
Requires Python 3.10 or later. Prices are not 100% accurate per the project README.
License in practice
MIT license (permissive) places no restrictions on use, modification, or redistribution in commercial or private projects.
Quickstart
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}")
Verify before relying
- How frequently are the embedded price tables updated, and what is the lag between published API rates and this package's data?
- Does httpx2 differ from httpx, and what is its stability/maintenance status?
- Which LLM providers and models are currently supported beyond the examples shown?
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packageshttpx2pydantic |
| Maintenance | Actively maintained 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 26,502,872 / month, #881 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: ConsoleEnvironment :: MacOS XIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: InternetTopic :: Software Development :: Libraries :: Python Modules |
Evidence: genai_prices-0.1.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “llm api pricing calculator”
- genai-pricesCalculates pricing for LLM API calls across multiple providers by…
- tokencostCounts tokens and estimates USD costs for LLM API calls across…
- aa-freightAn Alliance Auth app that manages a central freight service for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also unclecode-litellm · litellm · tokencost · any-llm-sdk · litellm-enterprise · llm · llm-openai-plugin · llama-index-llms-openai · genagent · keepa