How to Calculate Token Cost in the Inference Era

    This article explains how to calculate token cost for LLM inference by shifting from peak compute to effective output. It covers a layered cost formula, why CPU, storage, and network configuration determine effective utilization, and a four-step capacity planning process built on SLOs and load-test baselines, plus notes on hardware depreciation risk.

    How to Calculate Token Cost in the Inference Era

    1. The Ledger Has Changed: From Buying Parameters to Buying Output

    The most visible shift of the past two years shows up in call volume: daily token consumption jumped from the hundreds-of-billions range to the quadrillions, a more than thousandfold increase in two years, and it tripled again in the last three months alone. The consumption pattern changed just as much. Question-and-answer interaction is “one question, one answer,” with long idle gaps in between. Agents, by contrast, stay online continuously, orchestrating tasks, retrieving knowledge, calling tools, and checking results in the background. Compute usage shifted from pulses to a steady load.

    Supply expanded in parallel. Industry figures show quarterly server revenue worldwide hit a record high, with the full-year total growing substantially over the previous year; domestic compute capacity nearly doubled year over year, with a compound annual growth rate expected to stay above 40% for several years. But the buyer’s mindset changed. Instead of asking “how many PFLOPS do I need,” customers now ask three questions: how many tokens per second can it produce, how much does each token cost, and will this hardware depreciate next year.

    Those three questions are essentially a new ledger. The old ledger recorded accelerator counts and peak compute; the new one records effective output and total lifecycle cost. Once the ledger changes, server form factors, the division of labor between CPU and GPU, and the ratio of storage to network all have to be re-derived.

    2. The Right Way to Calculate Token Cost

    Most estimates go wrong because they treat peak compute as effective output. A layered approach works better:

    1. Cost per token = (hardware depreciation + power and cooling + facility and bandwidth + operations staff + software and licensing) / effective token output
    2. Effective token output = nominal throughput × effective utilization × time
    3. Effective utilization = measured throughput / load-test baseline throughput

    The denominator is where mistakes happen most often. Nominal throughput usually comes from short load tests under ideal conditions, while production adds long contexts, batching policies, concurrency jitter, rate limiting, and retries. In practice, two clusters both labeled thousand-card scale can differ by more than 30% in effective token throughput, purely because of differences in CPU-to-GPU handoff efficiency, storage and network matching, and cooling strategy. This means that budgeting by “how many cards to buy” often reveals the bottleneck only at the moment the system is assembled, and the bottleneck turns out not to be the accelerator.

    The numerator needs the same breakdown. Depreciation should be estimated over expected economic life rather than accounting life, because inference workloads are more sensitive to hardware generations. Power and cooling take a noticeably larger share under always-on load. Operations headcount and availability losses caused by failures are often ignored entirely.

    3. Why the CPU Is Back at the Center

    An inference system is a pipeline: request intake, authentication and rate limiting, prompt assembly, retrieval, context trimming, tensor parallel scheduling, and post-processing with streaming responses. The CPU handles most of these stages. When GPU compute is strong enough, any stage that cannot keep up leaves the accelerator idle.

    Three bottlenecks are typical:

    • Insufficient data supply: input pre-processing and decode post-processing serialize, and the GPU waits for the next batch.
    • Excessive scheduling overhead: a poorly tuned dynamic batching window leaves batches underfilled or timing out.
    • Memory and I/O contention: under high concurrency, context caching and log writes compete for bandwidth.

    So CPU core count, memory capacity and memory bandwidth, and the number of interconnect lanes to the accelerators directly determine effective utilization. A practical test is to watch the accelerator utilization curve: if it is sawtooth-shaped and stays below threshold for long stretches, the problem is most likely data supply and scheduling, not compute.

    4. Storage and Network: The Underrated Ratio Problem

    Inference input and output look nothing like training: requests are short, concurrency is very high, contexts can be long, and session state and vector indexes are read and written frequently. Two requirements follow.

    First, low-latency random reads. Object storage suits model weights and cold data, while session state and hot indexes belong in low-latency storage or an in-memory cache, with a message queue for peak shaving and decoupling.

    Second, non-blocking network design. Tensor parallelism is extremely sensitive to inter-card communication, while pipeline parallelism is gentler on bandwidth but more sensitive to latency jitter. The access layer, the parameter plane, and the storage plane should be planned separately so that logs and image pulls do not squeeze communication bandwidth.

    5. Turning Cost into Actionable Capacity Planning

    A four-step process:

    1. Define service level objectives: first-token latency, per-token output latency, availability, and concurrency limits. Without SLOs, cost cannot be normalized.
    2. Build a load-test baseline: run sustained load tests with a realistic corpus distribution, recording throughput, latency, and resource usage at different concurrency levels in a baseline table.
    3. Optimize the ratio: fix the number of accelerators, then vary CPU cores, memory bandwidth, batching window, and parallelism strategy to find the throughput inflection point.
    4. Convert to unit cost: plug depreciation, electricity, cooling, bandwidth, and headcount into the formula, output cost per million tokens, and run a sensitivity analysis.

    An example baseline record structure:

    1. baseline:
    2. concurrency: 64
    3. input_len: 2048
    4. output_len: 512
    5. tokens_per_second: null # fill in measured value
    6. p99_first_token_ms: null
    7. gpu_utilization: null
    8. cpu_utilization: null
    9. cost_per_million_tokens: null

    6. Depreciation Risk and Architecture Choices

    Inference workloads are more sensitive to hardware generations than general-purpose ones, so “will it depreciate next year” is a fair concern. Ways to mitigate it include: favoring standardized, horizontally scalable architectures and avoiding deep coupling to a single form factor; decoupling the model from the runtime so that a hardware refresh only requires swapping the accelerator layer; and reserving elastic capacity, using a container platform plus monitoring and alerting to absorb peaks instead of paying year-round for peak load.

    7. Closing

    Token cost is not a finance problem but a systems engineering one. Only by replacing the denominator with effective output, breaking the numerator down to energy and depreciation, and bringing CPU, storage, and network into the main ledger can you answer whether a given amount of compute is worth it. Baidu AI Cloud emphasizes the same in practice: let business SLOs drive capacity planning, and account for unit output cost with observable data rather than peak specifications.