LLM API cost
What an LLM API call costs, from llm-prices: current models from Anthropic, OpenAI, Google Gemini, DeepSeek, Mistral, xAI, Cohere, Groq, Together AI and Fireworks AI, plus Bedrock, Vertex and Azure ids. Every price is USD per 1M tokens, read from the provider's own pricing page, with the link and the date it was checked. Everything runs in your browser.
Python
pip install llm-prices
import llm_prices
llm_prices.lookup("claude-sonnet-4-6").cost(input_tokens=12_000, output_tokens=800)
llm_prices.lookup_provider("bedrock", "us.anthropic.claude-sonnet-4-6-v1:0").input # USD per 1M
JavaScript (no npm account needed)
import { lookup } from "https://cdn.jsdelivr.net/gh/Mattbusel/llm-prices@v1/index.mjs";
lookup("gpt-4o").costUsage({ input: 12000, output: 800 }).total;
Rust
cargo add llm-prices
CI: fail a build when your own price table drifts
- uses: Mattbusel/llm-prices@v1
Daily price history: the tensorust/llm-api-prices dataset. Source and issues: github.com/Mattbusel/llm-prices (MIT).