LLM API cost calculator
Estimate what your chatbot, RAG assistant or AI agent will cost to run each month, and how much prompt caching saves.
Same workload, every preset model
| Model | Monthly | Per request |
|---|
We routinely reduce LLM costs 40–80% with caching, model routing and prompt trimming. See how
How to estimate LLM API costs
LLM providers bill per token, separately for input (everything you send: system prompt, conversation history, retrieved documents, tool definitions) and output (what the model writes). Output tokens typically cost around 4–5× more than input tokens.
The formula this calculator uses for each model call:
cost = (uncached_input × input_price + cached_input × cache_price + output × output_price) / 1,000,000Multiply by calls per request (agents make several), requests per day, and 30 days.
Three quick ways to cut costs
- Cache your prompt prefix. Keep the system prompt and tool definitions identical across requests so they're served from cache.
- Route by difficulty. Send simple classification and extraction to a small model; reserve the big model for hard reasoning.
- Trim context. Retrieve fewer, better chunks in RAG, and summarise long histories instead of re-sending them.
Read more in our guide: How much does it cost to build an AI agent?
FAQ
How do I count tokens?
A token is roughly 3–4 characters of English text, or about 0.75 words. For accurate numbers, use your provider's token-counting endpoint on real prompts, since system prompts, tool definitions and retrieved documents all count as input.
What is prompt caching?
Prompt caching lets the provider reuse the unchanged beginning of your prompt (system prompt, tool definitions, documents) across requests. Cached input tokens are billed at a small fraction of the normal input price, which can cut costs dramatically for chatbots and agents.
Why are agents more expensive than chatbots?
An agent makes several model calls per task (plan, call tool, read result, repeat), and each call re-sends the growing conversation. Multiply your per-call tokens by the average number of steps per task.
Are these prices accurate?
Preset prices reflect published list prices as of October 2026. Prices change often and may differ by region, platform and volume tier, so always confirm on the provider's pricing page.
The Agent Brief
One practical email a week on AI agents, RAG and generative AI, for builders and business owners. No hype, no spam.