Tiered LLM API Calls and Cost Governance: Planning and Execution Layers
This article examines why LLM API costs can overrun even when per-token pricing has not changed: most calls, including mechanical edits, are routed to the most expensive reasoning model. It presents a practical two-tier pattern—a high-reasoning planning layer and a high-throughput execution layer—with mode switching, automatic context inheritance, and a lightweight cost ledger. It also covers engineering safeguards such as fine-grained Git commits, plan documents under version control, and automated tests, then closes with a checklist for keeping high-cost tokens focused on the decisions that truly require them.
1. Where the Problem Starts: An Over-Budget Usage Review
Consider a typical monthly usage profile: about 2,800 requests to the flagship-tier model, consuming about 670 million tokens; about 1,000 requests to the lightweight-tier model, consuming about 310 million tokens; CNY 70 added to the account, with CNY 64 consumed. The project was originally expected to finish under CNY 50, but actual usage exceeded the budget.
The review conclusion is straightforward: cost overruns were not caused by unit price but by call structure. Early on, almost every interaction was sent to the flagship-tier model, including many mechanical tasks that did not require deep reasoning—changing one constant, adding a type annotation, or renaming a variable. These tasks consumed the most expensive reasoning capability, yet their output was not materially different from what the lightweight tier could produce.
It helps to establish a basic fact: token-based billing means cost = Σ(input tokens + output tokens) × the unit price of the corresponding tier. Request count is only a surface indicator. What really inflates the bill is repeated replay of long context. Every chat round in an AI coding tool resubmits the conversation history. In a task that lasts 30 rounds, the context from the first 29 rounds is billed again 29 times. Therefore, the first optimization priority is not “ask fewer questions”; it is to ensure the expensive tier appears only where it is truly needed.
2. Core Approach: Capability Tiers and Separation of Responsibilities
An effective method is to abstract model capabilities into two layers:
- Planning layer (high-reasoning tier): handles requirement decomposition, module boundaries, interface contracts, data structure design, and technology trade-offs. This work outputs “solution text”; token usage is low, but quality determines the overall outcome.
- Execution layer (high-throughput tier): turns the agreed plan into code, performs batch rewrites, fills in boilerplate, and gets local functionality working. This work consumes many tokens, has shallow logic branches, and is sensitive to latency.
The benefits come from three directions. First, over 80% of token consumption can be shifted to the lower-priced tier. Second, the execution layer responds noticeably faster, reducing wait time during interactions and avoiding disruption to flow. Third, because the plan is confirmed first, the probability of rework decreases—and under token-based billing, rework is the most expensive waste.
It is important to emphasize that this is not “replacing an expensive model with a cheap one.” It is using the expensive model to buy certainty and the cheaper model to buy throughput.
3. Implementation: Dual-Mode Switching and Automatic Context Synchronization
In an AI coding terminal that supports session mode switching, this strategy can map directly to two modes:
# Pseudo-config: route model tiers by session modemode:plan: { model_tier: reasoning } # produces plans only, does not write filesbuild: { model_tier: fast } # executes plans and may write filescontext_policy: inherit_from_plan # automatically inherit context when switching modes
The operational loop is as follows:
- In planning mode, use the high-reasoning-tier model to produce a list of functional modules and an implementation plan, then review or correct it manually.
- Switch to execution mode; the context is automatically synchronized to the lightweight-tier model, so the plan does not need to be copied and pasted by hand.
- The lightweight-tier model implements the plan module by module. When ambiguity appears, switch back to planning mode for clarification.
- Commit the version immediately after each small module is completed before moving to the next module.
The key point is context inheritance in step 2. If context cannot be passed automatically, the plan must be moved manually, and communication overhead will consume the benefits of tiering. During tool selection, “cross-mode context continuity” should be treated as a hard requirement.
4. Making Cost Observable
Do not judge savings by feeling. Build a lightweight ledger with fields such as date, mode, model tier, request count, input tokens, output tokens, and cumulative cost. Only with such a ledger can you answer two questions: where the money is being spent, and whether per-module cost actually drops after switching to tiered routing.
If you use a cloud provider’s API gateway or observability capabilities—generic categories such as log services and monitoring/alerting—you can collect invocation logs and perform aggregate analysis, producing comparison charts by tier and by mode. In practice, after tiered refactoring, total token volume may not decrease, but the share of tokens on the expensive tier often falls from above 70% to below 20%, and that is the direct source of bill improvement.
5. Risks and Engineering Constraints That Must Be Faced
The lightweight-tier model is not free of tradeoffs. In testing, the more common problems are concentrated in file editing:
- Missing or truncated write content: when overwriting an entire file, part of the existing code may be lost.
- Inability to self-correct syntax errors: generated code may contain syntax errors and require a second or even third reminder before it is fixed.
- Instruction drift: in long sessions, the model gradually departs from the agreed plan and “optimizes” parts that were not requested.
There are three corresponding engineering constraints, and all are necessary:
First, version management is a prerequisite, not an option. In vibe-coding projects, always initialize a local Git repository. Commit immediately after each small module is completed so that any incorrect write can be rolled back with one command.
git add -A && git commit -m "feat(module): complete user authentication module"# If an unexpected write occursgit restore --source=HEAD~1 .
Second, small commits are better than large batch commits. The finer the commit granularity, the lower the rollback cost, and the easier it is to identify which interaction introduced the problem.
Third, the plan must be written to disk as text. Save the output of planning mode into a design document inside the repository and place it under version control. The execution layer should work against only one module at a time; this effectively suppresses instruction drift.
6. Practical Checklist
- Have the planning layer and execution layer been separated, with clear responsibility boundaries?
- Has the share of tokens on the expensive tier been quantified and tracked continuously?
- Can context be inherited automatically across modes without manual transfer?
- Is there a local version repository, and is the commit granularity fine enough?
- Do key modules have automated tests as a fallback for write correctness?
- Are interface contracts fixed in the plan document to prevent the execution layer from improvising?
7. Conclusion
Token-based billing turns “which model should be used” from a technical preference into a cost decision. The most effective optimization is not to press for lower prices but to restructure the call flow: let high-reasoning capability handle plan creation only, let high-throughput capability handle implementation at scale, and use version management and automated tests to cover the stability gaps of lightweight models. The greatest regret with this layered collaboration pattern is discovering it too late—if the switch had happened earlier, work that originally took two and a half days could have been finished in one and a half days, and the bill would not have exceeded budget.
