What Can 100 Million Tokens Do? LLM Cost Accounting and Optimization Practices
Understanding LLM costs requires more than looking at token prices. This article explains how to calculate token consumption for different business scenarios, build a practical cost model, and implement optimization strategies like model tiering, context caching, and observability. Learn how to turn abstract token budgets into measurable, controllable engineering parameters.
1. Clarifying the Metric: Tokens Are Not “Word Counts”
Before discussing “how much 100 million tokens are worth,” we must align on definitions; otherwise, all conclusions will be skewed.
Tokens are the smallest units processed by LLMs, split by a Tokenizer from a string. They have three easily overlooked characteristics:
- Non-linear relationship with word count. In Chinese scenarios, a single character is often split into 1–2 tokens; English and code are more affected by the vocabulary, where punctuation, indentation, and symbols consume additional tokens.
- Input and output are billed separately. Most services price Prompts (input) and Completions (output) distinctly, with output unit prices usually significantly higher than input.
- The context window is a shared resource. System prompts, conversation history, retrieved document chunks, and the user’s current query share the same window. Inflation in any single area will linearly increase the cost per call.
Therefore, “100 million tokens” is not an abstract number, but a resource pool that must be decomposed down to specific business actions.
2. Business Capacity of 100 Million Tokens: Converting to Tangible Output
Let’s do a magnitude conversion using hypothetical scenarios (actual results depend on official pricing and tokenization):
| Business Scenario | Typical Single Consumption (Input+Output) | Supported Calls for 100M Tokens |
|---|---|---|
| Code Completion (Small Context) | ~2K | ~50,000 times |
| Customer Service Q&A (with knowledge chunks) | ~4K | ~25,000 times |
| Long Document Summary (8K input) | ~9K | ~11,000 times |
| Multi-turn Conversation (10 turns accumulated) | ~30K | ~3,300 rounds |
The conclusion is straightforward: the practical meaning of a token budget depends on the context thickness of a single call. An implementation that repeatedly stuffs an entire document into the context might have only one-tenth the effective capacity of a finely designed one.
3. Cost Model: From “Feels Expensive” to Calculable
Total cost can be abstracted into a multiplicative structure:
Total Cost = Σ(Calls_i × (Input_Tokens_i × Input_Price + Output_Tokens_i × Output_Price))
Here is a corresponding estimation script (for illustration; prices should be read from the official pricing page, not hardcoded):
def estimate_cost(calls, in_tok, out_tok, price_in, price_out):"""price_* is the price per 1,000 tokens, unit consistent with official pricing"""per_call = (in_tok / 1000) * price_in + (out_tok / 1000) * price_outreturn calls * per_call# Example: 20,000 calls per day, 4K input, 1K outputdaily = estimate_cost(20_000, 4_000, 1_000, 0.001, 0.002)print(f"Daily cost: {daily:.2f}, Annual: {daily * 365:.2f}")
This model reveals three counter-intuitive facts:
- Output is more expensive than input. Compressing generation length is often more effective than compressing the prompt.
- Retries and failed calls are also billed. Chains lacking timeout and idempotency controls will silently inflate the bill.
- Unit price differences cause multiplicative cost differences. Model selection typically impacts the total budget more than code-level micro-optimizations.
4. Model Tiering: Using the “Most Expensive Capabilities” Where Needed Most
Mainstream platforms generally offer flagship, standard, and lightweight capability tiers. A more robust engineering approach is not an either/or decision, but establishing tiered routing:
def route(task):if task.requires_deep_reasoning: # Complex reasoning, long-chain tool callsreturn "flagship"if task.requires_structured_output: # Extraction, classification, formattingreturn "standard"return "lightweight" # Completion, rewriting, short Q&A
This requires three supporting elements: first, an offline evaluation set to decide if downgrading is acceptable based on accuracy/pass rates rather than subjective feelings; second, grayscale and rollback switches to make routing strategies configurable rather than hardcoded; third, a fallback upgrade, automatically upgrading when the lightweight model has low confidence, avoiding quality sacrifice on critical paths just to save money.
It should be emphasized that any claims of “80% cost reduction” or “99% cost reduction” should be translated into “measured ratios under equal quality constraints on a proprietary evaluation set,” otherwise they lack engineering reference value.
5. Context and Caching: Cutting the Bill in Half Without Changing Models
- Prompt slimming: Remove repeated system instructions, redundant examples, and debug residues; change long explanations into structured short sentences.
- Retrieval chunk trimming: Only inject paragraphs relevant to the question, controlling Top-K with reranking instead of feeding entire documents.
- Prefix caching reuse: Place stable system prompts and knowledge prefixes at the very beginning of the request, leveraging platform-side context caching capabilities to reduce repeated input overhead (whether it hits depends on actual billing and caching rules).
- Batch processing and asynchrony: Use batch processing channels for offline summaries and batch labeling tasks, which are usually more economical than real-time channels.
- Small model distillation: Use large models to produce high-quality annotations, and fine-tune lightweight models to handle high-frequency fixed tasks, forming a layered structure of “large model fallback, small model volume.”
6. Observability: No Optimization Without Measurement
Cost optimization must be built on attributable usage data. Here is a recommended minimum governance loop:
- Instrumentation: Record business line, scenario, model tier, input/output tokens, latency, and cache hit for each call, writing uniformly to a logging service.
- Dashboards and alerts: Set three threshold lines in monitoring alerts: daily budget, month-over-month growth rate, and tokens/requests per scenario.
- Quota guardrails: Set token quotas and rate limits per business line to prevent a single anomalous loop from piercing the budget.
- Cost attribution: Output Top-N consuming scenarios by tag dimension. Typically, the top three scenarios will account for the majority of expenditure, which determines optimization priorities.
7. Common Pitfalls
- Comparing only unit prices while ignoring output length and retry amplification.
- Estimating tokens using “word counts,” leading to budget deviations of several multiples.
- Downgrading models without evaluation, resulting in quality regressions discovered only on the user side.
- Treating cost optimization as a one-time activity without long-term dashboards and quota mechanisms.
8. Implementation Roadmap
Week 1: Complete instrumentation and baseline measurement. Week 2: Launch tiered routing and prompt slimming. Week 3: Introduce caching reuse and batch processing. Week 4: Establish quotas, alerts, and monthly review mechanisms. General capability combinations from platforms like Baidu AI Cloud (LLM service platform, object storage, logging service, monitoring and alerting, container platforms) can support the above pipeline without relying on any proprietary interfaces.
Core Conclusion: The value of 100 million tokens is not determined by the price tag, but by “single-call context thickness × call volume × model tier.” Turning these three into measurable, configurable, and rollback-able engineering parameters is what makes the budget truly controllable.
