Inside the Inference Framework: Why Output Costs 4x Input, and Agent Workloads Changed the Math
API bills and self-hosted latency are decided in this layer: cache hit rate, TTFT, token throughput, and PD separation all show up as either price or waiting time. Teams that build agents should treat prompt layout and framework version as cost controls, not formatting details.
An inference framework sits between the model and the GPU. It loads weights, schedules requests, manages KV Cache, and returns tokens. Because a model writes one output token at a time during decode and reads all weights for every token, output tokens cost several times input tokens; because cached prefixes skip prefill, cache hits are dramatically cheaper. Agent requests are long, repetitive, and short in output, so the framework's job shifts from pure speed to reuse: remember what has already been computed and route the next request to the machine that has it.
The open-source landscape has converged on continuous batching, paged KV Cache, prefix caching, chunked prefill, speculative decoding, and structured output. Differentiation has moved to support speed for new models, hardware coverage, and cluster-level scheduling: PD separation, cross-machine KV Cache, and autoscaling. DeepSeek's path from vLLM fork to DeepInfer, plus vLLM supporting V3.2-Exp on release day, shows model and framework are now co-designed.
When the same GPUs run at double inference efficiency, an API provider can serve twice the users or halve the price; that arithmetic makes inference frameworks the real competitive surface of model API pricing.
Agent contexts make every request a repetition of the last one, so cache hit rate becomes a direct cost line; a single changing timestamp at the start of a system prompt can invalidate the whole prefix.
The fast path from papers like Orca, PagedAttention, FlashAttention, and DistServe into mainstream engines explains why core features now look identical, leaving release-day model support and cluster behavior as the differentiators.
DeepSeek building its internal engine on an early vLLM branch, then open-sourcing components instead of the fork, shows that a tightly coupled production stack is hard to extract even when a company is committed to open source.
Hardware diversity is expanding because model vendors are designing numeric formats for upcoming domestic chips, yet each framework-chip-model combination still needs separate validation, so portability remains a roadmap item rather than an automatic property.