AI API Cost Estimation Guide: Token Budgets, Usage Tables, and a Monthly Review Workflow
AI costsAPI pricingtokensLLM developmentbudgeting

AI API Cost Estimation Guide: Token Budgets, Usage Tables, and a Monthly Review Workflow

PPromptCraft Labs Editorial Team
2026-11-16
7 min read

Estimate and control LLM API costs with token formulas, usage tables, worked examples, and a practical monthly review workflow.

LLM API costs are easier to control when they are estimated before launch and measured against real usage afterwards. This guide provides a repeatable token budget formula, a practical usage table, illustrative worked examples, and a monthly review workflow for finding expensive prompts, retries, long contexts, and unused capacity. Because model prices, limits, caching options, and billing terminology change, treat the examples as planning methods rather than a current price list.

Overview

An LLM API cost estimate should answer four questions: how many requests will the application send, how many input and output tokens will each request use, what price applies to each token category, and what operational overhead could increase the total?

The basic calculation is:

Estimated cost = requests × ((input tokens ÷ 1,000,000 × input price) + (output tokens ÷ 1,000,000 × output price))

The divisor may differ between providers or products, so confirm whether the published rate is per thousand, million, or another unit. Also check whether cached input, batch processing, tool calls, embeddings, image inputs, audio, storage, or retrieval operations are charged separately.

A useful estimate has three layers:

  • Unit economics: the cost of one representative request.
  • Traffic scenarios: expected, low, and high request volumes.
  • Operational reality: retries, failed calls, long conversations, background jobs, evaluation runs, and development traffic.

Do not treat a model’s context window as a target. A larger limit allows more content but does not make long prompts economical. In many applications, retrieval, summarisation, trimming, or structured state can reduce the amount of context sent on every request.

How to estimate

Start with a usage table rather than a single monthly guess. Create one row for every meaningful workload, such as customer chat, document summarisation, classification, content review, retrieval-augmented generation, or offline evaluation.

WorkloadRequests per dayInput tokens/requestOutput tokens/requestRetry rateModel or price tier
Support assistantExpected volumeMeasured estimateMeasured estimateObserved or assumedSelected model
Document summariesExpected volumeDocument plus instructionsSummary targetObserved or assumedSelected model
Evaluation jobsRuns per monthTest case plus contextScoring outputObserved or assumedSelected model

For each row, calculate the base monthly request count:

Monthly requests = requests per day × active days per month

Then include retries:

Billable attempts = monthly requests × (1 + retry rate)

A retry rate of 0.05 means an additional five percent of attempts, not five extra requests per user. Include automatic retries, fallback-model calls, and calls triggered by timeouts where the provider may have processed the original request. If your system can submit duplicate requests, use request identifiers or application-level deduplication where appropriate.

For each billable attempt, separate input and output tokens. Input tokens often include system instructions, the current user message, conversation history, retrieved passages, tool results, and formatting requirements. Output tokens include the model response and, depending on the API, structured fields or tool-call arguments.

Keep a provider comparison table in your planning sheet. It should contain the provider and model name, input price unit, output price unit, cached-input treatment, batch option, context limit, rate limits, minimum charges, and any separate charges for tools or storage. Leave the values blank until checked against the provider’s current documentation. This makes the sheet useful without turning an old price snapshot into a misleading recommendation.

Inputs and assumptions

The quality of an LLM API cost calculator depends more on its assumptions than on its arithmetic. Record the source and date for every changing input, and distinguish measured values from planning assumptions.

Token counts

Use the provider’s tokenizer or an equivalent token-counting method for the model you plan to call. Character count and word count are only rough proxies. Code, URLs, tables, markup, non-English text, and repeated identifiers can tokenise differently from ordinary prose.

Measure several realistic examples rather than one short prompt. For a chat application, test a new conversation, a long conversation, a conversation with retrieved context, and a conversation containing tool results. Record the median and a high-use case so that your budget does not hide occasional long requests.

