Why Output Tokens Cost More Than Input: How LLM Pricing Actually Works

    A $100 coding-agent task can spend most of its budget on repeated context reads, not on generated text. This article explains why output tokens are priced several times higher than input, why cache hits still dominate agent bills, and how to estimate and reduce that cost.

    1. A counterintuitive bill

    Suppose you prepaid $100 for a coding assistant to finish a full development task: read project files, edit code, run tests, and keep iterating on failures. Breaking down the spend often surprises people:

    • About $18 went to newly generated content (code and reasoning).
    • About $67 went to cache-hit rereads of existing context.
    • About $12 was the base cost of new input.
    • About $3 was the extra charge for writing into the cache.

    Output tokens are priced several times higher than ordinary input. Why did generation account for less than one fifth of the bill? The answer is how multi-turn agents work: the real cost is not writing, but reading the same context over and over.

    2. Why output is expensive: inference makes the cost asymmetric

    To understand the price gap, look at how the two kinds of tokens load the hardware.

    2.1 Input is batched in parallel; output is produced one token at a time

    When a Transformer processes input, the whole prompt can be split into batches and computed highly in parallel on the GPU. A batch of input tokens can flow through attention and feed-forward layers together, so hardware utilization stays close to saturation.

    Output is autoregressive. Each new token must wait for the previous one, append it to the sequence, and run a full forward pass. When generating the Nth token, the model attends over the sequence that already includes everything before it. That means:

    • The output stage cannot be fully parallelized, so a large share of GPU capacity sits idle waiting.
    • Every generated token pulls the entire context back into the computation.
    • The longer the output, the higher the marginal compute cost of each later token.

    2.2 KV cache only helps input, not output

    Inference stacks commonly use a KV cache: Key and Value matrices for tokens already processed are stored so they are not recomputed on every step. That is why a cache read is cheaper than fresh input—cached tokens are often priced at roughly one tenth of ordinary input.

    The KV cache does nothing for new output. Each new output token still needs a full forward pass. Nothing can be precomputed. The output token price therefore reflects the real cost of running compute at full load.

    2.3 Commercially, input can be reused; output is pure consumption

    From the provider’s side, the same system prompt or the same document can be reused across many requests (with prefix caching), so the marginal cost is low. Generation is one-shot, incremental compute. A roughly fivefold price gap is a mapping of that difference in resource use.

    3. Agent workloads: why cache reads become the largest line item

    Once unit prices are clear, token counts explain the bill.

    3.1 Tool calls keep history growing

    A coding agent’s loop usually looks like this:

    1. while the task is not done:
    2. the model reads the context and issues an instruction (for example, "read a file")
    3. the client runs the tool and receives the result (file contents or test logs)
    4. the client sends a new request = system prompt + conversation history + old tool results + the new tool result
    5. the model decides the next step from the full context

    The last step is the key. Every time the model “continues,” the client must resend the full history. The model is stateless. It does not remember the previous turn. All memory comes from that resent context.

    Caching makes old content cheaper to read. It does not remove that content from the next request.

    3.2 A short instruction returns a long result, then the loop snowballs

    The model’s instruction is often short—one line that says “read the test file.” The tool result is long—hundreds or thousands of lines of code, or a full test log. That long result stays in history and travels with the client for dozens of turns. By turn 50, the model is not only seeing the new result. It is also receiving everything accumulated over the previous 49 turns.

    The same file, read on turn 2 versus the last turn, has a very different effect on total cost: the early copy is billed again on every later turn. The length of the code the user finally sees does not show that difference at all.

    3.3 A simple budget estimate

    A rough estimate of one agent task is:

    1. total input tokens ≈ average context length N × number of turns T
    2. total cost ≈ N×T×cache price + new input tokens×input price + total output tokens×output price

    N and T move together. One extra tool call does not only add one turn. The tool result also lengthens N on every later turn. That is a common cost trap: after a product change, the delivered code can be the same length as before, but a few extra average retries can raise the bill sharply. Watching only average output length misses the whole process change.

    4. Practical ways to cut cost

    From that cost structure, a few engineering directions follow:

    1. Limit context growth. Trim tool results that have already been consumed. Summarize file contents that were already read, and truncate long test logs so only the key errors remain.
    2. Cut round trips. Read several files in one call and combine related actions so T stays lower.
    3. Hit the cache early. Put stable material—system prompts, project conventions—at the front of the request so prefix cache hits stay stable and repeated content is billed at the lower rate.
    4. Route by task. Send simple steps to a smaller model and reserve a flagship model for hard decisions. That split is a common industry pattern.

    5. Closing

    Output tokens are expensive because autoregressive generation cannot spread its compute cost across a batch. Cache reads still dominate the bill because a stateless agent must restate the full history on every turn. Seeing that tension between unit price and volume is the step from “pay by the word” intuition to engineering cost control for a whole task. For teams building intelligent applications, token budgets are not a side issue. They are a product-design problem on the same level as feature work.