Sub topic 9
Cost and latency trade-offs
This chapter assumes you can call an LLM API from Python and know what tokens, context windows and max output tokens are. It also assumes you have seen that reasoning models produce hidden reasoning tokens before the final answer.
Where the extra cost comes from
A reasoning model bills reasoning tokens as output tokens. Output tokens usually cost several times more than input tokens. A short answer that needed 3,000 reasoning tokens is billed for roughly 3,000 more output tokens than the same answer from a standard chat model.
Latency grows for the same reason. The model generates tokens one after another, so the time to the first visible word includes all of the reasoning. If reasoning takes 2,000 tokens at 80 tokens per second, the user waits about 25 seconds before any answer appears.
| Factor | Standard chat model | Reasoning model |
|---|---|---|
| Billed output | Answer only | Reasoning plus answer |
| Time to first visible token | Short | Grows with reasoning length |
| Cost variance per request | Low | High, depends on difficulty |
| Input cost | Same prompt cost | Same prompt cost |
The last row matters. Reasoning changes the output side. A long prompt costs the same input price at any effort level.
Reading the real numbers
Measure instead of guessing. The usage object shows how output was split.
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="o4-mini",
reasoning={"effort": "low"},
input="A train leaves at 14:10 and arrives at 17:45. How long is the trip?",
)
usage = response.usage
reasoning = usage.output_tokens_details.reasoning_tokens
total = usage.output_tokens
print(response.output_text)
print("reasoning tokens:", reasoning)
print("total output tokens:", total)
print("visible answer tokens:", total - reasoning)
print("reasoning share:", round(reasoning / total, 2))The reasoning share tells you where your money goes. On easy questions the share is often small. On hard questions it can be above 90 percent.
A cost model
You can estimate the cost of one request with a simple formula.
def request_cost(input_tokens, output_tokens, input_price, output_price):
"""Prices are dollars per million tokens. output_tokens includes reasoning."""
return (input_tokens * input_price + output_tokens * output_price) / 1_000_000
# Example prices only. Check your provider's current price list.
low = request_cost(500, 400, 1.10, 4.40)
high = request_cost(500, 6000, 1.10, 4.40)
print(f"low effort: ${low:.5f}")
print(f"high effort: ${high:.5f}")
print(f"ratio: {high / low:.1f}x")With these example prices the high-effort request costs about 10 times as much, even though the prompt and the visible answer are the same. Multiply that by thousands of requests per day and the setting becomes a budget decision.
Quality does not rise forever
More reasoning helps most when the task is hard enough to need it. On a simple lookup or a rewrite, extra reasoning adds cost and delay without improving the answer. Accuracy tends to flatten as effort rises while cost keeps climbing. The best setting is usually the lowest one that meets your accuracy target.
Practical levers
- Choose the lowest effort that passes your tests, and raise it only for task types that fail.
- Route requests. Send easy ones to a standard model or low effort, and hard ones to high effort.
- Cap output with a token limit so one runaway request cannot cost an unbounded amount.
- Stream the response when the API supports it, so the user sees progress after reasoning ends.
- Show a loading state for reasoning requests. Users tolerate a wait they understand.
Exercise
A request has 800 input tokens and returns 5,000 output tokens, of which 4,600 are reasoning tokens. Input costs $2 per million tokens and output costs $8 per million tokens. What is the cost, and which part dominates?
Show answer
Input: 800 × 2 / 1,000,000 = $0.0016. Output: 5,000 × 8 / 1,000,000 = $0.04, because reasoning tokens are billed as output. Total is $0.0416. Output dominates, and reasoning tokens alone account for 4,600 × 8 / 1,000,000 = $0.0368, about 88 percent of the total.
Exercise
Your support bot answers short FAQ questions with a reasoning model at high effort. Users complain about slow replies, and accuracy is the same as on a cheaper setting. What should you change first?
Show answer
Lower the effort level, or route these easy questions to a standard model. Confirm with a test set that accuracy stays the same, then compare cost and seconds per request before and after.