Worked example: long document summary cost
The default scenario uses 12,000 content tokens, 300 instruction tokens, 500 tool or schema tokens, and 1,200 expected output tokens. Total billable input is 12,800 tokens and total request size is 14,000 tokens.
With GPT-5.4 mini at $0.75 per 1M input tokens and $4.50 per 1M output tokens, input cost is 12,800 / 1,000,000 x $0.75 = $0.0096 and output cost is 1,200 / 1,000,000 x $4.50 = $0.0054.
Cost per request is $0.0150. At 100 requests per day for 30 active days, the monthly estimate is 3,000 requests x $0.0150 = $45.00.
The request uses 14,000 / 400,000 = 3.5% of the GPT-5.4 mini context window, so it fits comfortably with a 10% safety buffer before long-context pricing, latency, and truncation risk are considered.
How to estimate AI token cost
The calculator adds content tokens, instruction tokens, and tool or schema tokens to get billable input tokens. It then splits those input tokens into standard and cached input based on the cache-share assumption, adds output-token cost, and multiplies by request volume.
Cost per request equals standard input cost plus cached input cost plus output cost. Monthly cost equals cost per request times requests per day times active days per month.
How much of the context window will my prompt use?
Context-window use is the total request size divided by the model context window. Total request size includes input tokens plus expected output tokens. The fit recommendation also reserves a safety buffer for variable user text, retrieval chunks, tools, and output growth.
Should I count system prompts and tool schemas?
Yes. Stable instructions, tool definitions, JSON schemas, retrieval context, and wrapper text can quietly become a large part of every request. Count them separately so cost optimization does not focus only on the user-visible text.
How do cached input tokens change API cost?
Cached input can reduce cost when a stable prefix repeats across requests and qualifies for the provider's caching rules. Do not apply the cached-input price to the entire prompt unless the provider usage logs show that those tokens are actually cached.
When does long context become expensive?
Long context becomes expensive when the same large prompt runs many times, when output is also long, or when the provider charges differently above a context threshold. Check long-context pricing, latency, truncation, and quality before moving a large prompt into production.