翻篇收录说明
翻篇网页快照

GLM-5 - Overview - Z.AI DEVELOPER DOCUMENT

https://docs.z.ai/guides/llm/glm-5

最近抓取:2026-12-03 18:20:42(北京时间)

最近内容变化:2026-12-03 18:20:42(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

正文摘录

Overview GLM-5 is Z.AI’s new-generation foundation model, designed for Agentic Engineering, capable of providing reliable productivity in complex system engineering and long-range Agent tasks. In terms of Coding and Agent capabilities, GLM-5 has achieved state-of-the-art (SOTA) performance in open source, with its usability in real programming scenarios approaching that of Claude Opus 4.5. PositioningFoundation ModelInput ModalitiesTextOutput ModalitieTextContext Length200KMaximum Output Tokens128K Capability Thinking ModeOffering multiple thinking modes for different scenariosStreaming OutputSupport real-time streaming responses to enhance user interaction experienceFunction CallPowerful tool invocation capabilities, enabling integration with various external toolsetsContext CachingIntelligent caching mechanism to optimize performance in long conversationsStructured OutputSupport for structured output formats like JSON, facilitating system integration Usage Agentic CodingIt can automatically generate runnable code based on natural language, covering development processes such as front-end, back-end, and data processing, significantly shortening the iteration cycle from requirements to products.Agent TaskCapable of autonomous decision-making and tool invocation, it can complete the full-process intelligent agent tasks from understanding, planning to execution and self-check under ambiguous and complex objectives, achieving “input from a single sentence to complete deliverables”.Work ScenarioWith strong long-range planning and memory capabilities, it can stably complete complex work tasks that span multiple stages, involve multiple steps, and have strong logical connections, ensuring instruction compliance and goal consistency.RoleplayIt can accurately understand and consistently maintain character settings, remain consistent in narrative, emotion, and logic, and achieve a natural, evolvable, and highly immersive role-playing experience.Script / Storyboard GenerationSignificantly enhanced in long text consistency and complex character development, it can stably output high-quality script content that can directly enter the production process.TranslationCapable of accurately converting formal texts into professional translations that conform to the expression habits of the target language, achieving full alignment of semantics, terminology, and expression.Text Data ExtractionIt can accurately extract key fields and logical relationships from complex texts such as contracts, announcements, and financial reports, stably convert the original content into analyzable Structured Data, and contribute to enterprise data governance and automation.Information Quality InspectionIt can accurately identify key information in complex texts such as customer service tickets and automatically complete quality inspection and risk identification, significantly improving Operational Efficiency. Introducing GLM-5 1Larger Foundation, Stronger IntelligenceThe brand-new GLM-5 foundation lays a solid groundwork for the capability evolution from “writing code” to “building entire projects”: Expanded Parameter Scale: Increased from 355B (32B activated) to 744B (40B activated), with pre-training data upgraded from 23T to 28.5T. Larger-scale pre-training computing power has significantly improved the model’s general intelligence. Asynchronous Reinforcement Learning: A new “Slime” framework has been developed to support larger model scales and more complex reinforcement learning tasks, enhancing the efficiency of post-training workflows. An asynchronous agent reinforcement learning algorithm is proposed, enabling the model to continuously learn from long-range interactions and fully unlock the potential of pre-trained models. Sparse Attention Mechanism: DeepSeek Sparse Attention is integrated for the first time, maintaining lossless long-text performance while drastically reducing model deployment costs and improving Token Efficiency. 2Coding Performance on Par with Claude Opus 4.5GLM-5 achieves performance alignment with Claude Opus 4.5 in software engineering tasks, reaching the highest scores among open-weight models across widely recognized industry benchmarks.On SWE-bench Verified and Terminal Bench 2.0, GLM-5 records leading open-model scores of 77.8 and 56.2, respectively — surpassing Gemini 3.0 Pro in overall performance.In internal evaluations aligned with the Claude Code task distribution, GLM-5 demonstrates substantial gains over GLM-4.7 across frontend development, backend systems engineering, and long-horizon execution tasks.The model can autonomously perform agentic long-range planning, backend refactoring, and deep debugging with minimal human intervention—delivering a development experience that approaches Opus 4.5 in both reliability and execution depth.3Agent Performance: SOTA-Level Long-Horizon ExecutionGLM-5 achieves state-of-the-art performance among open-weight models in agentic capability, ranking first across multiple authoritative benchmarks. On BrowseComp (web-scale retrieval and information synthesis), MCP-Atlas (tool invocation and multi-step task execution), and τ²-Bench (complex multi-tool planning and orchestration), GLM-5 delivers top open-model results across the board.These capabilities define the core of Agentic Engineering. A capable agent must go beyond generating code or completing isolated tasks — it must sustain goal alignment over long horizons, manage intermediate resources, coordinate tool usage, and resolve multi-step dependencies without losing coherence. Resources API Documentation: Learn how to call the API. Quick Start The following is a full sample code to help you onboard GLM-5 with ease. cURL Official Python SDK Official Java SDK OpenAI Python SDKBasic Callcurl -X POST "https://api.z.ai/api/paas/v4/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-api-key" \ -d '{ "model": "glm-5", "messages": [ { "role": "user", "content": "As a marketing expert, please create an attractive slogan for my product." }, { "role": "assistant", "content": "Sure, to craft a compelling slogan, please tell me more about your product." }, { "role": "user", "content": "Z.AI Open Platform" } ], "thinking": { "type": "enabled" }, "max_tokens": 4096, "temperature": 1.0 }' Streaming Callcurl -X POST "https://api.z.ai/api/paas/v4/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-api-key" \ -d '{ "model": "glm-5", "messages": [ { "role": "user", "content": "As a marketing expert, please create an attractive slogan for my product." }, { "role": "assistant", "content": "Sure, to craft a compelling slogan, please tell me more about your product." }, { "role": "user", "content": "Z.AI Open Platform" } ], "thinking": { "type": "enabled" }, "stream": true, "max_tokens": 4096, "temperature": 1.0 }' Install SDK# Install latest version pip install zai-sdk # Or specify version pip install zai-sdk==0.2.3 Verify Installationimport zai print(zai.__version__) Basic Callfrom zai import ZaiClient client = ZaiClient(api_key="your-api-key") # Your API Key response = client.chat.completions.create( model="glm-5", messages=[ { "role": "user", "content": "As a marketing expert, please create an attractive slogan for my product.", }, { "role": "assistant", "content": "Sure, to craft a compelling slogan, please tell me more about your product.", }, {"role": "user", "content": "Z.AI Open Platform"}, ], thinking={ "type": "enabled", }, max_tokens=4096, temperature=1.0, ) # Get complete response print(response.choices[0].message) Streaming Callfrom zai import ZaiClient client = ZaiClient(api_key="your-api-key") # Your API Key response = client.chat.completions.create( model="glm-5", messages=[ { "role": "user", "content": "As a marketing expert, please create an attractive slogan for my product.", }, { "role": "assistant", "content": "Sure, to craft a compelling slogan, please tell me more about your product.", }, {"role": "user", "content": "Z.AI Open Platform"}, ], thinking={ "type": "enabled", # Optional: "disabled" or "enabled", default is "enabled" }, stream=True, max_tokens=4096, temperature=0.6, ) # Stream response for chunk in response: if chunk.choices[0].delta.reasoning_content: print(chunk.choices[0].delta.reasoning_content, end="", flush=True) if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True) Install SDKMaven<dependency> <groupId>ai.z.openapi</groupId> <artifactId>zai-sdk</artifactId> <version>0.3.5</version> </dependency> Gradle (Groovy)implementation 'ai.z.openapi:zai-sdk:0.3.5' Basic Callimport ai.z.openapi.ZaiClient; import ai.z.openapi.service.model.ChatCompletionCreateParams; import ai.z.openapi.service.model.ChatCompletionResponse; import ai.z.openapi.service.model.ChatMessage; import ai.z.openapi.service.model.ChatMessageRole; import ai.z.openapi.service.model.ChatThinking; import java.util.Arrays; public class BasicChat { public static void main(String[] args) { // Initialize client ZaiClient client = ZaiClient.builder().ofZAI().apiKey("your-api-key").build(); // Create chat completion request ChatCompletionCreateParams request = ChatCompletionCreateParams.builder() .model("glm-5") .messages( Arrays.asList( ChatMessage.builder() .role(ChatMessageRole.USER.value()) .content( "As a marketing expert, please create an attractive slogan for my product.") .build(), ChatMessage.builder() .role(ChatMessageRole.ASSISTANT.value()) .content( "Sure, to craft a compelling slogan, please tell me more about your product.") .build(), ChatMessage.builder() .role(ChatMessageRole.USER.value()) .content("Z.AI Open Platform") .build())) .thinking(ChatThinking.builder().type("enabled").build()) .maxTokens(4096) .temperature(1.0f) .build(); // Send request ChatCompletionResponse response = client.chat().createChatCompletion(request); // Get response if (response.isSuccess()) { Object reply = response.getData().getChoices().get(0).