Posts

AI API Cost Calculator

Calculate and Compare
AI API Costs

Estimate your AI spending, compare model pricing, and understand what your real-world workloads actually cost.

11Pricing guides
8Models in calculator
Oct 2026Prices verified

GPT-5.6 Sol Price After November 21: The Promo Didn't End — It Moved to November 30

GPT-5.6 Sol Price After November 21: The Promo Didn't End — It Moved to November 30 November 21 came and went, and the price of GPT-5.6 Sol did not move. It is still $4 per million input tokens and $20 per million output tokens — the same promotional rate OpenAI set on August 21. What changed is the date on OpenAI's own page: where it used to say the promo was available "at least through November 21, 2026", it now says it is "available until November 30, 2026". The deadline moved nine days. The price after that date is still unpublished. That is the whole outcome, and it matters more than it looks. In October we warned that November 21 could bring a 41% overnight price rise, and we told you to budget for it. The rise did not arrive — but neither did an answer. OpenAI bought itself nine more days without saying what happens on the tenth. And the new wording is firmer than the old one: "until" is an expiry date, where "at least through" w...

API Retry Costs: Build a Cost-Aware Retry Wrapper for the Gemini API in Python

API Retry Costs: Build a Cost-Aware Retry Wrapper for the Gemini API in Python Every retry of a failed API call re-sends the whole prompt and bills it again, so a retry loop that retries every error can turn one failed call into four bills for zero answers. The fix is a small wrapper that retries only the errors that can clear on their own — 429s and 500-series errors — waits longer after each failure, and stops retrying once the call's own spend passes a cap you set. The code below does that for the Gemini API in about sixty lines. A library default of three retries sounds harmless until you multiply it by a whole day of traffic. A failed call still has a bill Take one call to Gemini 2.5 Flash with a 20,000-token prompt — a system prompt plus a help-centre document, as in our tool-loop investigation — and a 1,000-token answer. Rates are the published standard rates, verified 20 November 2026 on Google's pricing page: input $0.30, output $2.50 per million tokens. One atte...

Your AI Agent Pays for the Same Prompt Five Times: The Tool-Loop Tax on Your Bill

Your AI Agent Pays for the Same Prompt Five Times: The Tool-Loop Tax on Your Bill An AI agent task is not one API call. It is a loop: the model answers, calls a tool, reads the result, answers again, calls another tool, and so on — and every round re-sends the entire conversation so far. The system prompt, the user question, the earlier answers, and every tool result come back as fresh input tokens, billed again at the full input rate. A support agent that needs five tool rounds costs six times a single call, not because the answers are expensive, but because the same 20,000-token context is paid for five times. That is the tool-loop tax, and it is the main reason agent bills surprise people who priced their app as if each task were one call. One task, five bills Here is how the loop actually bills. You send a system prompt and a user question. The model replies with a tool call instead of an answer. Your code runs the tool and sends the result back — but the API has no memory betwe...

Gemini Cost Tracking: Build a Usage Logger for the Gemini API in Python

Gemini Cost Tracking: Build a Usage Logger for the Gemini API in Python Gemini cost tracking is a small wrapper around your Gemini API calls that reads the usage_metadata on every response, splits it into fresh input, cached input, visible output, thinking tokens, and tool-use tokens, prices each bucket at the rate Google publishes for your model, and writes one JSON line per call to a file. Put it between your code and the google-genai client, and the next time your Gemini bill looks wrong you can point at the exact feature and the exact token bucket that produced it. If you already built the OpenAI version of this wrapper or the Claude version , this is the Gemini twin — the same sixty-line shape, but Gemini's usage object hides its two most expensive surprises inside totals that look innocent. The first surprise is thinking tokens. The second is cached tokens folded into the prompt total. A logger that reads the two fields that look like totals — prompt tokens and output to...

Anthropic Cost Tracking: Build a Claude Usage Logger in Python

Anthropic Cost Tracking: Build a Claude Usage Logger in Python Anthropic cost tracking is a small wrapper around your Claude API calls that records, for every single request, how many fresh input tokens you sent, how many tokens you paid to write into the prompt cache, how many you read back from it, how many output tokens the model produced, and what that request cost under the rates you configure. Put it between your code and the Anthropic client, log one line per call to a file, and the next time a number on the Claude Console looks wrong, you can point at the exact feature, user, or prompt that produced it. If you already built the OpenAI version of this wrapper , this is its Claude twin — the same sixty-line shape, but the usage object it reads is different in exactly the way that makes Claude bills confusing. That difference is the whole reason this tutorial exists. OpenAI reports one prompt-token count and tells you how many of those tokens were cached. Claude reports three se...

Cache Write Pricing: The Surcharge You Pay Before Prompt Caching Saves You Anything

Cache Write Pricing: The Surcharge You Pay Before Prompt Caching Saves You Anything Prompt caching is sold as a 90% discount, and the discount is real — but it is the second price on the bill, not the first. Before a single cached token is read back at the cheap rate, the provider charges you to write the cache, at 1.25 times the normal input price for a short-lived cache and two to two-and-a-half times for a long-lived one. If the cached prompt is never read again, or only after the cache has expired, you paid more than if you had never turned caching on at all. The discount is real. So is the entry fee. Caching has two prices, not one Every caching story quotes the read price: cached tokens at a tenth, or a twentieth, of the standard input rate. Almost nobody quotes the write price — it sits in a different column of the pricing page. The first time you send a prompt, the provider processes it at the normal input rate and stores the result — and that storage step is billed separat...

Reasoning Tokens: The Invisible Output Tokens Eating Your OpenAI Bill

Reasoning Tokens: The Invisible Output Tokens Eating Your OpenAI Bill Here is the direct answer: when you call one of OpenAI's reasoning models, the model thinks before it answers, and that thinking is billed as output tokens — even though you never see a single one of those tokens. OpenAI's own reasoning guide says it plainly: reasoning tokens are not visible via the API, they still occupy space in the model's context window, and they are billed as output tokens. If your bill for a reasoning model looks far too high for the short answers you received, this is almost certainly why. You were not charged for the answer. You were charged for the thinking that produced it, at the most expensive rate on the price list. The bill that does not add up OpenAI's reasoning guide contains a small usage example that explains more about real bills than most pricing pages do. A request sends 75 input tokens and gets back 1,186 output tokens. That already looks odd for a short answ...