Token Package Cost Analysis: What One LLM Coding Session Really Consumes

    This article reports a hands-on cost test of a cloud provider's token package and uses the measured numbers to explain why agent-style coding workloads burn through quota so quickly. A single prompt with roughly 105,000 tokens of context consumed 1,214.84 billing points — about 60.7% of a 5-hour window and only ~16 requests per month. The article breaks down where those tokens come from, shows with sample code and a table how cumulative context makes agent cost grow roughly quadratically with turn count, compares code completion against agent workloads side by side, and lays out a four-step method for evaluating any fixed-quota package. It closes with context governance practices, model tiering, usage metrics to track, and four common misconceptions about token pricing.

    Background of the Test

    Terminology: To stay neutral, this article refers to the third parties involved in the original test as “a cloud provider”, “a general-purpose LLM”, “an AI coding tool”, and “a token package”. “Quota” means the billing points included in the package; “billing model” means pay-per-token versus a fixed-quota package.

    A recent hands-on test by a developer found that, in a token package offered by a cloud provider, a single prompt handled by a general-purpose LLM through an AI coding tool consumed 1,214.84 billing points against a context of roughly 105,000 tokens — about 61% of the quota for a single session.

    The package works like this:

    • A trial quota of 2,000 points valid for 5 hours, offered at a symbolic price;
    • About 20,000 points in total per month;
    • Once the quota is exhausted, you have to wait for the next time window before you can continue.

    The conclusion is fairly clear-cut: not recommended for agent-style tasks; probably good enough to plug into a code completion tool.

    The value of this short article is not to judge one vendor. It is to answer three general questions:

    1. Why does a single coding prompt “eat” more than a thousand points?
    2. Which workloads suit a fixed-quota package, and which do not?
    3. How can you get value out of LLM coding capability while keeping spend under control?

    1. Breaking Down the Test Results: What One Prompt Actually Consumes

    Before optimizing anything, it helps to settle the arithmetic. The measured data yields the following indicators.

    Share consumed per request

    1,214.84 ÷ 2,000 ≈ 60.7%. One prompt burns more than 60% of a 5-hour window, and the remainder cannot even support one more request of the same size.

    Implied unit price

    The trial price of RMB 9.9 for 2,000 points works out to RMB 0.00495 per point. On that basis, a single request costs about RMB 6.01, and exhausting 20,000 points in a month comes to about RMB 99.

    Note that the trial price is only a reference for this conversion and should not be treated as the unit price of the paid package.

    Quota coverage

    2,000 ÷ 1,214.84 ≈ 1.65 — one 5-hour window supports at most about 1.65 requests of this size. If all the quota is spent inside a single window, you can realistically complete only one full request; the remaining ~785 points are not enough for another task of comparable size.

    Monthly capacity

    20,000 ÷ 1,214.84 ≈ 16.46 — a whole month covers only about 16 requests at that intensity. Spread across 22 working days, that is under 0.75 requests per working day, or roughly one request every one to two working days.

    How the context was likely composed

    105,000 tokens is far above a typical developer’s default configuration, and above the context window of mainstream general-purpose models, which suggests it is context accumulated over a session rather than a single input. In AI coding tools, a context of that size is usually the sum of several parts:

    • System prompt and tool definitions: behavioral constraints, the tool list, and the parameter description for each tool;
    • Project context: directory structure, relevant source files, dependencies, and configuration files;
    • Multi-turn interaction: user instructions, model replies, tool call arguments and results — appended on every turn;
    • Historical accumulation: all of the above is resubmitted almost in full on every subsequent turn.

    From this follows the first conclusion: in agent-style coding tools, token consumption is driven not by how much you type, but by how much context accumulates and how many times it is resent.

    2. Token Consumption Breakdown: How Context Inflates Cost

    An agent tool is essentially a loop of “reason → call a tool → read the result → reason again”. The illustrative code below shows that loop and how the token count is computed.

    1. def estimate_agent_tokens(
    2. base_tokens: int, # system prompt + tool definitions + project context + first instruction
    3. tool_result_tokens: int, # average tokens returned by each tool call
    4. reply_tokens: int, # average tokens per model reply (including tool call arguments)
    5. rounds: int, # number of interaction turns needed to complete the task
    6. ) -> int:
    7. """Estimate the cumulative token usage of an agent completing one task."""
    8. total = 0
    9. context = base_tokens
    10. for _ in range(rounds):
    11. total += context + reply_tokens # the full context is resubmitted every turn
    12. context += reply_tokens + tool_result_tokens
    13. return total

    From the formula, the context submitted on turn i is approximately:

    base + (i − 1) × (reply + tool_result)

    So the cumulative input for a task of R turns is approximately:

    R × base + R × (R − 1) / 2 × (reply + tool_result)

    The core issue: the context is resubmitted every turn, so cumulative consumption grows roughly quadratically with the number of turns.

    Example parameters:

    • Base context (system prompt, tool definitions, project information, first instruction): 20,000 tokens;
    • Reply plus tool result per turn: 2,000 tokens combined.
    Turns Cumulative input tokens Cumulative total tokens Points at the measured ratio (approx.) Increase vs. 1 turn
    1 20,000 20,800 239 —
    3 66,000 66,600 765 +220%
    5 120,000 120,000 1,379 +477%
    10 290,000 288,000 3,311 +1285%
    20 780,000 772,000 8,874 +3612%
    30 1,470,000 1,455,000 16,725 +6898%

    Note: the conversion ratio here is 105,682 ÷ 1,214.84 ≈ 87.01 tokens/point, which is only an estimate under the conditions of this test.

    Key observations

    1. Doubling the turns grows cost by far more than double: going from 10 to 20 turns raises cumulative consumption from about 288,000 to about 772,000 tokens, an increase of roughly 2.7×.
    2. Turn count is the first lever on cost: the example above puts a 30-turn task at about 1.45 million tokens. Measured against the size of a single “prompt” in the test (~105,000 tokens), that is roughly 14 requests. One mid-complexity agent task is therefore enough to exceed the package’s entire monthly quota.
    3. Tool results are easy to overlook: a single directory walk, full-file read, or long command output can run to thousands of tokens, and it reappears in every subsequent turn. That is why the payoff from context trimming keeps growing with the number of turns.

    3. Code Completion vs. Agents: Cost Comparison of Two Workload Types

    The test’s verdict — “code completion is fine, agents are not” — comes down to the fact that the two workload types have fundamentally different context structures.

    Dimension Code completion Agent tasks
    Typical context Current file, snippet around the cursor System prompt, tool definitions, project information, full history and tool results
    Interaction pattern Single turn, stateless Multi-turn loop, state accumulates
    Cost per request Hundreds to a few thousand tokens Tens of thousands to hundreds of thousands of tokens
    Cost growth Roughly linear Roughly quadratic
    Latency sensitivity Very high Relatively tolerable
    Fit with a quota package Fairly good Poor

    (1) Why code completion is “good enough”

    Code completion uses a single-turn, stateless call: it carries only the current file, the cursor context, and a few related fragments, and returns the result directly to the editor without building up cross-turn accumulation. Even hundreds of completions a day usually stay within a controllable range.

    That said, “good enough” is not automatic. The following practices push consumption up just as easily:

    • Passing an entire large file as context;
    • Mixing file types so that a dedicated completion model is never matched;
    • Sending several files in one request.

    So completion workloads need the context restricted to what is genuinely relevant.

    Agent tasks typically go through multiple tool-calling turns, each of which resubmits the context accumulated so far. Even if the model service offers prompt caching to reduce the cost of repeated input, caching has boundaries in both capacity and lifetime. Once the context exceeds what can be cached, earlier content may be billed as ordinary input, and cost rises accordingly.

    Two effects compound this:

    • Cost of failure: when a task fails midway or has to be rolled back, the tokens already spent are hard to reuse and the work often restarts from scratch;
    • Cost of waiting for quota: once the quota runs out, even a half-finished task has to wait for the next time window — a noticeable drag on development work that needs to move continuously.

    Not every agent task is expensive, of course. Interactions that only do single-turn Q&A, call no tools, and carry no project context cost about the same as an ordinary conversation. What really drives cost up is the combination of carrying project context plus multiple tool-calling turns.

    4. Evaluating a Token Package Correctly: Method and Decision Checklist

    (1) A four-step evaluation method

    Step 1: Quantify the workload. Collect real data over a period: average and P95 input/output tokens per request, daily request count, peak distribution, and the extra input caused by tool calls.

    Step 2: Convert to available quota. First derive the “token → point” conversion ratio from a bill (about 87 tokens/point in this case), then divide the monthly quota by the average consumption per task to get how many tasks the package supports.

    Step 3: Check the time windows. If the package releases quota in fixed time windows, confirm those windows actually overlap your main working hours. A quota that is large but unusable is still a waste.

    Step 4: Choose the billing model.

    Usage profile Better fit Reason
    Light completion, low-frequency Q&A, steady usage Fixed-quota package Predictable cost, usually a better unit price
    High-frequency agent tasks, spiky usage, need for parallelism Pay-as-you-go + budget controls No interruption from an exhausted quota; you pay for actual usage
    Long tasks, large context, preference for cheaper models Prepaid dedicated resource plans Combine with caching to lower unit cost and avoid the rate limits of shared resources

    (2) Scenario math on the test data

    Scenario Estimated monthly usage Suitable for the 20,000-point package?
    A: mostly completion, 800 requests/day at ~1,500 tokens each ~360,000 tokens, ~4,138 points Yes, with plenty of headroom
    B: completion + one ~10-turn agent task per day ~1,600,000 tokens, ~18,394 points Borderline, nearly exhausted
    C: one ~30-turn agent task per day ~32,000,000 tokens, ~360,000 points Far beyond the quota, not suitable

    Note: scenarios B and C are estimated with the parameters from the example in section 2; actual figures vary with task complexity.

    The profile this package suits is roughly: developers whose usage is mainly completion and light Q&A, with agent tasks that are infrequent or short-chain. If you use agents heavily for refactoring, debugging, or cross-file changes, pay-as-you-go is the safer choice, combined with the governance measures below.

    5. The Key to Lowering Cost: Context Governance and Usage Measurement

    (1) Context governance

    • Narrow the context: retrieve and locate the relevant code first, then read fragments on demand, instead of loading several large files or a whole directory at once;
    • Compress history in time: when switching task branches or after a long conversation, start a new session or summarize, so unrelated history stops accumulating;
    • Control the size of tool results: avoid dumping large logs or file contents without filtering; filter or truncate before passing them to the model when necessary;
    • Make good use of prompt caching: for stable content shared across turns, such as system prompts and project descriptions, keep the order and content consistent to improve the cache hit rate.

    (2) Model tiering

    Not every task needs the most capable model:

    • Code completion, format conversion, and simple Q&A are well served by a fast, low-cost lightweight model;
    • Complex refactoring, root-cause analysis of defects, and cross-module design should go to a model with stronger reasoning ability.

    The key to tiering is defining clear routing rules per task, rather than calling an expensive model indiscriminately.

    (3) Usage measurement

    Building cost visibility is a prerequisite for making the right selection decisions. The illustrative code below tracks token consumption by day and by task.

    1. from collections import defaultdict
    2. from dataclasses import dataclass, field
    3. @dataclass
    4. class UsageStat:
    5. requests: int = 0
    6. input_tokens: int = 0
    7. output_tokens: int = 0
    8. cache_read_tokens: int = 0 # portion of input served from the prompt cache
    9. @property
    10. def total_tokens(self) -> int:
    11. return self.input_tokens + self.output_tokens
    12. @property
    13. def cache_hit_rate(self) -> float:
    14. return self.cache_read_tokens / self.input_tokens if self.input_tokens else 0.0
    15. # Aggregate by task to pinpoint high-consumption work
    16. task_usage: dict[str, UsageStat] = defaultdict(UsageStat)
    17. daily_usage: dict[str, UsageStat] = defaultdict(UsageStat)
    18. def record(task_id: str, day: str, usage: UsageStat) -> None:
    19. for bucket in (task_usage[task_id], daily_usage[day]):
    20. bucket.requests += usage.requests
    21. bucket.input_tokens += usage.input_tokens
    22. bucket.output_tokens += usage.output_tokens
    23. bucket.cache_read_tokens += usage.cache_read_tokens
    24. def report(usage: UsageStat) -> dict:
    25. return {
    26. "requests": usage.requests,
    27. "total_tokens": usage.total_tokens,
    28. "cache_hit_rate": round(usage.cache_hit_rate, 3),
    29. "avg_tokens_per_request": round(usage.total_tokens / usage.requests, 1)
    30. if usage.requests else 0,
    31. }

    In practice, the following metrics deserve the most attention:

    • Average tokens per task: indicates how many tasks the package can support;
    • Cache hit rate: reflects whether context is organized sensibly;
    • Input/output ratio: input far exceeding output usually means redundant context or uncleaned history;
    • Turn count distribution: identifies long-chain tasks that need optimizing.

    Paired with monitoring and alerting, you can be warned before usage crosses a threshold, avoiding the situation where quota runs out halfway through a task.

    6. Common Misconceptions

    Misconception 1: Multiply token count by unit price and you get the package cost.

    In the test, 105,000 tokens corresponded to 1,214.84 points, so the two are not in a simple one-to-one relationship. Conversion differs across models and vendors, and output tokens and cache-hit portions may also be handled differently, so bills and actual metering are what count.

    Misconception 2: A cache hit means cost can be ignored.

    Caching lowers the cost of the repeated portion of the input, but it has a capacity ceiling and a lifetime, and a long context keeps generating new input regardless.

    Misconception 3: A large quota automatically suits agents.

    The bottleneck for agents is not only quota. It also includes context that keeps accumulating, the interruption risk of waiting for time windows, and capability differences between models.

    Misconception 4: Describing the problem completely in one go lowers consumption.

    The more “complete” the description, the more pasted content tends to come with it. The approach that actually works is supplying precisely the relevant fragments and iterating as needed, not injecting all information at once.

    Conclusion

    The real lesson from this test is not whether one package is good or bad, but the importance of cost awareness: in agent-style coding tools, token consumption comes mainly from context that keeps accumulating, and cost grows roughly quadratically with the number of interaction turns — so both selection and optimization come down to context management.

    Concretely:

    1. Measure before choosing: be clear about your workload type, daily usage, and peak distribution;
    2. Fixed-quota packages suit light workloads; for heavy agent use, prefer pay-as-you-go with budget alerts;
    3. Keep optimizing context: narrow the retrieval scope, compress history, control the size of tool results, and make good use of prompt caching;
    4. Schedule by model tier: let lightweight models handle simple tasks and reserve high-capability models for genuinely complex problems.

    Do these four things, and you can find the balance between cost and efficiency that works for you.