Dev.to WebDev 🛠 Dev 👁 0 📖 2 min read

What an LLM API call really costs: the formula and four levers that move the bill

Prices are quoted per million tokens, but the bill depends on how many tokens you send, how many you get back, and which pricing rules apply. Figures below were checked against the providers' own pages on 13 November 202

Prices are quoted per million tokens, but the bill depends on how many tokens you send, how many you get back, and which pricing rules apply. Figures below were checked against the providers' own pages on 13 November 2026.

The formula

cost = input_tokens / 1e6 * input_price + output_tokens / 1e6 * output_price, times requests per day, times 30. A support bot sending 1,500 input and 400 output tokens, 1,000 times a day, on Claude Sonnet 5.5 ($2 in, $10 out per million) costs $210.00 a month; GPT-6.1 Sol lists the same prices (Anthropic pricing, OpenAI pricing). You can reproduce it in an LLM API cost calculator.

Lever 1: output costs more

Across 65 models in our price table, output is 1.0x to 10.0x the input price, with a median of 5.0x. On Sonnet 5.5 a chat turn is about 21% output by tokens but 57% of the cost, so trimming replies usually saves more than trimming prompts.

Lever 2: caching

Cached reads cost 0.1x the input price on most Claude models and on GPT-5.6 and later, and 0.05x on models such as Sonnet 5.5 and GPT-6.1 Sol; writing a cache entry costs 1.25x (Anthropic prompt caching). For a 10,000-token fixed prompt at 1,000 requests a day, our worked example falls from $690.00 to $120.72 a month. Minimum prompt lengths apply, so short system prompts will not cache.

Lever 3: batch

Anthropic, OpenAI and Google charge 50% less for jobs that can wait up to a day (OpenAI Batch API). The chatbot above falls from $210 to $105 a month.

Lever 4: very long prompts

OpenAI steps up above 272K input tokens, Gemini 3.1 Pro and Grok above 200K, Claude Haiku 5.5 above 100K. A 300K-token prompt costs about $0.61 on Sonnet 5.5 and $6.08 on GPT-6 Astra (our arithmetic from the published prices).

Compare tiers, not brands

On three reference workloads, Sonnet 5.5 and GPT-6.1 Sol cost the same; the small tier (Haiku 5.5 or GPT-6 Luna) costs $10.50, $9.00 and $8.52 a month, and flagships run 2 to 3 times the mid tier. Run the same 50 to 100 real prompts through each candidate and divide cost by passing answers. The full table is in this OpenAI API pricing breakdown alongside the other providers.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.