This package is a work in progress:
- price data YAML
- JSON file with all prices
- Python library with functionality to calculate prices, including opt-in support for phoning home to get latest prices
- JS/TS library with functionality to calculate prices, including opt-in support for phoning home to get latest prices
- Beta release workflow with changesets for versioning and publishing
- API (and I guess UI) for calculating latest prices
- Advanced logic for matching on model IDs to maximise the chance of using the correct model
- Support for historic prices and prices changes, e.g. we have the prices for o3 before and after it's price changed
- Support for variable daily prices, e.g. we support calculating deepseek prices even with off-peak pricing
- tiered pricing support for Gemini models where you pay a separate price for very large contexts
- support for identifying price discrepancies from other sources
- Python package, CLI
- JavaScript/TypeScript package, CLI
- TODO: API and web UI
The following providers are currently supported:
- Anthropic - 9 models
- Avian - 4 models
- AWS Bedrock - 4 models
- Microsoft Azure - 47 models
- Cohere - 5 models
- Deepseek - 2 models
- Fireworks - 7 models
- Google - 30 models
- Groq - 8 models
- Mistral - 28 models
- Novita - 34 models
- OpenAI - 41 models
- OpenRouter - 548 models
- Perplexity - 8 models
- Together AI - 72 models
- X AI - 7 models
See the Python README for instructions on how to install and use the Python package and CLI.
See the JS/TS README for instructions on how to install and use the JavaScript/TypeScript package and CLI.
Price data is available in the following files:
prices/data.json
- JSON file with all pricesprices/data.schema.json
- JSON Schema forprices/data.json
prices/data_slim.json
- JSON file long fields like descriptions removed and free models removedprices/data_slim.schema.json
- JSON Schema forprices/data_slim.json
Feel free to download these files and use them as you wish. We would be grateful if you would reference this project wherever you use it and contribute back to the project if you find any errors.
This project uses changesets for versioning and publishing:
- Stable releases: Automatically published when PRs are merged to main (if changesets are present)
- Beta releases: Use the GitHub Actions workflow "Beta Release" to:
- Enter beta mode: Creates a PR to enable beta releases
- Version packages: Creates a PR with new beta versions
- Exit beta mode: Creates a PR to disable beta releases and prepare for stable release
Coming soon...
This project is a best effort from Pydantic and the community to provide an indicative estimate of the price you might pay for calling an LLM.
The price data cannot be exactly correct because model providers do not provide exact price information for their APIs in a format which can be reliably processed.
If you get a bill you weren't expecting, don't blame us!
If you're a lawyer, please read the LICENSE under which this project is developed, hosted and distributed.
If you're a developer, please contribute to fix any missing or incorrect prices you find.
We welcome contributions from the community and especially model/inference providers!
If you're a model provider: it would be amazing if you would serve a JSON file or API endpoint with pricing information which we could pull from. You would be the first AFAIK, and I think it would dramatically improve the experience for developers using your API!
Otherwise, to contribute:
- See
prices/README.md
for instructions on how to contribute to the price data. - Feel free to submit pull requests or issues about the Python and JS packages.
- If you need a library for another language, please create an issue, we'd be happy to discuss building it, hosting it here, or helping you maintain it elsewhere.
This project would not be possible without the following existing data sources:
- Helicone
- Open Router
- LiteLLM
- Simon Willison's llm-prices
While none of these sources had exactly what we needed (hence creating this project), they (especially helicone) were used to populate some of the initial price database, and we continue to pull price updates from them.
Thanks to all those projects!