GLM API Errors: Why the Request Fails and How to Fix It

A wrong model id, an overflowing 128K context, the key, the balance, limits: the typical causes of GLM API errors and a quick way to find yours.

5 min · · errors · API keys

A request to GLM returned an error or simply "does not work": what to do? Most often the cause is one of five: a typo in the model id, a wrong address, the key, the balance, or an overflowing context. Below is a breakdown by response code, a separate section on the 128K context limit, which for GLM is smaller than for most catalog models, and a short script that finds the cause in a minute. All examples are for glm-5.3 and glm-5.3-flash through the gateway.

Look at the response code first

Do not treat the error text as the only source: wording may change while the code stays. For GLM through the gateway these codes apply:

CodeMeaningWhat to do
401Wrong or deleted keyCheck the fetch_... key and the Authorization: Bearer header
402Not enough balanceTop up the balance
403 model_not_allowed_for_keyThe model is not in the key's allowed listAdd the model in the key settings
404 model_not_foundUnknown model nameCompare the id with the GET /v1/models list
413Request too largeShorten the input
429The key's daily or monthly limit is exhausted (key_daily_limit_reached, key_monthly_limit_reached), or a limit at the providerRaise the limit or wait
503Provider unavailable or model disabled (model_disabled)Retry later or choose another model

Below are the most common cases in order.

A wrong model id (404)

The most common cause. The correct ids in the catalog as of October 18, 2026 are glm-5.3 and glm-5.3-flash. Typical typos:

  • GLM-5.3 or glm-5.3-Flash with capital letters;
  • glm5.3, glm-5-3, glm_5.3 with a missing or replaced dot and hyphen;
  • a name from someone else's documentation or an old example: model versions change, and old ids may be retired.

One request fixes it: get the current list and use the id from there.

bash
curl -s https://api.zukko.pro/v1/models \
  -H "Authorization: Bearer $ZUKKO_API_KEY" | python3 -c "
import json, sys
for m in json.load(sys.stdin)['data']:
    if 'glm' in m['id']:
        print(m['id'])
"

If a model is not in the list, you cannot call it by that id: pick another one from the list. And when the model is in the list but returns 503 with model_disabled, it has been switched off temporarily: switch to another one, see error 503 model_disabled.

A wrong address (404 or another unexpected response)

For the OpenAI SDK the address must end in /v1:

bash
from openai import OpenAI

client = OpenAI(base_url="https://api.zukko.pro/v1", api_key="fetch_...")

If you set https://api.zukko.pro without /v1, the SDK sends the request to a path without the prefix and you get a 404 that is easy to mistake for a model problem. The rule: clients on the OpenAI SDK use the address with /v1, while Claude Code and the official Anthropic SDK use it without. Details: Base URL with /v1 or without.

The key and permissions (401, 403)

  • 401: the key was copied with a space or line break, an empty environment variable was passed instead of the key, or the key was deleted in the dashboard. Print the length of the variable and the first fetch_ characters without logging the whole key.
  • 403 model_not_allowed_for_key: the key has an allowed-model list and GLM is not in it. Open the key settings in the Zukko dashboard and add the model, or use another key. See the article on 403 model_not_allowed_for_key.

Balance and limits (402, 429)

402 means the balance is insufficient. 429 comes in two kinds: the daily or monthly limit of this particular key is exhausted (the response body will contain key_daily_limit_reached or key_monthly_limit_reached), or the limit is at the model provider. Zukko has no general rate limit of its own. In the first case wait for the reset or raise the key limit; in the second a retry with a delay helps.

Overflowing the 128K context

glm-5.3 and glm-5.3-flash have a 128K-token context, whereas Claude, GPT, Qwen and DeepSeek in the catalog have 1M. This means a dialogue history or document that fits another model comfortably can hit the limit on GLM. The error arrives as a 413 or as a provider message about exceeding context length; the text may differ, so rely on the code and on usage. The general situation is analyzed in the article on context_length_exceeded.

What to do:

  1. Measure the input: watch usage.prompt_tokens in successful responses and track its growth.
  2. Trim history: system prompt plus the latest messages, and condense the rest into a brief summary.
  3. Split documents into parts.
  4. For genuinely long inputs, switch to a model with a 1M context.

Prices as of October 18, 2026, $ per 1M tokens. An input of 120,000 tokens (nearly a full GLM window):

  • glm-5.3 (0.1 / 0.1): 120,000 × 0.1 / 1M = $0.012;
  • glm-5.3-flash (0.04 / 0.04): 120,000 × 0.04 / 1M = $0.0048;
  • for comparison deepseek-v4.1-flash (0.013 input): 120,000 × 0.013 / 1M = about $0.0016 and a 1M context.

GLM's output costs the same per token as its input, so a long answer adds noticeably to the bill: limit max_tokens. The cache price for GLM equals the input price, so there is no discount for a repeated prefix.

A one-minute diagnostic script

The script checks in order: the key, the model's presence in the list, a test request.

bash
import os
import sys
from openai import OpenAI
import openai

MODEL = sys.argv[1] if len(sys.argv) > 1 else "glm-5.3-flash"
key = os.environ.get("ZUKKO_API_KEY", "")
print("key set:", bool(key), "| start:", key[:6], "| length:", len(key))

client = OpenAI(base_url="https://api.zukko.pro/v1", api_key=key, max_retries=0, timeout=30)

try:
    ids = [m.id for m in client.models.list().data]
except openai.APIStatusError as e:

Run: python3 diag.py glm-5.3. The output shows where the chain breaks: no key, a wrong address, the model missing from the list, or a problem in the request itself.

Service status and "GLM is not working"

If the previous steps pass but requests fail with 503 or a timeout, the problem is on the model provider's side. Check whether other models respond on the same key: if they do, GLM specifically is unavailable. Then switch temporarily to a fallback model from the GET /v1/models list, and retry with increasing delay. Check the provider's own status on its website.

FAQ

Why does GLM return 404 when the key is correct?

Either the model id is wrong, or the address in an OpenAI SDK client has no /v1. Check both with the script above.

Do I need a separate key for GLM?

No. One fetch_... key covers all catalog models. If the key has an allowed-model list, add GLM to it.

Can I increase GLM's context?

No, it is a model property: 128K. For long inputs choose a model with a 1M context.

How do I avoid unexpected 429s?

Set reasonable limits on the key and monitor spending through the "Usage" section in the dashboard.

If the error does not go away, create a new key in the Zukko dashboard and run the diagnostic script again: it quickly separates key problems from request problems.

zukko

Pay 25×
less

for Claude Code & ChatGPT

One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.

Get API keyDocumentation

api.zukko.pro · fetch_*

GLM API error: why it fails and how to fix it · Zukko