LLM API Cost Calculator

Estimate what an AI feature or chatbot will cost each month: enter your traffic, tokens per request and your provider's current prices per million tokens.

Runs in your browser; nothing you type is sent anywhere. · Updated

How to use the API cost calculator

  1. Requests per day your app will make.
  2. Input tokens per request: system prompt + conversation history + retrieved documents + the user's message.
  3. Output tokens per request: the length of the model's reply.
  4. Prices per million tokens from your provider's pricing page. Input and output are priced separately, and output usually costs several times more.
  5. If your provider offers prompt caching, enter the share of input that's cached and the discounted price.

We don't preload prices because they change often and differ by model; copy the current numbers from the provider.

The formula

Cost per request = (input × input price + output × output price) ÷ 1,000,000

Monthly cost = cost per request × requests per day × 30.4

Example: 2,000 requests a day, 1,500 input and 400 output tokens, at $3 input and $15 output per million: $0.0105 per request, about $638 a month.

Tokens, roughly

Text Tokens (English)
1 token about 4 characters, ¾ of a word
100 words about 130 tokens
1 page (500 words) about 650 tokens

Code, non-English text and unusual formatting use more tokens per word.

Cutting costs

  • Trim context: chat history and retrieved documents are usually most of the input.
  • Cache repeated system prompts.
  • Use a smaller model for simple tasks and route hard ones to a larger model.
  • Batch APIs often cost less for jobs that don't need an instant reply.
  • At high, steady volume, compare with running a model yourself: see the LLM VRAM calculator.

Frequently asked questions

How much does an AI API cost per month?

It depends on traffic, tokens and model price. A modest chatbot can cost a few dollars; a busy app with long prompts can reach thousands.

What is a token?

A chunk of text the model processes, about 4 characters or three-quarters of a word in English.

Why do output tokens cost more?

Generating text takes more computation per token than reading it, so providers price output higher.