Skip to main content
Stream Tool Call is a unique feature of Z.ai’s latest model, allowing real-time access to reasoning processes, response content, and tool call information during tool invocation, providing better user experience and real-time feedback.

Features

Tool calling in the latest GLM-5 GLM-4.7 GLM-4.6 model now supports streaming output for responses. This allows developers to stream tool usage parameters without buffering or JSON validation when calling chat.completions, reducing call latency and providing better user experience.

Core Parameter Description

  • stream=True: Enable streaming output, must be set to True
  • tool_stream=True: Enable tool call streaming output
  • model: Use a model that supports tool calling, limited to glm-5

Response Parameter Description

The delta object in streaming responses contains the following fields:
  • reasoning_content: Text content of the model’s reasoning process
  • content: Text content of the model’s response
  • tool_calls: Tool call information, including function names and parameters

Code Examples

By setting the tool_stream=True parameter, you can enable streaming tool call functionality:
Install SDK
Verify Installation
Complete Example

Application Scenarios

Intelligent Customer Service

  • Real-time query progress display
  • Improved waiting experience

Code Assistant

  • Real-time code analysis process
  • Display tool call chains