How to Calculate Token Costs in the Inference Era

    As AI shifts from training to inference, the metric that matters is no longer the number of accelerators but the cost per token. This article explains why a "thousand-card" cluster does not guarantee a thousand-card output, where the real bottlenecks lie in CPU, storage, network, and cooling, and how to build a complete cost model covering hardware depreciation, power, software, and redundancy. It also outlines stability practices and a four-step path for capacity planning, with Baidu AI Cloud capabilities as a reference baseline.

    1. A New Ledger: From Buying Parameters to Accounting for Productivity

    Over the past two years, the way the industry discusses AI infrastructure has changed fundamentally. Early customers asked about static parameters such as the number of accelerator cards, memory capacity, and interconnect bandwidth. Now that inference has become the primary workload and agents have moved from demos into production, the first questions are different: how many tokens per second can this system produce, what is the total cost per token, and how will the hardware depreciate over the next year.

    This is not a change in wording but a shift in the unit of value measurement. In the training era, the output was model weights, a one-time asset. In the inference era, the output is a continuously flowing service capability, a cash flow that must be operated. When the unit changes from “cards” to “tokens,” the server form factor, the relationship between CPUs and accelerators, and the ratio of storage to network all have to be re-derived.

    One notable phenomenon is the non-linear growth in invocation volume. Public industry data shows that average daily token calls jumped by a factor of a thousand within two years, and then multiplied several times again within months. The root cause is a change in workload rhythm: conversational applications ask a question and get an answer, with plenty of idle time in between, while agents must stay online continuously, repeatedly running orchestration, retrieval, tool calls, and result verification in the background. Compute consumption shifts from bursty to sustained.

    Supply is expanding as well. Public forecasts show global server quarterly revenue reaching a record high, with the full-year figure growing substantially over the previous year; domestic compute capacity nearly doubled year over year and is expected to maintain a high compound growth rate for several years. Yet users quickly find that the number of accelerator cards cannot be equated with effective output.

    2. Why “Thousand Cards” Does Not Equal “Thousand-Card Output”

    An engineer involved in building an inference cluster ran the numbers: two clusters both labeled as thousand-card scale can differ by more than 30% in measured effective token throughput, depending on how efficiently CPUs and accelerators are connected, how well storage and network match the workload, and what thermal strategy is used.

    This means that planning a budget with an outdated map leads to discovering, the moment the system is assembled, that the bottleneck is not the accelerator but the components once treated as supporting roles. Four common bottlenecks:

    • Data supply bottleneck: if request preprocessing, tokenization, template assembly, and session state reads are concentrated on a few cores, accelerators idle periodically.
    • Communication bottleneck: the high-frequency collective communication from tensor parallelism and expert parallelism amplifies latency once the network convergence ratio is insufficient.
    • Storage bottleneck: model weight loading, long-context caching, and multi-turn session state reads and writes are limited by the throughput of object storage and parallel file systems.
    • Thermal and power bottleneck: conservative cooling triggers throttling, so nominal compute cannot be sustained.

    3. The CPU Returns to the Hub

    Under a ledger of “buying productivity,” the CPU returns to center stage for three reasons.

    The first is the control plane. Inference serving is not a single matrix multiplication but a full pipeline of ingress, authentication, rate limiting, routing, batch scheduling, and streaming output. Almost all of this logic runs on the CPU.

    The second is data-plane preprocessing. Tokenization, image decoding, document parsing, and structured output validation are CPU-intensive tasks that often sit on the critical path.

    The third is the orchestration plane. An agent’s tool calls, retrieval augmentation, and multi-step planning are essentially many short requests plus state management, more sensitive to single-core performance, cache, and memory bandwidth.

    A simplified capacity estimate helps illustrate the sizing logic:

    1. # Illustrative only: shows that CPUs and accelerators must be sized together; not real product parameters
    2. def estimate_nodes(token_rate, cfg):
    3. # Accelerator side: determined by batch throughput
    4. gpu_nodes = token_rate / cfg["tokens_per_gpu"]
    5. # CPU side: determined by preprocessing and orchestration capacity
    6. cpu_need = token_rate * cfg["cpu_per_1k_token"]
    7. cpu_nodes = cpu_need / cfg["cores_per_node"]
    8. # Take the upper bound; the bottleneck determines overall output
    9. return max(gpu_nodes, cpu_nodes), gpu_nodes, cpu_nodes

    The point is that effective throughput is determined by the bottleneck, not by the number of accelerators. If the CPU side is insufficient, adding accelerators only lowers overall utilization.

    4. The Full Composition of Token Cost

    To answer “how much does a token cost,” costs must be broken down to an accountable granularity:

    1. Hardware depreciation: amortized over the expected lifecycle; accelerators, whole systems, and network equipment depreciate on different schedules.
    2. Power and cooling: inference workloads stay online for long periods, so PUE and thermal strategy feed directly into unit cost.
    3. Network and storage: parallel strategies increase dependence on high-bandwidth interconnect and low-latency storage.
    4. Software and operations: batch scheduling, monitoring and alerting, logging, and canary releases bring labor and platform costs.
    5. Quality cost: redundant capacity reserved to meet stability targets, the most easily overlooked item.

    The unit metrics should include at least: output tokens per second, time to first token, cost per thousand tokens, effective utilization, and sustainable throughput per rack.

    5. Stability Design for Production

    When customers ask about “token stability,” they essentially want fluctuations converged into a committable range. Practical measures include:

    • Set alert thresholds on latency percentiles rather than averages, focusing on the long tail;
    • Use continuous batching and priority queues so long requests do not block short ones;
    • Externalize session state to cache and object storage so instances can scale out and in quickly;
    • Use a container platform for elastic scaling, pre-scaling according to the traffic curve;
    • Use logging to retain request-level traces and determine whether jitter comes from the CPU side or the accelerator side.

    6. Implementation Path and Baidu AI Cloud Practice

    A four-step approach is recommended: first, profile business tokens by clarifying the distribution of input and output lengths and the peak rhythm; second, run sizing stress tests to find the real bottlenecks in CPU, memory, network, and storage; then build a unit-cost dashboard that converts depreciation, power, and operations into cost per thousand tokens; finally, design an evolution path that preserves adjustable room for the CPU-to-accelerator ratio and avoids locking in a form factor all at once.

    Along this path, the general capabilities of Baidu AI Cloud can serve as a reference baseline: a container platform hosts elastic inference instances, object storage and parallel file systems hold weights and session data, monitoring, alerting, and logging support stability accounting, and a message queue handles peak shaving and task orchestration. The core idea remains: operate compute with tokens as the unit of measurement, so every investment can be measured, optimized, and continuously reused.