How to verify AI API token charges: input, output, cache and multipliers
Reconcile AI API charges using input tokens, output tokens, cache fields and group multipliers. Includes a clearly hypothetical billing calculation.
This article was generated with AI from Xinghuo AI Gateway’s public billing guide. The publishing account is affiliated with the service operator. Xinghuo AI is an independent third-party service; current prices and permissions must be checked on its website.
A token total and a billed amount describe different parts of an AI API call. To reconcile them, identify the model and applicable price, separate the usage categories, and check whether any multiplier has already been applied.
Start with the unit, not the total
A price may be quoted per million tokens or with another unit. Input and output tokens can have different rates. Confirm the billing currency, price unit, selected model and account group before calculating an estimate.
For a simple request without special cache treatment, the estimate is input tokens divided by the price unit, multiplied by the input rate, plus the corresponding output calculation. Any additional rule has to come from the service’s current documentation.
A hypothetical calculation
Assume, purely for illustration, an input rate of CNY 10 per million tokens and an output rate of CNY 30 per million tokens. For 1,000 input tokens and 200 output tokens, the input estimate is CNY 0.010 and the output estimate is CNY 0.006, giving CNY 0.016 before any applicable additional rule.
These rates are invented teaching values, not a quotation or a current Xinghuo AI price. The example assumes no separate cache charges, no extra multiplier and no other adjustment. Always use the actual rates and rules for the request you are checking.
Keep cache categories from overlapping
Depending on the endpoint, usage can include cache reads, cache writes or other categories alongside input and output totals. Check whether a cache count is already included in another field. Adding all reported numbers together can count the same usage twice.
Do not assume that one provider’s usage structure or cache rate applies to every model exposed through a compatible API. A missing cache field also does not establish that caching occurred or that its price was zero.
Apply a multiplier once
An account group or channel may use a multiplier or other pricing adjustment. First determine whether the displayed unit price or charge already includes it. Multiplying a final billed amount again produces an incorrect comparison.
The account’s applicable configuration matters more than a historical screenshot. Keep the price and group information associated with the request time when investigating a discrepancy.
Keep a reproducible worksheet record
Our free Token Cost Worksheet separates uncached input, cached input and output, with explicit rate units and an account multiplier. Check whether cached tokens are included in the API input total, then enter mutually exclusive counts to avoid double counting. The worksheet calculates locally in your browser, requires no API key, makes no model request and exports a JSON record.
Amounts in the worksheet are labeled USD. Use rates and billing records in the same currency; the CNY teaching example above must not be copied as a USD quotation. Cache writes, other billable items and rounding rules still need separate verification against the current service rules. Example rates are hypothetical, not current Xinghuo prices. The calculator is free; API generation follows the account’s current billing rules.
Reconcile records for the same request
Use the request time, model ID and a redacted request identifier to find the matching usage record. Compare input, output, cache fields and the resulting charge within the same reporting window.
Streamed calls sometimes provide usage only in a final event. When usage is absent, record it as unavailable and consult the service record. Do not replace a missing value with zero merely to make the calculation complete.
Handle a timeout before retrying
A client timeout does not prove that the server stopped generating. Check whether usage or a completed result already exists before repeating a request. A second call can create another charge. Use documented idempotency features only where they are actually supported, and keep application retries bounded.
For the service-specific reference, see the English token billing guide and current model and channel catalog. Public integration examples are available in the English GitHub README.
About the author
- Sharing the frontier of AI, one practical breakthrough at a time. Explore Vibe Coding, natural-language programming, Windsurf, Cursor, Antigravity, Kiro, AI content creation, AI monetization strategies, and practical OpenClaw guides. Follow AI Frontier Navigator to discover powerful tools, workflows, and ideas—and stay ahead of the AI curve.
Comments
Join the discussionThis is a topic that can easily get confusing once AI APIs are used at scale. Token usage might seem like a small technical detail at first, but it can quickly become a major part of understanding and controlling API costs.
I especially like the practical focus on how tokens are counted and how billing is connected to actual usage. Having that visibility makes it much easier to estimate expenses, optimize prompts, and avoid unexpected costs.
A useful reminder that building with AI isn’t only about model performance—understanding the economics behind each request matters too.