Traffic and seasonality

Separate active users from requests. One user may create several model calls through retries, tool use, moderation, summarisation, or follow-up actions. Model a normal month and a busy month. If traffic is uncertain, calculate a range instead of presenting false precision.

Output controls

Set an explicit maximum output length where the task permits it. A concise classification or extraction request should not have the same output allowance as a detailed report. Structured output can also make downstream processing more predictable, although it does not automatically guarantee a lower bill.

Other cost drivers

Include development and test traffic, prompt evaluations, batch jobs, embeddings, reranking, file processing, speech or image features, and observability tools when they are billed separately. In a RAG application, count the retrieval pipeline as well as the final answer. If a long source document is summarised before retrieval, include both calls.

Worked examples

The following figures are illustrative planning inputs, not current provider prices. Replace them with the rates for the exact model and billing unit you intend to use.

Example 1: a simple monthly estimate

Assume an application makes 20,000 requests per month. Each request uses 2,000 input tokens and 500 output tokens. For demonstration, assume an input rate of £2 per million tokens and an output rate of £8 per million tokens.

  • Input tokens: 20,000 × 2,000 = 40,000,000 tokens.
  • Output tokens: 20,000 × 500 = 10,000,000 tokens.
  • Illustrative input cost: 40 × £2 = £80.
  • Illustrative output cost: 10 × £8 = £80.
  • Illustrative total: £160 before other charges.

If the application has a ten percent retry rate, recalculate using 22,000 billable attempts. The illustrative total becomes £176, assuming retried calls have the same token profile. In practice, retries may be shorter, longer, or caused by a particular failure mode, so measure them separately after launch.

Example 2: reducing a long-context request

Suppose a support assistant sends 8,000 input tokens on every request because it includes the full conversation history and a large knowledge-base extract. If prompt trimming reduces the average input to 3,000 tokens while output remains unchanged, input usage falls by 62.5 percent. The saving depends on the input rate and the number of requests, but the method is clear: compare token counts before and after the change, then verify that answer quality and escalation rates remain acceptable.

Do not optimise cost in isolation. A shorter context that causes more retries, incorrect answers, or human reviews may increase the total cost of serving a task. Pair cost measurements with an evaluation set and quality checks. A documented prompt version and regression workflow can help you compare changes consistently; see the LLM evaluation framework and prompt versioning workflow for related practices.

When to recalculate

Recalculate your estimate whenever a cost-driving input changes, not only when the monthly invoice arrives. At minimum, review the model rates, context limits, caching rules, batch options, and billing terminology when the provider updates its documentation. Pricing tables should be checked regularly before they are used for a launch decision.

Run a monthly review using exported usage data. Sort by model, endpoint, prompt version, request type, input tokens, output tokens, retries, latency, and estimated cost. Look for:

  • Prompts with unusually high input or output tokens.
  • Retries clustered around a particular endpoint or timeout.
  • Conversation histories that grow without a useful quality benefit.
  • Evaluation or staging traffic using production-scale models.
  • Fallback calls that are hidden behind a successful user request.
  • Reserved, batch, or cached capacity that is not being used as expected.

Finish the review with three actions: update the planning sheet, assign an owner to the largest avoidable cost, and record the expected quality or reliability trade-off. Re-run the estimate before a major traffic campaign, a new RAG source, a prompt change, a model migration, or a feature that adds tool calls.

A practical spreadsheet can contain these columns: date, environment, workload, model, prompt version, requests, retries, average input tokens, average output tokens, input rate, output rate, estimated cost, actual cost, quality score, and notes. Keep estimates and invoices side by side. That turns an LLM API cost calculator from a one-off launch exercise into a living control for your AI application.

Related Topics

#AI costs#API pricing#tokens#LLM development#budgeting
P

PromptCraft Labs Editorial Team

AI Development Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.