This document describes how to call the Z.AI GLM model inference service on QwenCloud.
Service activation
- Go to the QwenCloud console, search for GLM, find the Z.AI direct-supply GLM model card, and click Activate Now.
- Confirm the activation and authorization in the dialog box.
Quick start
Prerequisites
- You must have activated QwenCloud and created an API Key.
- If calling via SDK, install the corresponding SDK.
enable_thinking parameter:
- Thinking mode (
enable_thinking: true, default): The model outputs a detailed reasoning process (reasoning_content). - Non-thinking mode (
enable_thinking: false): The model outputs the result directly, without a reasoning process.
- OpenAI compatible
- DashScope
enable_thinking is not a standard OpenAI parameter. The OpenAI Python SDK passes it via extra_body; the Node.js SDK passes it as a top-level parameter.- Python
- Node.js
Clear thinking history (clear_thinking)
The clear_thinking parameter controls whether the reasoning_content (thinking process) from previous turns is included as context input for the model in multi-turn conversations. Only GLM series models support this parameter.
true: Ignorereasoning_contentfrom previous turns. Only visible text, tool calls, and results are used as context, reducing context length and cost.false(default): Retainreasoning_contentfrom previous turns and pass it to the model as part of the context. To enable Preserved Thinking, you must pass the complete, unmodifiedreasoning_contentfrom previous turns in the original order. Missing, trimmed, rewritten, or reordered content may degrade effectiveness or prevent it from working.
This parameter only affects the thinking content from previous turns. It does not change whether the model generates or outputs thinking in the current turn.
reasoning_content in the assistant messages). When clear_thinking is set to true, the historical thinking content is excluded from context, resulting in fewer prompt_tokens compared to false (default). The actual difference depends on the length of the historical reasoning_content.
- OpenAI compatible
- Python
- curl
Other features
| Model | Multi-turn conversation | Function calling | Web search | Context caching | Reasoning effort control |
|---|---|---|---|---|---|
| ZHIPU/GLM-5.2 | ✓ | ✓ | ✓ (non-thinking mode only) | ✓ | ✓ (reasoning_effort) |
| ZHIPU/GLM-5.1 | ✓ | ✓ | ✓ (non-thinking mode only) | ✓ | ✗ |
| ZHIPU/GLM-5 | ✓ | ✓ | ✓ (non-thinking mode only) | ✓ | ✗ |
Parameter defaults
| Model | enable_thinking | temperature | top_p | top_k | repetition_penalty |
|---|---|---|---|---|---|
| ZHIPU/GLM-5.2 | true | 1.0 | 0.95 | — | — |
| ZHIPU/GLM-5.1 | true | 1.0 | 0.95 | 20 | 1.0 |
| ZHIPU/GLM-5 | true | 1.0 | 0.95 | 20 | 1.0 |
Model list and billing
ZHIPU/GLM-5.2, ZHIPU/GLM-5.1, and ZHIPU/GLM-5 are hybrid reasoning models supplied directly by Z.AI, suitable for intelligent interaction, enterprise applications, and development assistance.
For model context length and pricing, see the QwenCloud console.
Billing is based on the model's input and output tokens.
In thinking mode, the chain of thought is billed based on output tokens.