Z.ai documents GLM-4.6 API calls using the model ID glm-4.6 and a chat-completions request. For the standard API, the documented endpoint is https://api.z.ai/api/paas/v4/chat/completions, with Bearer-token authentication. Use a standard API key for this route. (Z.AI’s GLM-4.6 migration guide)
Make a first GLM-4.6 API request
Create a standard Z.ai API key and set it in your shell as ZAI_API_KEY. Then send a message:
curl --request POST \
--url 'https://api.z.ai/api/paas/v4/chat/completions' \
--header "Authorization: Bearer $ZAI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "glm-4.6",
"messages": [
{"role": "user", "content": "Give me a one-sentence introduction to GLM-4.6."}
]
}'
In the successful JSON response, read the generated text at choices[0].message.content. That field path appears in Z.AI’s Chat Completion API reference; its response example illustrates the general chat-completions schema. Keep the API key in an environment variable or secret manager, not in source code or a client-side app. (GLM-4.6 migration guide)
GLM-4.6 limits and optional features
Z.ai lists GLM-4.6 as text-input and text-output, with a 200K-token context and 128K maximum output. These are the model limits in Z.ai’s documentation; size requests to fit the context limit, including both input and generated output. (GLM-4.6 model documentation)
Deep thinking is enabled by default for GLM-4.6, which can automatically decide whether to think. Z.ai’s migration guide shows thinking: {"type": "enabled"} as an explicit setting for complex reasoning or coding tasks. (Deep Thinking guide; GLM-4.6 migration guide)
For streamed text output, set stream=true and handle delta.reasoning_content and delta.content. For streamed tool-call output, Z.ai says to enable both stream=true and tool_stream=true; tool-call arguments arrive in delta.tool_calls[*].function.arguments. See the GLM-4.6 migration guide and the stream tool guide. Streaming and tool calls require additional response handling beyond the basic request above.
GLM-4.6 API pricing
Z.ai’s pricing table states that prices are in USD and labels its model-rate columns as input, cached input, cached-input storage, and output. Its GLM-4.6 row lists: (Z.AI pricing)
| Token or storage type | Listed price |
|---|---|
| Input | $0.60 / 1M tokens |
| Cached input | $0.11 / 1M tokens |
| Cached-input storage | Limited-time free |
| Output | $2.20 / 1M tokens |
The “Limited-time Free” label applies to cached-input storage, not the cached-input token rate. Using the listed input and output rates, 1 million uncached input tokens plus 100,000 output tokens gives an illustrative estimate of $0.82: $0.60 + (0.1 × $2.20). This calculation excludes any other charges and does not establish how the rates apply to every account or API route. Check the current pricing page and your account terms before budgeting production use. (Z.AI pricing)
Before routing production traffic
- Confirm the route and key type. The standard API uses the
/api/paas/v4endpoint and a standard API key.Z.aisays Coding Plan users should configure that plan’s dedicated endpoint; do not assume the standard endpoint or key applies to it. (Z.AIQuick Start) - Check quotas and rate limits. The cited documentation does not state a numeric production rate limit. Confirm the limits and account terms for your route before launch.
- Test your workload. Check prompt size, output length, latency, and any streaming or tool-call flow your application depends on.
Z.ai’s migration guide recommends use-case testing and regression checks. (GLM-4.6 migration guide) - Protect credentials and handle failures. Keep API keys server-side and add application-appropriate timeouts and error handling before exposing the integration to users.
For a basic hosted integration, send a Bearer-authenticated chat-completions request to Z.ai’s standard API endpoint with model: "glm-4.6". Before production, confirm your route’s current pricing, account terms, and operational limits.
Sources
Migrate to GLM-4.6 — Z.AI Developer Documentation
Chat Completion — Z.AI Developer Documentation
GLM-4.6 — Z.AI Developer Documentation
Deep Thinking — Z.AI Developer Documentation
Stream Tool Call — Z.AI Developer Documentation
