genai-prices  by pydantic

LLM inference API cost estimation tool

Created 9 months ago
271 stars

Top 94.9% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Summary

This project provides a tool for calculating prices associated with calling Large Language Model (LLM) inference APIs. It targets developers and researchers needing to estimate and compare LLM operational costs across numerous providers, offering a unified data source for pricing information.

How It Works

The system employs advanced logic for matching model and provider identifiers, ensuring accurate price retrieval. It supports historical price data, variable daily rates (including off-peak pricing), and tiered pricing structures for models with large context windows. Price data is managed in JSON format and is accessible via downloadable files, alongside Python and JavaScript/TypeScript packages and CLIs.

Quick Start & Requirements

Installation and usage instructions for the Python and JavaScript/TypeScript packages are detailed in their respective README files. Price data is directly available for download from the prices/ directory, including data.json and data_slim.json variants. No specific non-default prerequisites are listed in this README.

Highlighted Details

  • Comprehensive provider support, including Anthropic, OpenAI, AWS Bedrock, Azure, Google, Groq, Together AI, and OpenRouter, covering hundreds of models.
  • Handles complex pricing models such as historic price changes, variable daily rates, and tiered pricing for extended context.
  • Price data is directly downloadable as JSON files, facilitating offline use and integration.
  • Aims to identify and highlight price discrepancies across different LLM API providers.

Maintenance & Community

Contributions are welcomed, particularly from model providers to serve pricing information directly. The project leverages and acknowledges data from sources like Helicone, Open Router, LiteLLM, and Simon Willison's llm-prices. Instructions for contributing price data are in prices/README.md.

Licensing & Compatibility

The specific license is not detailed in this README. Users are directed to read the LICENSE file for development, hosting, and distribution terms. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project provides indicative price estimates, acknowledging that 100% accuracy is not guaranteed due to the inconsistent availability of exact pricing information from API providers. Users are advised that this is a best-effort calculation and not a guarantee against unexpected billing.

Health Check
Last Commit

3 days ago

Responsiveness

Inactive

Pull Requests (30d)
18
Issues (30d)
8
Star History
25 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.