LLM API Costs: Why a CNY 500 Budget Can Disappear So Quickly

    Unexpected LLM bills often come from repeated context, excessive output, retries, and uncontrolled workflows—not just token prices. This article explains token billing, breaks down an illustrative CNY 500 budget, and shows how model selection, context management, batching, usage tracking, and budget limits can make AI costs more predictable without sacrificing quality.

    1. When the Balance Hits Zero, the Problem Is Often Bigger Than One Prompt

    You add CNY 500 to an account and ask an AI application to analyze a batch of customer reviews. What looks like a routine data-processing job runs out of funds before it finishes.

    It is easy to blame expensive tokens. From an engineering perspective, however, the more useful questions are:

    • How many model calls did one business operation trigger?
    • How much conversation history, instruction text, and raw data accompanied each call?
    • Was the same material submitted repeatedly?
    • Were output length and structure explicitly constrained?
    • Did failed requests trigger automatic retries, and did those retries incur charges?
    • Were several parallel tasks drawing from the same budget?

    The user may see a single “Start analysis” button, while the application runs an entire pipeline: splitting data, classifying individual reviews, checking results, aggregating groups, and generating a report.

    In this context, “hidden costs” usually do not mean that a provider secretly adds charges outside its published billing rules. They mean that cost-amplifying behavior inside the workflow is neither visible to users nor adequately controlled by the application.

    Understanding the relationship between text, computation, API calls, and billing is the first step toward fixing it.

    2. What Is a Token? A Text-Processing Unit, Not a Fixed Character Count

    A token is a basic unit used by a model to process text. Before text enters the model, a tokenizer converts it into a sequence of token identifiers. During generation, the model typically produces tokens incrementally, which are then converted back into readable text.

    A token may represent a character, a word, part of a word, punctuation, whitespace, or another text fragment.

    There Is No Universal Token-to-Character Conversion

    Different models use different tokenizers. The same Chinese sentence can produce different token counts across models. English, numbers, code, special symbols, and mixed-language text also tokenize differently.

    Any rule such as “one token equals a certain number of characters” is only a rough estimate under specific conditions—not a universal billing standard.

    Character-based estimates can be particularly inaccurate for:

    • Code with extensive punctuation and indentation.
    • Technical documents containing multiple languages.
    • Long numbers, random identifiers, and encoded strings.
    • Tables, structured data, and repeated field names.

    For reliable budgeting, use a token-counting method supported by the target model or collect usage data from small-scale test calls.

    Input Includes More Than the Latest User Message

    A request can contain several components:

    Input tokens = task instructions + current question + conversation history + retrieved material + tool descriptions and tool results + other applicable context

    For example, a user may type only “Continue the summary,” but the application may also submit the full conversation, the original review data, and the analysis instructions.

    A short new message does not necessarily mean a small input.

    Output Usage Is Not Always Limited to Visible Text

    The displayed response generally counts toward output usage. Some reasoning models may also report additional reasoning usage. How that usage is classified, billed, and displayed depends on the service, so the visible response length alone may not explain the bill.

    Speech, image, and other multimodal tasks may use different measurement methods. Text-token estimates should not be applied indiscriminately to every type of workload.

    3. Why Input and Output Often Have Different Prices

    Token billing is a way for providers to meter resource consumption. It does not mean that text itself has a fixed computational cost.

    Model inference involves computation, GPU memory access, request scheduling, and service operation. Processing input and generating output follow different execution patterns. Long contexts, sequential generation, and concurrent workloads also affect resource use.

    Many services therefore set separate input and output prices. Output may cost more, but there is no universal price ratio.

    It is also incorrect to assume:

    A model with more parameters must produce longer answers and consume more tokens.

    Model size, unit price, reasoning intensity, and response length are separate dimensions. A larger model may complete a task with a similar output length, or it may generate a longer answer because of the task settings. Actual cost depends on the unit price, the number of calls, and the usage of each call.

    For models that use sparse computation or related architectures, it is equally misleading to imagine every parameter as a small worker that participates in every operation. That analogy obscures how inference actually works.

    4. The Math: How a CNY 500 Budget Can Be Exhausted

    For text requests billed separately for input and output, start with this simplified formula:

    1. Cost per call =
    2. (Input tokens / Pricing unit) × Input price
    3. + (Output tokens / Pricing unit) × Output price

    If prices are quoted per million tokens:

    1. Total task cost =
    2. Sum of all call costs
    3. + Other applicable service charges

    Other charges might include retrieval, storage, or tool usage. Whether those charges apply, and how they are calculated, depends on the service.

    An Illustrative Example

    The following figures are hypothetical and do not represent any provider’s actual pricing:

    • Input price: CNY 10 per million tokens.
    • Output price: CNY 30 per million tokens.
    • Reviews to process: 10,000.
    • Calls per review: one.
    • Average input per call: 4,000 tokens.
    • Average output per call: 400 tokens.

    Input cost:

    1. 10,000 × 4,000 / 1,000,000 × CNY 10 = CNY 400

    Output cost:

    1. 10,000 × 400 / 1,000,000 × CNY 30 = CNY 120

    The total is CNY 520, before retries or subsequent aggregation.

    The main optimization opportunity may not be the review text itself. It may be why every request contains 4,000 input tokens: perhaps long instructions, repeated examples, or complete background documents accompany every review.

    Cost also does not map directly to elapsed time. A highly concurrent job can issue many requests in a short period. Spending the budget in ten minutes does not necessarily mean each token is unusually expensive; it may mean request volume was not controlled.

    5. Six Common Cost Amplifiers

    1. Growing Conversation History

    Some chat applications resubmit previous messages with every new request. If each round adds roughly the same amount of content and the full history is retained, cumulative input usage can approach quadratic growth.

    The first request carries one unit of context, the second carries two, and the third carries three. Users experience a continuous conversation, but the bill reflects repeated processing of earlier content.

    Storing a conversation does not make subsequent reads free. Any discounted cache billing depends on the provider’s rules and cache-hit conditions.

    2. Repeated Long Prompts

    System instructions, category definitions, and examples can improve consistency. But attaching thousands of tokens of fixed instructions to every record turns a small amount of business data into a large input workload.

    The goal is not to remove all instructions. It is to eliminate redundant explanation, retain necessary constraints, and verify that examples actually improve accuracy.

    3. Excessive Retrieved Context

    Retrieval-augmented generation, or RAG, can supply external information, but retrieving more material is not always beneficial.

    Too much context increases input cost and may introduce irrelevant details, conflicting information, or distractions. Select relevant passages, remove duplicates, and retain source references rather than inserting entire documents into the context.

    4. Loops in Automated Workflows

    An automated task may move through multiple stages: planning, calling tools, reading results, and planning again.

    Without clear termination conditions, the model may keep searching, confirming, or regenerating. Large tool responses then become input for later calls, further increasing the cost of a single business operation.

    Automated workflows need limits on call count, execution time, and cumulative spending—not just the length of the final response.

    5. Unbounded Retries

    Timeouts, invalid output formats, and unacceptable results can all trigger retries.

    However, a client that receives no response cannot assume the server did no work or that the request was not billed. Request status, usage records, and service rules must be checked.

    Immediately retrying every error can amplify costs, especially in concurrent batch processing. Distinguish between retryable errors, non-retryable errors, and requests with unknown outcomes. Apply backoff and a maximum retry count.

    6. Unnecessarily Verbose Output

    “Analyze every review in detail and provide a complete explanation” turns a simple classification task into substantial text generation.

    If the application only needs a category, sentiment label, and human-review flag, request those fields. Generate longer explanations for exceptional records rather than for the entire dataset.

    6. Three Core Ways to Reduce Costs

    Method 1: Match Model Capability to Task Difficulty

    Deduplication, format validation, and fixed-field extraction do not always require complex reasoning.

    A processing pipeline can be divided into three layers:

    Layer 1: Deterministic processing.
    Use rules, string matching, and conventional code for missing-value checks, length limits, and duplicate detection. Work that code can reliably perform does not need a model call every time.

    Layer 2: Routine semantic processing.
    For classification, short summaries, and well-defined extraction tasks, use a validated lower-cost model that meets the required quality standard.

    Layer 3: Escalation for difficult cases.
    Send records involving conflicting categories, insufficient information, risk assessment, or complex reasoning to a more capable model or a human reviewer.

    The principle is not “always choose the cheapest model.” It is use the lowest-cost approach that reliably meets the quality requirement.

    A model’s self-reported confidence should not be treated as inherently reliable. Validate escalation rules against labeled samples and observed error patterns.

    Method 2: Shorten Context Without Removing Necessary Information

    Context optimization should focus on information value, not mechanical word reduction.

    Useful measures include:

    • Removing duplicate reviews, irrelevant fields, and unnecessary logs.
    • Consolidating stable task instructions into a concise version.
    • Maintaining periodic summaries of long conversations.
    • Retrieving only material directly relevant to the current question.
    • Avoiding repeated submission of all previous tool results.
    • Caching results for identical requests.

    Application-level result caching and provider-side input caching are different mechanisms.

    Result caching reuses an existing business result and can avoid a new model call entirely. Provider-side input caching may reduce repeated-input processing or billing when specific conditions are met. Support and pricing benefits must be checked separately.

    Cache keys should include the task-instruction version, model configuration, and data version to prevent reuse of outdated results after a change. Sensitive information also requires access isolation and appropriate retention limits.

    Method 3: Constrain Output and Tune Batch Processing

    Design output around what the application actually consumes. A review-classification task might request:

    • Record ID.
    • Primary category.
    • Sentiment label.
    • Whether human review is required.
    • One short explanation, when necessary.

    This makes results easier to process and avoids unnecessary generation.

    For short records, processing several items in one request can spread the fixed instruction cost across more data. But larger batches are not automatically better. Oversized batches may produce missing items, incorrect record mappings, truncated output, or retries of the entire batch.

    Choose batch sizes through testing. Preserve record IDs, validate the number of returned results, and retry only failed records where possible.

    7. Move From Token Savings to Budget Control

    Shorter prompts alone cannot solve enterprise-scale cost problems. Reliable cost management must be built into the request pipeline.

    Record Usage for Every Call

    Useful fields include:

    • Business task ID and request ID.
    • Model type and configuration version.
    • Input, output, and other applicable usage.
    • Actual or estimated cost.
    • Request duration and execution status.
    • Retry status and reason.
    • Cache usage.
    • Calling component and associated business function.

    Logs should not store complete sensitive text by default. Prioritize usage metrics, versions, statuses, and necessary summaries to support troubleshooting while reducing data-exposure risk.

    Set Budget Limits at Multiple Levels

    Budget controls should cover individual calls, tasks, users, and the overall account.

    Before execution, estimate total cost from sample usage. During execution, monitor actual consumption. At a warning threshold, pause further task expansion. At a hard limit, block new requests.

    High-concurrency systems must also reserve estimated costs for requests already in flight. Otherwise, requests that have already been submitted can continue generating charges even after monitoring detects that the remaining balance is low.

    Evaluate Cost and Quality Together

    Do not focus only on the price per million tokens. A more useful metric is:

    Cost per acceptable business result.

    A cheaper model with a higher error rate may require more retries and manual correction. A more expensive model that completes the task correctly on the first attempt may have a lower total cost.

    Use representative samples to compare accuracy, missing-result rates, human-review rates, response time, and total task cost before choosing model tiers and workflow design.

    8. Validate Costs With a Small Sample Before Launch

    Before processing a large dataset:

    1. Select samples that cover short text, long text, ambiguous reviews, and unusual content.
    2. Test concise prompts, different output structures, and different batch sizes.
    3. Measure average input and output usage as well as upper-percentile usage, rather than budgeting from averages alone.
    4. Extrapolate costs to the expected data volume, allowing a reasonable margin for retries and exceptions.
    5. Start with a small production batch and check whether actual costs match estimates.
    6. Increase concurrency and processing volume gradually once both quality and budget metrics are stable.

    For customer reviews, remove or mask unnecessary contact details, identity information, and other sensitive data before processing. This can reduce input volume, but more importantly, it is a basic data-security requirement.

    Conclusion: Uncontrolled Workflows Are the Real Cost Risk

    Tokens are neither mysterious currency nor a fixed exchange rate for characters. They are an important unit for understanding model usage.

    A rapidly depleted budget may result from high prices, but it can also come from long context, repeated input, excessive output, parallel processing, workflow loops, and unbounded retries. Separating these factors is the only way to identify the actual source of cost.

    For individual users, choosing an appropriate model, supplying only necessary material, and limiting response length can prevent substantial waste.

    For developers and businesses, the priority is a complete control system: estimate before calling, enforce limits during execution, reconcile usage afterward, and compare approaches by the total cost of acceptable results.

    When every request can be explained, every charge can be attributed, and every task has a budget boundary, an LLM becomes a predictable production tool rather than an opaque drain on account balance.