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 / SyntaxWhat it doesNotes
modelThe model code to be calledGLM-5.3, GLM-5.2, GLM-5.1, GLM-5-Turbo are the latest flagship model series, foundational models specifically designed for agent applications.
messagesThe 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_sampleWhen do_sample is true, sampling strategy is enabled; when do_sample is false, sampling strategy parameters such as...Default value is `true`.
streamThis parameter should be set to false or omitted when using synchronous callIt indicates that the model returns all content at once after generating all content.
reasoning_effortControls the model's reasoning effort level, takes effect when `thinking` is enabledDefault is `max`, supported by `GLM-5.2` and above.
temperatureSampling 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_pAnother 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_tokensThe 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_streamWhether to enable streaming response for Function CallsDefault value is false.
toolsA list of tools the model may callCurrently, only functions are supported as a tool.
tool_choiceControls how the model selects a toolJSON body field (field) of POST /paas/v4/chat/completions.
stopStop word listGeneration stops when the model encounters any specified string.
response_formatSpecifies the response format of the modelDefaults to text.
request_idPassed by the user side, needs to be unique; used to distinguish each request, 6–64 charactersIf not provided by the user side, the platform will generate one by default.
user_idUnique ID for the end user, 6–128 charactersAvoid using sensitive information.

Image Generation Parameters (5)

Command / SyntaxWhat it doesNotes
modelModel codeJSON body field of the image generation endpoint.
promptThe text description of the image to be generatedJSON body field of the image generation endpoint.
qualityThe quality of the generated image`glm-image` default is `hd`, others model is `standard`.
sizeImage size`glm-image` recommended enum values: `1280x1280` (default), `1568x1056`, `1056x1568`, `1472x1088`, `1088x1472`, `1728x960`, `960x1728`.
user_idUnique 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 / SyntaxWhat it doesNotes
glm-5.3Latest flagship GLM model IDSet as the model field value in chat completions.
glm-5-turboFaster, lower-cost GLM model IDSet as the model field value in chat completions.
reasoning_effort: "high"Raise the reasoning effort level when thinking is enabledValues 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.