A forecast that counts only the visible prompt will underestimate an agent's bill. GLM 5.3 API pricing must account for repeated conversation history, cached input, generated tokens, and retries. This article provides a calculator formula and examples you can reproduce in a spreadsheet or script.
The direct rates below come from Z.ai's official pricing page, reviewed November 13, 2026. The calculator is an illustrative budgeting method, not an invoice simulator or a live provider quotation. GLM5 credit billing is a separate schedule.
GLM 5.3 API pricing inputs
Use three token counts per request: fresh input, input actually billed as a cache hit, and output. Z.ai lists $1.40, $0.26, and $4.40 per million tokens respectively. Record separately billed tools and any applicable cache creation charge outside the simple formula.
| Example | Fresh input | Cached input | Output | Token-only cost |
|---|---|---|---|---|
| Short explanation | 10,000 | 0 | 2,000 | $0.0228 |
| Long-context analysis | 100,000 | 0 | 10,000 | $0.1840 |
| Cached-context analysis | 20,000 | 80,000 | 10,000 | $0.0928 |
| Output-heavy job | 20,000 | 80,000 | 50,000 | $0.2688 |
The last two rows share an input budget. The larger output changes the bill substantially, which is why GLM 5.3 API pricing cannot be summarized by the input rate alone.
Copy the calculator
from decimal import Decimal
def token_cost(fresh_input, cached_input, output):
values = (fresh_input, cached_input, output)
if any(not isinstance(n, int) or n < 0 for n in values):
raise ValueError("Token counts must be non-negative integers")
return (
Decimal(fresh_input) * Decimal("1.40")
+ Decimal(cached_input) * Decimal("0.26")
+ Decimal(output) * Decimal("4.40")
) / Decimal(1_000_000)
print(token_cost(20_000, 80_000, 10_000)) # 0.0928
In a spreadsheet with counts in A2, B2, and C2, use (A2*1.4+B2*0.26+C2*4.4)/1000000. Keep rates in separate cells for a reusable workbook. Updating a provider quote should not require rewriting every task formula.
Avoid double-counting cached tokens
Some usage responses report total input with cached tokens as a subset. If your endpoint uses that structure, fresh input equals total input minus cached input. Do not add the full input total and its cached subset as two independent input volumes.
Inspect the endpoint's usage schema before importing records. Store raw responses or a minimal audit record so the conversion can be checked later. If the provider omits cache usage, do not silently assume that the entire reusable prefix was billed at the discounted rate.
Add retries and tools to the task total
For each task, sum every request and separately billed operation. A timeout at the client does not prove that the upstream generated zero tokens. Use the service's settlement and refund records to establish the actual charge.
For GLM 5.3 API pricing, an illustrative three-attempt task at $0.0928 per attempt costs $0.2784 before tools, even if only the final answer is shown to the user. Track accepted-task cost alongside request cost so a prompt change that increases retries is visible.
Read GLM5's billing behavior if you are building on GLM5. Its public model catalog uses credit rates; substitute those units in a separate calculator rather than labeling direct Z.ai dollar results as GLM5 charges.
Plan monthly scenarios
Estimate request counts by task category instead of using one universal average. Multiply each category's observed token mix by its expected volume, then include a high-output scenario. Keep actual observed cache shares separate from an optimistic best case.
A budget control should stop or defer work before the balance is exhausted. Set a maximum output where appropriate, preserve task state, and decide whether to ask the user before a costly retry. An aggressive cap that repeatedly truncates useful output can increase total spend, so tune it against completion rates.
FAQ
Does this page contain a live interactive calculator?
No. It provides a copyable Python calculator, a spreadsheet formula, and worked examples. Rates are a dated snapshot, so check the original schedule before budgeting.
Is reasoning free?
Do not assume it is. Check how your endpoint reports and bills generated tokens, including reasoning, and reconcile with the usage record.
Where should I start integration?
Use the API documentation, confirm a current model ID, and send one bounded request. GLM 5.3 API pricing becomes predictable when you calculate from actual usage rather than prompt length alone. Review GLM5 plans if that is your chosen service.
Sources
- Z.ai official API pricing
- GLM 5.3 model documentation
- GLM5 API model IDs and credit rates
- GLM Coding Plan allowances and multipliers
Source review: November 13, 2026. Prices and allowances are snapshots. Calculations in this article are illustrative, not measured production bills. GLM5 is the publisher of this article and a separate service from Z.ai.



