Models
GLM-5.2
Zhipu AI's latest flagship model designed for long-horizon tasks, capable of autonomous work for up to 8 hours in a single session.
Overview
GLM-5.2 is Zhipu AI's latest flagship model, designed specifically for Long Horizon Tasks. It can independently and continuously work for up to 8 hours in a single task, autonomously planning, executing, and self-evolving to deliver complete engineering-grade results.
Key Specifications
| Parameter | Value |
|---|---|
| Context Window | 200K tokens |
| Max Output | 131K tokens |
| Input Modalities | Text |
| Output Modalities | Text |
Capabilities
- Text Generation — State-of-the-art reasoning and generation
- Code Generation — Strong multi-language programming capabilities
- Function Calling — Structured tool use for API integrations
- JSON Mode — Guaranteed valid JSON output
- Thinking Mode — Deep reasoning for complex problem-solving
- Streaming — Server-sent events for real-time delivery
- Web Search — Integrated search for up-to-date information
- Agent — Autonomous task planning and execution
Pricing
| Type | Price |
|---|---|
| Input | $1.12 / 1M tokens |
| Output | $3.52 / 1M tokens |
| Cache Read | $0.208 / 1M tokens |
Usage Example
from openai import OpenAI
client = OpenAI(
api_key="sk-...",
base_url="https://api.yolorouter.com/v1",
)
response = client.chat.completions.create(
model="glm-5.2",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)Best Practices
- Ideal for complex multi-step agent tasks, autonomous coding, and long-running engineering projects
- Enable thinking mode for complex reasoning tasks
- Use context caching for repeated prompts to reduce cost