There is no single universal GLM API setup: the endpoint, credential and model ID depend on whether you use Z.ai’s standard Model API, its GLM Coding Plan or a third-party service. For a direct standard API call, Z.ai’s quick start shows a Standard API Key, the https://api.z.ai/api/paas/v4/chat/completions endpoint and the glm-5.3 model ID. Choose a model based on documented limits and features—not an unsupported performance ranking. (Z.ai Quick Start)
Choose your GLM API access route
Z.ai standard Model API
To use Z.ai’s standard API, create a Standard API Key in the Z.ai Open Platform. Send a chat-completions request to https://api.z.ai/api/paas/v4/chat/completions with bearer-token authentication. Z.ai’s quick start provides cURL and Python examples using glm-5.3, as well as Java SDK and OpenAI SDK options. These instructions describe the standard Model API, not the Coding Plan. (Z.ai Quick Start)
Keep the key out of client-side code and avoid hard-coding your real key. Z.ai recommends setting the key as an environment variable. (Z.ai Python SDK guide)
Z.ai GLM Coding Plan
The GLM Coding Plan uses separately managed credentials: Z.ai says Individual Plan, Team Plan and standard Model API keys are not interchangeable. Its quick start lists dedicated base URLs for OpenAI Chat Completions, OpenAI Responses and Anthropic Messages protocols. Use the key and endpoint that match your plan and integration; do not substitute the standard Model API endpoint. (GLM Coding Plan Quick Start)
There is also a GLM-5.3-specific protocol condition: Z.ai says users who previously subscribed to a GLM Coding Plan, including users whose subscription expired, can currently access the model API only through the OpenAI Chat Completion-compatible protocol. This restriction is stated on the GLM-5.3 documentation page; do not assume it applies identically to every model or account category. (GLM-5.3 documentation)
Third-party APIs and wrappers
A provider or wrapper gives you that service’s integration, not a universal Z.ai API configuration. For example, Together AI documents its own GLM-5.2 endpoint, model ID and bearer-key setup. Puter documents a JavaScript route using puter.ai.chat(..., { model: "z-ai/glm-5.3" }). The endpoint, credentials and model identifier in one service’s example should not be reused with another service. (Together AI GLM-5.2; Puter.js GLM tutorial)
Practical trade-off: use the standard API for direct Z.ai HTTP or SDK calls with a standard key. Use the Coding Plan with its dedicated credentials and endpoint. Choose a third-party route if its own integration, account terms and billing suit your application.
GLM-5.3 vs. GLM-5 vs. GLM-4.6
| Model | Documented details | Consider it when |
|---|---|---|
GLM-5.3 (glm-5.3) |
Z.ai documents text-only input, a 1M-token context window and up to 128K output tokens. Reasoning is always enabled; reasoning_effort accepts low, high and max, with max as the default. |
You need the largest documented context among these three base text models, or need to select a reasoning-effort level. Requests cannot disable reasoning. |
GLM-5 (glm-5) |
Z.ai documents text input, a 200K context window and up to 128K output tokens. Its model overview also lists thinking modes, streaming and function calling. |
Your request fits its documented context and its listed capabilities suit your integration. |
GLM-4.6 (glm-4.6) |
Z.ai documents text input, a 200K context window and up to 128K output tokens. |
You specifically need this version. The cited overview does not establish that it is better or cheaper than GLM-5. |
For GLM-5.3, Z.ai documents thinking.type as enabled; disabling reasoning is not supported. The accepted reasoning_effort values are low, high and max, with max as the default. For migration from a request that disabled thinking, Z.ai says to set thinking.type to enabled and reasoning_effort to low before switching the model ID to glm-5.3; otherwise, the request will fail. (GLM-5.3 documentation; GLM-5.3 migration guide)
The base GLM-4.6 model is listed as text-only. If you need image or other multimodal input, check the exact model variant and its provider documentation instead of assuming the base model supports it. Availability and compatible protocols can vary by API product. (GLM-4.6 documentation)
Make your first direct GLM API call
For the examples below, you need a Z.ai account, a Standard API Key, and either curl or Python 3.8 or higher. Z.ai’s standard quick start documents the endpoint, bearer header, glm-5.3 model ID, request body and Python response extraction. Set the key in an environment variable rather than placing the real key in a command or source file. (Z.ai Quick Start; Z.ai Python SDK guide)
export ZAI_API_KEY="your-standard-api-key"
curl -X POST "https://api.z.ai/api/paas/v4/chat/completions" \
-H "Authorization: Bearer $ZAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.3",
"messages": [
{"role": "user", "content": "Summarize what an API does in one sentence."}
]
}'
Z.ai’s Python quick start installs the zai-sdk package, imports ZaiClient from zai, initializes it with an API key, calls chat completions using glm-5.3, and reads the returned text from response.choices[0].message.content. (Z.ai Quick Start)
pip install zai-sdk
from zai import ZaiClient
client = ZaiClient(api_key="YOUR_API_KEY")
response = client.chat.completions.create(
model="glm-5.3",
messages=[
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Summarize what an API does in one sentence."},
],
)
print(response.choices[0].message.content)
Replace the placeholder with your Standard API Key; for real applications, follow Z.ai’s guidance to keep credentials in an environment variable rather than hard-coding the key. If you are using a Coding Plan key instead, configure the plan’s dedicated endpoint and protocol rather than running these standard-API examples. The keys are not interchangeable. (Z.ai Python SDK guide; GLM Coding Plan Quick Start)
Common integration checks
- Authentication errors: confirm that the key type matches the endpoint and API product you selected. Standard API and Coding Plan keys are separate. (GLM Coding Plan Quick Start)
- Model errors: use the exact model ID supported by your chosen route. Third-party services may use a different ID format from
Z.ai. (Z.aiQuick Start) - GLM-5.3 reasoning errors: reasoning cannot be disabled. Use
enabledforthinking.type; if settingreasoning_effort, uselow,highormax. (GLM-5.3 documentation) - Coding Plan protocol errors: for GLM-5.3, users with a previous Coding Plan subscription—including an expired one—are currently limited to the OpenAI Chat Completion-compatible protocol for model API access. Confirm the protocol applicable to your account and plan. (GLM-5.3 documentation)
- Streaming or tool calls: consult the relevant model and API reference for protocol-specific parameters; the basic example above is a non-streaming text request. (GLM-5.3 migration guide)
Keep provider, API product, key type, base URL, protocol and exact model ID together as one configuration. That is the key to avoiding mismatched credentials, endpoints and model names.
Sources
Z.AI Developer Documentation: Quick Start
Z.AI Developer Documentation: API Introduction
Z.AI Developer Documentation: GLM Coding Plan Quick Start
Z.AI Developer Documentation: Official Python SDK
Z.AI Developer Documentation: GLM-5.3
Z.AI Developer Documentation: Migrate to GLM-5.3
Z.AI Developer Documentation: GLM-5
