Reverse-Engineering LLM API Costs: How Multi-Model Routing Cuts Token Spending by 70x

    Do you know exactly where your LLM credits go? This article shows how to reverse-engineer per-model token costs from your own billing data using linear regression, reveals cost differences of up to 200x between model tiers, and explains a four-tier routing strategy—flagship models for planning, lightweight models for execution—that can stretch a fixed credit quota into 70x more throughput.

    Why You Should Reverse-Engineer Model Costs Yourself

    More and more LLM platforms use a “subscription plan + credit quota” model—for example, tens of thousands of credits per hour, capped at a few hundred thousand per week. This is friendly to individual developers, but it has one obvious pain point: platforms often don’t publish the exact credit consumption rate for each model, only a vague tier description.

    The result: your quota runs out and you have no idea where it went. You want to plan a large batch job, but you can’t calculate how many tokens it will cover.

    The solution is actually quite plain—do reverse engineering with your own real billing data. Line up your credit deductions over a period with the corresponding input tokens and output tokens, run a linear regression, and you can derive each model’s actual consumption rate.

    The Method: Fitting Consumption Rates from Billing Data

    Data Collection

    The process:

    1. Export your usage details from the platform console for the last several days, including the model name, input tokens, output tokens, and cache-hit tokens (if the platform provides them) for each call;
    2. Split the total credit deductions by call, forming a set of (token usage → credit consumption) samples;
    3. Build a multivariate linear model for each model:
    1. credit_consumption = a × input_tokens + b × output_tokens + c × cache_hit_tokens

    How Reliable Is the Fit?

    The regression results showed a coefficient of determination (R²) of 1.0 with residuals near zero. This means the platform’s billing is strictly linear—there are no hidden tiers, time-of-day factors, or random jitter. That means the derived coefficients can be trusted for cost forecasting.

    Two caveats:

    • These are personal reverse-engineered measurements, not an official price list. If the platform changes its rules, you need to refit;
    • The larger and more diverse your sample of calls, the more robust the results.

    The Cost Gaps: Up to Two Orders of Magnitude

    The fitted results show that credit consumption rates vary enormously across model tiers on the same platform. For neutrality, I’ll use four tiers: “flagship,” “mid-tier,” “lightweight,” and “fast lightweight.”

    Tier Input cost (relative / 1M) Output cost (relative / 1M)
    Flagship ~80,000 ~400,000
    Mid-tier ~32,000 ~112,000
    Lightweight ~4,000 ~8,000
    Fast lightweight ~2,000 ~2,000

    (Normalizing flagship input cost to 1, the lightweight tier is 1/20, and the fast lightweight tier is 1/40.)

    Two observations stand out:

    1. Flagship output cost is 200x that of the fast lightweight tier. Output is inherently more expensive than input due to token-by-token decoding, and the flagship’s high multiplier amplifies the gap further.
    2. Cache-hit input costs only about 2% of normal input. For agent workflows that repeatedly carry system prompts, tool descriptions, and conversation history, cache hits are hugely valuable—resending the same context dozens of times is billed almost at pocket change.

    Converting to Real Throughput: A 70x Difference on the Same Quota

    Assume a quota of 60,000 credits per 5 hours, an input-to-output token ratio of 8:2 (typical of agent + long-context scenarios), and no cache. The 5-hour throughput ceilings by tier:

    Tier Tokens processed in 5 hours
    Flagship ~417,000
    Mid-tier ~1,250,000
    Lightweight ~12,500,000
    Fast lightweight ~30,000,000

    In other words, the same credit quota lets the fast lightweight tier process more than 70x the tokens of the flagship tier. If your task doesn’t actually require flagship-level reasoning, routing everything to the flagship model burns an order of magnitude of your quota for nothing.

    Practical Strategy: Expensive Models Think, Cheap Models Do

    Based on this cost structure, here is a four-tier routing strategy:

    1. Flagship model: planning and final review. Only for task decomposition, solution design, and final result review. These calls are infrequent with short inputs and outputs, but demand the highest quality—perfect for the most expensive model. In practice, this often accounts for only 10–20% of total credit consumption, yet determines the quality ceiling of the whole pipeline.

    2. Mid-tier model: complex reasoning. Handles intermediate steps requiring multi-step reasoning, code logic analysis, and edge-case judgment. A good capability-cost balance—the “cerebral cortex” role.

    3. Lightweight model: workhorse execution. Routine code generation, text transformation, and data extraction all go here. Combined with the extremely low input cost of cache hits, long-context agent loops can run at very low marginal cost.

    4. Fast lightweight model: bulk simple tasks. Classification, labeling, format validation, and batch rewriting—high throughput, low per-task difficulty. This tier’s home turf.

    Illustrative routing pseudocode:

    1. def route(task):
    2. if task.type in ("plan", "final_review"):
    3. return MODEL_FLAGSHIP
    4. elif task.needs_multi_step_reasoning:
    5. return MODEL_MID
    6. elif task.type in ("generate", "extract", "transform"):
    7. return MODEL_LITE
    8. else: # classification, labeling, formatting, etc.
    9. return MODEL_FLASH_LITE

    Three Additional Optimizations

    • Exploit caching: Put unchanging system prompts and tool definitions at the very front of the context to keep the prefix stable. On a cache hit, input cost drops to around 2%;
    • Compress intermediate outputs: A high-cost model’s output becomes the next step’s input, so controlling its output length saves money twice;
    • Set up cost monitoring: Track credit consumption share by model. If the flagship model’s share runs out of control, immediately check whether your routing logic has degraded into “everything goes to flagship.”

    Conclusion

    Three takeaways:

    1. Cost differences between model tiers on the same platform can reach two orders of magnitude. “Picking the wrong model” wastes far more than any prompt-level optimization can recover;
    2. Billing is strictly linear (R² = 1.0), so it is both possible and worthwhile to reverse-engineer consumption rates from real bills for precise cost budgeting;
    3. Tiered orchestration—“expensive models think, cheap models do”—combined with cache-hit optimization can boost the throughput a fixed quota supports by tens of times.

    One final reminder: all numbers in this article are personal reverse-engineered measurements and are for reference only. For the actual rules, defer to the platform’s official documentation.