官方给 GLM-5.2 的标准接入配置:模型名 glm-5.2、1M 上下文 / 128K 最大输出、thinking.type: enabled + reasoning_effort: max、temperature: 1.0,可直接复制 curl / Python 示例完成首次调用,并了解官方认定的典型使用场景。
适合的任务:首次接入 GLM-5.2 API;项目级代码库整体理解与改造;长时程(long-horizon)任务;从需求到可部署产品的完整开发流程;研究复现(论文→可运行工程);微信小程序迁移、小游戏开发、端上调试闭环、Code-to-Video 循环等官方示例场景。
不适合的任务:需要视觉/多模态输入的任务(GLM-5.2 仅支持文本输入、文本输出);官方未开放 json_schema 严格结构化输出的场景(见迁移指南)。
适用的模型版本:GLM-5.2(API 模型 ID glm-5.2;GLM Coding Plan 中为 GLM-5.2,Claude Code 中可用 GLM-5.2[1m] 启用 1M 上下文)。
适用的客户端、Agent 或 API:Z.ai 官方 API(https://api.z.ai/api/paas/v4/chat/completions,OpenAI 兼容协议);官方 Python/Java SDK、OpenAI Python SDK;GLM Coding Plan(ZCode、Claude Code、OpenCode 等)。
推荐的推理档位和参数:thinking: {"type": "enabled"}(思考默认开启);reasoning_effort 支持 high / max(默认 max,编码任务官方推荐 max);temperature 默认 1.0、top_p 默认 0.95;max_tokens 最大 128K;上下文最大 1M。
| 项目 | 值 |
|---|---|
| 定位 | 旗舰基础模型(flagship foundation model) |
| 输入模态 | 文本 |
| 输出模态 | 文本 |
| 上下文长度 | 1M tokens |
| 最大输出 | 128K tokens |
| 能力 | Thinking Mode、流式输出、Function Call、上下文缓存、结构化输出(JSON)、MCP |
项目级代码库整体接管:一次放入整个项目让模型理解
长时程重构:让模型端到端跑真实工程任务
生产级标准压力测试:检验模型在硬工程约束下是否守得住
移动端设备上调试闭环:从代码实现到设备验证
微信小程序开发:从 Web 应用迁移到小程序
小游戏开发:从玩法规则到可玩闭环
研究复现:从论文和数据到可运行的工程项目
Code-to-Video 循环:从自然语言创意到可演示视频
curl -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.2",
"messages": [
{
"role": "system",
"content": "You are a senior full-stack software engineer, proficient in frontend development, backend architecture design, and modern web technology stacks."
},
{
"role": "user",
"content": "Design and build a personal blog website for me, including a homepage, article list page, and article detail page, using React + Node.js technology stack."
}
],
"thinking": {
"type": "enabled"
},
"reasoning_effort": "max",
"max_tokens": 4096,
"temperature": 1.0
}'curl -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.2",
"messages": [
{
"role": "system",
"content": "You are a senior full-stack software engineer, proficient in frontend development, backend architecture design, and modern web technology stacks."
},
{
"role": "user",
"content": "Design and build a personal blog website for me, including a homepage, article list page, and article detail page, using React + Node.js technology stack."
}
],
"thinking": {
"type": "enabled"
},
"reasoning_effort": "max",
"stream": true,
"max_tokens": 4096,
"temperature": 1.0
}'"Solid 1M context":1M 上下文经过编码 Agent 场景专门训练(大规模实现、自动化研究、性能优化、复杂调试),不是只"能接更多 token"。
在 FrontierSWE、PostTrainBench、SWE-Marathon 上均为排名最高的开源模型;FrontierSWE 仅落后 Claude Opus 4.8 约 1%。
标准编码基准:Terminal-Bench 2.1 为 81.0(GLM-5.1 为 63.5,官方文档页写 62.0),SWE-bench Pro 为 62.1(GLM-5.1 为 58.4),与 Opus 4.8(85.0)差距缩小,领先 Gemini 3.1 Pro。
发布前已提前开放给 GLM Coding Plan 用户,开发者反馈集中在:更强的项目级上下文承载、更稳定的长任务执行、更好的工程规范遵守、更强的客户端与移动端工程能力。
本页为官方自述能力与配置,跑分数字是厂商口径;独立第三方验证见测评目录(NIST CAISI、Arena.ai 等)。
文档中 Terminal-Bench 2.1 分数一处写 81.0 vs 62.0、另一处写 81.0 vs 63.5(GLM-5.1),官方博客为 81.0 vs 63.5,以博客为准。
GLM-5.2