GLM (Z.ai) Commands & Prompt Reference
23 commands & parameters · 3 categories · Source: Z.AI API Reference
Z.ai's GLM family is controlled through the /paas/v4 API: chat completions take the sampling, tool, and format parameters listed here, image generation takes prompt, quality, and size, and model IDs like glm-5.3 and glm-5-turbo select capability against cost. Every entry on this page comes from the official Z.AI API reference.
Two parameters shape output character the most: do_sample toggles sampling strategy entirely, and reasoning_effort raises or lowers how much thinking the model performs when thinking mode is enabled. For deterministic pipelines, disabling sampling makes temperature and top_p irrelevant - the reference notes both are ignored in that case.
All Commands
Chat API Parameters (15)
| Command / Syntax | What it does | Notes |
|---|---|---|
| model | The model code to be called | GLM-5.3, GLM-5.2, GLM-5.1, GLM-5-Turbo are the latest flagship model series, foundational models specifically designed for agent applications. |
| messages | The current conversation message list as the model’s prompt input, provided in JSON array format, e.g.,`{“role”:... | Possible message types include system messages, user messages, assistant mess |
| do_sample | When do_sample is true, sampling strategy is enabled; when do_sample is false, sampling strategy parameters such as... | Default value is `true`. |
| stream | This parameter should be set to false or omitted when using synchronous call | It indicates that the model returns all content at once after generating all content. |
| reasoning_effort | Controls the model's reasoning effort level, takes effect when `thinking` is enabled | Default is `max`, supported by `GLM-5.2` and above. |
| temperature | Sampling temperature, controls the randomness of the output, must be a positive number within the range: `[0.0, 1.0]` | The GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series default value is `1.0`, GLM-4.5 series |
| top_p | Another method of temperature sampling, value range is: `[0.01, 1.0]` | The GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6, GLM-4.5 series default value is `0.95`, GLM-4-32B-0414-128K default value is `0.9`. |
| max_tokens | The maximum number of tokens for model output, the GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series... | JSON body field (integer) of POST /paas/v4/chat/completions. |
| tool_stream | Whether to enable streaming response for Function Calls | Default value is false. |
| tools | A list of tools the model may call | Currently, only functions are supported as a tool. |
| tool_choice | Controls how the model selects a tool | JSON body field (field) of POST /paas/v4/chat/completions. |
| stop | Stop word list | Generation stops when the model encounters any specified string. |
| response_format | Specifies the response format of the model | Defaults to text. |
| request_id | Passed by the user side, needs to be unique; used to distinguish each request, 6–64 characters | If not provided by the user side, the platform will generate one by default. |
| user_id | Unique ID for the end user, 6–128 characters | Avoid using sensitive information. |
Image Generation Parameters (5)
| Command / Syntax | What it does | Notes |
|---|---|---|
| model | Model code | JSON body field of the image generation endpoint. |
| prompt | The text description of the image to be generated | JSON body field of the image generation endpoint. |
| quality | The quality of the generated image | `glm-image` default is `hd`, others model is `standard`. |
| size | Image size | `glm-image` recommended enum values: `1280x1280` (default), `1568x1056`, `1056x1568`, `1472x1088`, `1088x1472`, `1728x960`, `960x1728`. |
| user_id | Unique ID of the end user, helping the platform intervene in illegal activities, inappropriate content generation,... | ID length: 6 to 128 characters. |
Model & Mode Tokens (3)
| Command / Syntax | What it does | Notes |
|---|---|---|
| glm-5.3 | Latest flagship GLM model ID | Set as the model field value in chat completions. |
| glm-5-turbo | Faster, lower-cost GLM model ID | Set as the model field value in chat completions. |
| reasoning_effort: "high" | Raise the reasoning effort level when thinking is enabled | Values control how much reasoning the model performs before answering. |
Frequently Asked Questions
Which GLM model ID should I use?
glm-5.3 is the latest flagship listed in the reference; glm-5-turbo trades some capability for speed and cost. Set the ID as the model field value.
What does do_sample do?
When true, sampling strategy is enabled and temperature and top_p apply. When false, sampling is disabled and those parameters are ignored.
Does the same API handle images?
Image generation is a separate endpoint with its own parameters (prompt, quality, size, model) - listed in the Image Generation Parameters table on this page.
Every entry on this page is a literal, typeable token taken from the official documentation linked above. Command sets in AI tools change quickly - the in-product command menu is always authoritative for your installed version.