Estimate API token cost without counting cached input twice
A low price per million tokens says little without the billable categories and request volume. Begin with clear usage counts, not the number of words in a message or the price of a chat subscription.
The rate and the count must describe the same unit
Enter input and output rates in one currency per million tokens. Use the service and pricing tier that apply to your workload; a per-thousand rate is not interchangeable with a per-million rate.
ToolRoof estimates API charges from the values you supply. It does not fetch live prices or calculate a chat-app subscription. The currency label describes your supplied rates; it does not perform foreign-exchange conversion.
References: OpenAI — API pricing categories and separate tool charges
Cached input is a subset, not extra input
In this calculator, cached input belongs inside the total input count. Subtract it first, then price the remainder as ordinary input and the cached portion separately. Repeating a paragraph does not by itself establish a recorded cache hit.
Some pricing models distinguish cache writes from cache reads. This calculator does not model that separate category. Do not label those writes as cached reads or treat the displayed total as complete when such pricing applies.
References: OpenAI — Cache reuse and model-dependent pricing categories
A scenario is not an invoice
Multiplying one request by a volume assumes identical usage. If your workload mixes short summaries and long reports, estimate the groups separately and add them; an unrepresentative average can conceal the expensive group.
Tool charges, storage, taxes and changing tiers are outside this calculation. Use the output counts your provider bills, not only visible text length, and compare the estimate with actual usage before relying on a budget.
References: OpenAI — API pricing categories and separate tool charges · OpenAI — Plain-text counts versus complete request token counts
A hypothetical example, not current model pricing
A request has 2000 input tokens, including 500 cached tokens, and 300 output tokens. Suppose the per-million rates are 3 for ordinary input, 1 for cached input and 9 for output, in one currency unit. The components are 0.0045, 0.0005 and 0.0027: a total of 0.0077 per request.
Repeating exactly that usage 400 times gives 3.08. Charging all 2000 input tokens at the ordinary rate and adding 500 cached tokens would count the same portion twice. This example includes no cache-write, tool or tax charges and does not compare chat subscriptions.