The GLM API is not an "unlimited monthly subscription" product. It bills by actual usage. Many teams look at their first bill and wonder why the cost is higher than expected when the request count is low. The cause is usually not the unit rate. It is overly long input, uncontrolled output, cache misses, or a failed request that regenerated the same content on retry.

This article does not list specific unit prices, because prices change with the model, context tier, and promotions. It explains the billing structure, where cost comes from, how to estimate and reduce it, and ends with an actionable control checklist. For current prices, use the model pricing page and Zhipu's official pricing page.

Note: Zhipu, GLM, and BigModel are trademarks of their respective owners. This article is for technical explanation only and implies no affiliation, agency, or endorsement relationship with Zhipu. Billing rules and prices may change; check the official documentation and billing page before placing orders.

1. The basic billing unit

Text models use tokens as the basic unit. Zhipu's official documentation gives a rule of thumb of roughly 1 token per 1.6 Chinese characters, but the actual count depends on the tokenizer and the text, and the usage returned by the API is authoritative. In other words, estimates are for budgeting only and cannot replace the bill.

Not every model bills by token. Image generation, video generation, speech synthesis, voice cloning, real-time audio and video, and knowledge-base parsing may bill per call, per minute, per character, or per page. When building a multimodal product, confirm the billing unit before discussing the unit rate.

2. Why input and output are priced separately

A request usually contains input tokens and output tokens, priced separately, with output generally more expensive. Long-context models may also tier input by length, for example with a boundary at 32K, above which a higher tier applies. Some models also tier by output length. This means the unit cost of "the same model" can differ across usage patterns.

The main cost driver is not the number of requests but the context carried by each request. Stuffing an entire knowledge base, the full conversation history, and dozens of tool definitions into the prompt makes input grow quickly. The more common waste is output: without a maximum output length, the model keeps talking and the bill follows.

Cost item Billing basis Common trigger Control
Input tokens Input not covered by cache Long prompts, multi-turn history, tool definitions Trim context, summarize
Output tokens Generated content Long-form writing, code generation Set a maximum output length
Cache hits Discounted rate for matched portions Fixed system prompts, knowledge-base prefixes Keep the prefix stable
Long-context tier Unit rate changes above a threshold Long documents, codebase analysis Split, summarize, load on demand
Retries and failures Partially generated output may be billed Timeouts, stream interruptions, duplicate submission Idempotency, backoff, deduplication
Multimodal and tools Per call, minute, page, and so on Image generation, speech, search, parsing Cost separately, limit calls

3. Cache hits: saving on repeated prefixes

Zhipu provides context caching, and the official documentation mainly describes implicit caching: the system automatically recognizes repeated content without manual cache markers. It suits scenarios built around "fixed system prompt plus fixed knowledge base plus a changing question."

To improve the hit rate, at least three conditions must hold. The repeated prefix must be long enough; the official recommendation is 500 tokens or more. The prefix must be identical, and even one extra space can cause a miss. Caching is generated asynchronously, so waiting briefly after the first request before sending later ones works better. You can inspect hits through usage.prompt_tokens_details.cached_tokens.

Caching is not universal. Short prompts, content that changes every time, and frequently updated knowledge bases are unlikely to hit. Whether cache storage is billed separately and how large the discount is depend on the official pricing page. Treat caching as an optimization, not as a default assumption in the cost model.

4. Long context, batch, and multimodal

Long context is useful, but it is also where budgets are most easily exceeded. When processing contracts, papers, or codebases, ask three questions first. Does everything really need to go in at once? Can retrieval come before assembly? Can the work be split into chunks and summarized afterward? Many tasks can be completed with "retrieval plus summarization" at a much lower cost than inserting the entire corpus.

For batch work, look at the Batch interface. The official documentation states that supported models usually receive a discount through the Batch interface, which suits offline labeling, bulk summarization, data cleaning, and other scenarios that do not require real-time responses. The trade-off is higher latency and more complex orchestration, which fits teams with queues and result validation in place.

Multimodal capabilities need separate accounting. Image generation is billed per image, while image understanding usually bills by token. Speech synthesis is billed by character or minute, and knowledge-base parsing by page. Mixing these costs into a text budget will almost certainly make the month-end reconciliation fail.

5. Retries, stream interruptions, and hidden costs

Failed requests are not necessarily free. If the server has already generated part of the content before timing out, that usage may still be billed. When a streaming connection breaks, the generated portion may also appear on the bill. Retry policies therefore need restraint: retry only rate limits, 5xx, and network timeouts, use exponential backoff, and set a maximum attempt count.

Another hidden cost is duplicate submission. Users clicking a button repeatedly, frontends automatically resending after a timeout, and queues consuming the same message twice all produce extra requests. Idempotency with a request ID, or deduplication at the gateway layer, is far more effective than reconciling afterward.

Engineering cost also counts: logging, monitoring, evaluation, and human review. Model invocation fees are only part of total cost. Do not spend several times the labor on manual fixes just to save a little on calls.

6. How to estimate a monthly budget

Estimation has four steps: count monthly calls, estimate average input and output, estimate the cache hit rate, and apply current unit rates. If you want to manage balances and usage across several models in one place, you can register with the ZSQH AI Gateway and view them together. Specific prices still come from the model pricing page. The code below is only a calculation framework; read current prices from the official pricing page and fill them in.

# Budget model: all rates are placeholders. Replace them with current official prices.
monthly_calls = 300_000
avg_input_tokens = 1_200
avg_output_tokens = 300
cache_hit_rate = 0.35
input_rate = 0.0       # Input rate from the official pricing page
output_rate = 0.0      # Output rate
cache_rate = 0.0       # Cache-hit rate

uncached_input = avg_input_tokens * (1 - cache_hit_rate)
cached_input = avg_input_tokens * cache_hit_rate
per_call = (
    uncached_input * input_rate
    + cached_input * cache_rate
    + avg_output_tokens * output_rate
)
print(f"Estimated monthly cost: {monthly_calls * per_call:.2f}")

Leave headroom in the estimate. Real input in a new business is often longer than designed, and retries and failures add usage. Run at low traffic for two weeks, replace assumptions with real usage data, and then set the budget.

7. Budget control checklist

  1. Set an independent spending cap for every environment and service.
  2. Set a maximum output length and timeout for every request.
  3. Keep system prompt order fixed to improve the cache hit rate.
  4. Retrieve and summarize long documents before deciding whether to use long context.
  5. Retry only retryable errors, with backoff and an attempt limit.
  6. Review usage daily and the bill weekly; investigate abnormal growth immediately.
  7. Prefer Batch for offline jobs and online interfaces for real-time work.

8. FAQ

1. How much does the GLM API cost?

Prices change with the model, context tier, and promotions, so this article does not list fixed numbers. Check the model pricing page or Zhipu's official pricing page, and treat the console bill as authoritative.

2. How are cache hits billed?

The cached portion is billed at a discounted rate, while uncached input is billed at the standard input rate. The exact discount and storage fees depend on the official pricing page, and hit volume can be read from the usage field.

3. Are failed requests charged?

It depends on the failure stage. If part of the content was already generated, it may be billed by actual usage. Parameter errors and authentication failures usually do not incur generation charges. The billing detail is authoritative.

4. Is long context always more expensive?

Usually yes. Many models tier by input length, and the unit rate rises above a threshold. If splitting or retrieval can solve the task, there is no need to force long context.

5. How can I reduce current costs quickly?

Start with three things: cap the maximum output length, compress the system prompt, and improve the cache hit rate. These usually take effect faster and are more controllable than switching models.