Tiered LLM Invocation: Calculating Per-Task Cost by Tier and Workload Type

    This article explains why model selection should no longer be a one-size-fits-all choice, and how to build a tiered invocation strategy for large language models (LLMs) based on task difficulty and risk. It breaks down per-task cost into price per token and token consumption, analyzes how reasoning tiers affect token usage and quality, and provides a practical framework for tier assignment, upgrade rules, budget limits, and cost monitoring. A sample Python implementation and key metrics for ongoing calibration are also included.

    The Starting Point: Selection Criteria Have Changed

    When a new generation of models is released, teams typically respond in one of two ways: switch all tasks to the new version, or keep the old version unchanged. Both approaches overlook a critical fact: the relationship between cost and quality for the same model across different reasoning tiers is not linear.

    The real question in model selection is: for a given task type, what is the minimum cost required to achieve acceptable quality?

    Public benchmark results often show that newer models can match the performance of previous-generation models running at high reasoning intensity, even when the new models run at a lower tier. This suggests that capability improvements sometimes show up as efficiency gains rather than just higher ceilings. At the same time, those same benchmarks frequently show that running the new model at its maximum tier can make single-task costs exceed the high-tier cost of the older model. Both conclusions hold true at once, so a “one-size-fits-all” approach is rarely optimal. A tiered invocation strategy is more sensible.

    Two Factors Behind Per-Task Cost

    Per-task cost can be approximated as:

    1. Per-task cost ≈ Unit price × Tokens consumed to complete the task

    The first factor is determined by the vendor’s price list. For a given model, the unit price remains relatively stable over time; price adjustments tend to occur as discrete events.

    The second factor depends on multiple variables, including:

    • Input context length, such as attached code files, conversation history, and retrieved snippets.
    • Output length, meaning the final content generated by the model.
    • Reasoning tier. Higher tiers consume more tokens for intermediate reasoning steps.
    • Number of tool calls. Each tool response is added to the context.
    • Number of retries after failure. Retries incur repeated charges.

    Price reductions only affect the first factor. Suppose a price cut lowers the unit price by 20%, but the reasoning tier for a task is raised from medium to high, doubling token consumption. Total cost still rises. Therefore, comparing “dollars per million tokens” is of limited value. A more useful metric is “the average cost of completing one task at a certain tier for a certain task type”—call it the unit task cost.

    How Reasoning Tiers Affect Token Consumption

    The reasoning tier determines how much intermediate computation the model can perform before delivering a final answer. At higher tiers, the model typically does more planning, self-checking, and multi-path exploration. These intermediate steps also consume tokens and appear on the bill.

    The impact of tiers on quality and cost generally follows these rules:

    1. For simple tasks, the quality gain from extra reasoning is small, while cost grows roughly linearly with the tier.
    2. For complex tasks, a modest increase in reasoning effort can reduce errors and rework, so total cost may actually decline.
    3. There is a point of diminishing returns where quality plateaus while cost continues to rise.
    4. The location of that inflection point depends on the task type and cannot be inferred from one or two general benchmarks applied directly to your own business scenario.

    Another easily overlooked point: failed retries amplify cost. If low-tier results are frequently unusable and require a retry at a higher tier, the total cost may exceed using the high tier from the start. Therefore, a tiered strategy must also account for the first-pass success rate.

    Building a Tiered Invocation Strategy

    The core of tiering is to classify tasks by difficulty and risk, then assign each tier a default starting level, a maximum escalation level, and a quality validation method. The table below is a typical classification reference; specific parameters should be based on your team’s evaluation results:

    Task Type Typical Examples Suggested Starting Tier Quality Fallback
    Structured extraction Field extraction from text, format conversion Low Format validation, rule checks
    General generation Document summaries, unit test drafts Medium Sampled human review
    Multi-step reasoning Cross-file refactoring, complex defect diagnosis Medium, may escalate to high Test cases, step-by-step verification
    High-risk decisions Changes involving permissions, funds, or security High, with human review Dual review, rollback mechanism

    After classification, three things need to be done:

    1. Use your team’s evaluation set to find the lowest tier that meets quality standards for each class. The evaluation set should come from real business samples, not generic leaderboards.
    2. Set escalation conditions. Only escalate to a higher tier when the lower-tier result fails validation.
    3. Set budget limits, including maximum output length per call, total token budget per task, and maximum retry count. Tasks that exceed the budget should go to manual handling, not infinite retries.

    The escalation strategy needs a total-cost view. Suppose a low-tier call consumes 40,000 tokens, the probability of escalation to high tier is p, and a high-tier call consumes 150,000 tokens. Then the expected cost is:

    1. Average cost = Low-tier cost + Escalation probability × High-tier cost

    The numbers below are hypothetical and only illustrate the calculation:

    • If p = 0.3, the average cost is 4 + 0.3 × 15 = 8.5 (in ten-thousands of tokens), clearly lower than the 15 (ten-thousand) tokens of directly using the high tier.
    • If p = 0.7, the average cost is 4 + 0.7 × 15 = 14.5 (in ten-thousands of tokens), already close to the cost of using the high tier directly.

    This shows that the escalation probability is the key variable determining whether a tiered strategy is cost-effective. Teams need to measure this probability from their own data, not guess it.

    Illustrative Code

    The code below shows the basic logic of tiered invocation. Function names and parameters are illustrative; they should be replaced with your team’s actual client and validation functions.

    1. from dataclasses import dataclass
    2. TIER_ORDER = ["low", "medium", "high"]
    3. @dataclass
    4. class TierPolicy:
    5. task_type: str
    6. start_tier: str # Starting tier
    7. max_tier: str # Highest tier allowed for escalation
    8. max_tokens_per_call: int
    9. total_budget: int # Total token budget per task
    10. max_retries: int # Max attempts within each tier
    11. class BudgetExceeded(Exception):
    12. pass
    13. class EscalationFailed(Exception):
    14. pass
    15. POLICIES = {
    16. "extract": TierPolicy("extract", "low", "medium", 4_000, 20_000, 1),
    17. "generate": TierPolicy("generate", "medium", "high", 12_000, 60_000, 2),
    18. "reason": TierPolicy("reason", "medium", "high", 30_000, 150_000, 2),
    19. }
    20. def run_task(task_type, payload, call_model, validate):
    21. policy = POLICIES[task_type]
    22. start = TIER_ORDER.index(policy.start_tier)
    23. end = TIER_ORDER.index(policy.max_tier)
    24. spent = 0
    25. for tier in TIER_ORDER[start:end + 1]:
    26. for _ in range(policy.max_retries):
    27. result = call_model(
    28. payload,
    29. tier=tier,
    30. max_tokens=policy.max_tokens_per_call,
    31. )
    32. spent += result.tokens_used
    33. if spent > policy.total_budget:
    34. raise BudgetExceeded(f"{task_type} consumed {spent} tokens")
    35. if validate(result.output):
    36. return {"output": result.output, "tier": tier, "tokens": spent}
    37. raise EscalationFailed(f"{task_type} did not pass validation at tier {policy.max_tier}")

    Three points matter in this code. First, token consumption is accumulated after every call, and the budget check runs after each return. Second, tier escalation is limited to the range allowed by the policy, preventing tasks from defaulting to the highest tier. Third, the return value includes the final tier and total tokens spent, which helps with subsequent statistics.

    Cost Monitoring and Continuous Calibration

    Once the tiered strategy goes live, continuous monitoring is essential. At minimum, record the following fields:

    • Task type, invoked tier, and timestamp.
    • Input and output token counts.
    • Whether validation passed and whether escalation occurred.
    • Final latency and any human intervention.

    Aggregating this data by task type yields three key metrics: unit task cost, first-pass success rate, and escalation rate. Together, these metrics show whether the strategy is working as intended and where adjustments are needed.