Skip to content

Commit 80fa126

Browse files
committed
add Z AI provider
1 parent 009fe0b commit 80fa126

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed

docs/providers/zai.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
sidebar_label: Z AI
3+
description: Configure Z.ai's GLM-4.5 AI models in Roo Code. Access cutting-edge open-source language models with dual regional support and competitive pricing.
4+
keywords:
5+
- z ai
6+
- zai
7+
- zhipu ai
8+
- glm-4.5
9+
- roo code
10+
- api provider
11+
- chinese ai
12+
- language models
13+
- open source ai
14+
- mixture of experts
15+
image: /img/social-share.jpg
16+
---
17+
18+
# Using Z AI With Roo Code
19+
20+
Z.ai (formerly Zhipu AI) is a leading Chinese AI company that develops cutting-edge foundation models. Their GLM-4.5 series represents breakthrough technology in open-source AI, featuring Mixture of Experts (MoE) architecture with native agent capabilities and exceptional performance across reasoning, coding, and intelligent agent tasks.
21+
22+
**Website:** [https://z.ai/](https://z.ai/)
23+
24+
---
25+
26+
## Getting an API Key
27+
28+
Z.ai provides two regional endpoints to serve users globally:
29+
30+
### International Users
31+
1. **Access Z.ai Platform:** Visit [https://chat.z.ai/](https://chat.z.ai/)
32+
2. **Register/Sign In:** Create an account or sign in to the platform
33+
3. **Navigate to API:** Access the API section to generate your key
34+
4. **Copy the Key:** **Important:** Copy and securely store your API key immediately
35+
36+
### China Users
37+
1. **Access Zhipu Platform:** Visit [https://open.bigmodel.cn/dev/api](https://open.bigmodel.cn/dev/api)
38+
2. **Register/Sign In:** Create an account on the Zhipu AI Open Platform
39+
3. **Generate API Key:** Create a new API key in the developer console
40+
4. **Copy the Key:** **Important:** Store your API key securely for future use
41+
42+
---
43+
44+
## Supported Models
45+
46+
Roo Code supports the complete GLM-4.5 series:
47+
48+
### GLM-4.5 Series
49+
* `glm-4.5` (Default) - Advanced reasoning and coding with 355B total parameters (32B active)
50+
* `glm-4.5-air` - Efficient model with 106B total parameters (12B active)
51+
52+
### Model Features
53+
All GLM-4.5 models include:
54+
- **Context Window:** 131,072 tokens
55+
- **Max Output:** 98,304 tokens
56+
- **Prompt Caching:** Supported with significant cost savings
57+
- **Agent Capabilities:** Native reasoning, planning, and tool usage
58+
- **Hybrid Reasoning:** Both thinking and non-thinking modes
59+
- **Multi-Token Prediction:** Up to 8x faster inference
60+
61+
### Pricing
62+
Z.ai offers industry-leading competitive pricing:
63+
- **Input tokens:** From $0.11 per million tokens
64+
- **Output tokens:** From $0.28 per million tokens
65+
- **Cache reads:** Significant discounts on cached content
66+
67+
---
68+
69+
## Regional Configuration
70+
71+
Z.ai automatically selects the optimal endpoint based on your configuration:
72+
73+
### International Endpoint
74+
- **Base URL:** `https://api.z.ai/api/paas/v4`
75+
- **Models:** International pricing tier
76+
- **Recommended for:** Users outside mainland China
77+
78+
### China Endpoint
79+
- **Base URL:** `https://open.bigmodel.cn/api/paas/v4`
80+
- **Models:** Mainland China pricing tier
81+
- **Recommended for:** Users in mainland China
82+
83+
---
84+
85+
## Configuration in Roo Code
86+
87+
1. **Open Roo Code Settings:** Click the gear icon (<Codicon name="gear" />) in the Roo Code panel.
88+
2. **Select Provider:** Choose "Z AI" from the "API Provider" dropdown.
89+
3. **Choose Endpoint:** Select your Z AI entrypoint:
90+
- **api.z.ai** for international users
91+
- **open.bigmodel.cn** for China users
92+
4. **Enter API Key:** Paste your Z AI API key into the "Z AI API Key" field.
93+
5. **Select Model:** Choose your desired GLM-4.5 model from the dropdown.
94+
95+
---
96+
97+
## Advanced Features
98+
99+
### Agent-Native Capabilities
100+
GLM-4.5 models feature built-in agent capabilities:
101+
- **Multi-step reasoning:** Complex problem decomposition and planning
102+
- **Tool integration:** Native API and function calling support
103+
- **Workflow management:** End-to-end task execution
104+
- **Data visualization:** Complex chart and diagram generation
105+
106+
### Performance Optimizations
107+
- **Speculative Decoding:** Up to 8x faster inference speeds
108+
- **Multi-Token Prediction:** Generate 100+ tokens per second
109+
- **Mixture of Experts:** Efficient parameter utilization
110+
- **Hardware Efficiency:** Optimized for both cloud and edge deployment
111+
112+
---
113+
114+
## Example Usage
115+
116+
Here's a sample API call structure as referenced in the [Z.ai documentation](https://docs.z.ai/guides/overview/quick-start):
117+
118+
```bash
119+
curl -X POST "https://api.z.ai/api/paas/v4/chat/completions" \
120+
-H "Content-Type: application/json" \
121+
-H "Authorization: Bearer YOUR_API_KEY" \
122+
-d '{
123+
"model": "glm-4.5",
124+
"messages": [
125+
{
126+
"role": "system",
127+
"content": "You are a helpful AI assistant."
128+
},
129+
{
130+
"role": "user",
131+
"content": "Hello, please introduce yourself."
132+
}
133+
],
134+
"temperature": 0.7,
135+
"top_p": 0.8
136+
}'
137+
```
138+
139+
**Note:** Roo Code handles all API communication automatically once configured.

0 commit comments

Comments
 (0)