AI API Cost Calculator

Estimate costs for LLM prompts, completions, image generation, audio transcription, text-to-speech, embeddings, and full RAG pipelines. Supports batch API discounts, prompt caching, and reasoning tokens across 40+ models from OpenAI, Anthropic, Google, DeepSeek, Mistral, Meta, Qwen, Cohere and xAI.

Multi-modal Batch API Prompt Caching RAG Mode
Loading…

Workload Configuration

Total API calls per month
Prompt + context size
Completion length
0 = no caching, 75 = heavy reuse
For o3/o4/DeepSeek-R1/Gemini 2.5
Non-latency-sensitive workloads
Estimated Monthly Cost

Cost Breakdown

How AI API Cost Is Calculated

Chat / Text Generation

Monthly cost = requests × [(input tokens × input price) + (output tokens × output price) + (reasoning tokens × reasoning price)]. If prompt caching is enabled, the cached portion of input is billed at the cache-read rate (typically 50-90% cheaper). If using OpenAI's Batch API, both input and output are discounted 50% for asynchronous workloads.

RAG Pipeline

RAG cost = (embedding cost for new documents) + (queries × retrieved-chunk tokens × input price) + (queries × output tokens × output price). Embedding cost is usually negligible; the dominant cost is the LLM call that includes retrieved context as input.

Image Generation

Cost = images × per-image price. DALL-E 3 charges $0.04/image; Stable Image Ultra charges $0.08/image; Stable Image Core charges $0.03/image.

Audio Transcription (Whisper)

Cost = audio seconds × $0.0001/second = $6/hour.

Text to Speech (TTS)

Cost = characters × per-character price. TTS-1 is $0.000015/char (~$15 per 1M chars); TTS-1 HD is $0.00003/char.

Embeddings

Cost = tokens × per-token price. Text Embedding 3 Small is $0.02/Mtok; Large is $0.13/Mtok.

Cost Optimization Tips

FAQ

How is AI API cost calculated?

Cost = (input tokens × input price) + (output tokens × output price). Prices are quoted per token. Batch API and prompt caching reduce cost. This calculator handles all of these automatically.

What is the cheapest LLM API?

DeepSeek V3 at $0.28/$0.42 per Mtok and GPT-5 Nano at $0.05/$0.40 per Mtok are among the cheapest production-grade APIs. For free tiers, see Google's Gemini API free tier and Groq's free Llama inference.

How much does RAG cost?

RAG cost = embedding cost for chunks + LLM cost for (retrieved context + query + response). Embedding cost is usually negligible (cents). The dominant cost is the LLM call that includes retrieved context as input tokens. Use RAG mode in this calculator for an accurate estimate.

Does this calculator support prompt caching?

Yes. Enter the percentage of your prompt that hits the cache. The calculator blends the standard input rate with the cache-read rate automatically.

Can I calculate costs in INR?

Yes. Select INR (or EUR, GBP, JPY, etc.) from the currency selector. All prices convert from canonical USD using static exchange rates.