LLM API cost calculator

Estimate what your LLM workload costs. Set tokens per request and daily volume, and compare per-request, daily, and monthly spend across models — every price is editable, so it works for GPT, Claude, Gemini, or any provider.

How LLM API costs are calculated

LLM APIs bill per token, with separate rates for input (your prompt, documents, and history) and output (the model's response). Cost per request is input tokens × input rate + output tokens × output rate, with rates quoted per million tokens. Multiply by requests per day and by 30 for the monthly figure. A typical RAG chatbot request carries 1,000–4,000 input tokens (question plus retrieved context) and 200–800 output tokens, but the right numbers depend on your prompt size, retrieval depth, and answer length.

What actually drives your bill

Three things dominate: which model you call (frontier models cost 10–100× a small one), how much context you send, and how much the model writes back. Input tokens usually account for the majority of spend on RAG and agent workloads, because every request resends the system prompt, the retrieved documents, and the running conversation history. Output is charged at a premium rate, so chatty, long-form responses swing the bill more than their token count suggests. The volume multiplier is unforgiving too — a request that costs a tenth of a cent is $3,000/month at a million calls.

Five ways to cut LLM costs

  • Right-size the model per step. Use a fast, cheap model for classification, routing, and extraction; reserve a frontier model for the one step that genuinely needs it.
  • Cache repeated context. A long, fixed system prompt or knowledge base re-sent on every call is a prime candidate for prompt caching, often 75–90% cheaper on the cached portion.
  • Trim input. Retrieve fewer, better chunks; summarize or window the conversation history; drop boilerplate from the system prompt. Input is usually the largest line item.
  • Cap output. Set a max-tokens limit and prompt for concise answers — output is billed at the premium rate.
  • Batch non-urgent work. Provider batch APIs run asynchronous jobs at roughly half price — ideal for backfills, evals, and bulk generation.

Worked examples

A support RAG chatbot answering 5,000 questions a day at ~3,000 input and ~400 output tokens is a moderate-context, low-output workload — cheap on a small model, and the first place prompt caching pays off. A document summarizer processing 200-page reports pushes 150K+ input tokens per run, so it lives or dies on input rate and context length. A multi-step AI agent that loops several model calls per task multiplies both token counts and request volume, which is why routing the cheap steps to a small model matters most there. Model each one above by setting the token counts and daily volume.

Frequently asked questions

How much does the LLM API cost per request?
It depends on the model and how many tokens you send and receive. APIs bill separately for input tokens (your prompt, documents, and history) and output tokens (the response), each quoted per million tokens. A single RAG-chatbot request of ~2,000 input and ~500 output tokens costs a fraction of a cent on a small model and a few cents on a frontier one. Enter your token counts above to price your exact workload.
What is the difference between input and output tokens?
Input tokens are everything you send the model — the system prompt, the user's question, retrieved documents, and prior conversation turns. Output tokens are what the model generates back. Output is almost always billed at a higher rate than input (often 3–5×), so a workload that returns long answers costs far more than the input count alone suggests.
How do I estimate tokens from words or characters?
A token is roughly ¾ of an English word, or about 4 characters. So 1,000 tokens ≈ 750 words ≈ 1.5 pages of text. For a quick estimate, take your word count and divide by 0.75; for exact counts, paste the text into our context window comparison tool, which tokenizes it live.
What is prompt caching and how much does it save?
Prompt caching stores the tokens of a repeated prefix — a long system prompt or a fixed knowledge base — so you are not billed full input price for it on every call. Providers discount cached input reads heavily (commonly 75–90% off), which can cut the bill dramatically for RAG and agent workloads that resend the same context on every request.
How do I reduce my LLM API bill?
The biggest levers: use a smaller, cheaper model for simple steps and reserve a frontier model for the hard one; cache long, repeated prompts; trim conversation history and retrieved context to what's actually needed; cap output length; and batch non-urgent work through a provider's batch API, which is typically ~50% cheaper. Because input tokens usually dominate the bill, cutting prompt and context size is where most savings come from.
Is this LLM cost calculator free?
Yes — it runs entirely in your browser, needs no signup, and sends nothing to a server. The rates are prefilled with current pricing and every number is editable, so you can model any provider or a future price change.

Related tools: context window comparison (count tokens and check what fits), RAG cost calculator (embeddings + storage + generation), and the LLM price comparison table.

More free tools

  • LLM price comparison Live table of every model's API prices — sort, filter, and cost out your own request size.
  • RAG cost calculator Full pipeline costs — embeddings, vector storage, and generation — from corpus size and query volume.
  • RAG chunking visualizer Paste a document and watch chunk size, overlap, and strategy change the chunks before you embed.
  • LLM context window comparison Count the tokens in any text and check which models it fits, against live context windows.
  • Tool call & MCP schema builder Build function-calling parameters once, copy valid JSON Schema for OpenAI, Anthropic, and MCP.
  • AI chatbot ROI calculator Turn ticket volume, handle time, and deflection rate into monthly support savings and ROI.