Z.ai (Zhipu)
The GLM models with a permanent free tier.
Z.ai is Zhipu’s API, the lab behind GLM. The Flash line is the permanent free tier — glm-4.7-flash and glm-4.5-flash. GLM-5, GLM-5.2 and glm-4.7 bill per token. OpenAI-compatible at open.bigmodel.cn/api/paas/v4.
open.bigmodel.cn wants a Chinese phone number. The international portal at z.ai is email-only and a different account. Concurrency is per account and model, shown in the console. Flash chat goes to 200K.
- Free models
- 4
- Max context
- 200K
- Free tier
- GLM Flash models for free
- Requirement
- Phone verification, no card
Endpoint
Base URL
https://open.bigmodel.cn/api/paas/v4Env var
ZHIPU_API_KEYRate limit
Concurrency set per account in the console- OpenAI-compatible
- text
- image
- video
- reasoning
Code examples
npm install openaiimport OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://open.bigmodel.cn/api/paas/v4',
apiKey: process.env.ZHIPU_API_KEY
})
const response = await client.chat.completions.create({
model: 'glm-4.7-flash',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.choices[0].message.content)pip install openaiimport os
from openai import OpenAI
client = OpenAI(
base_url="https://open.bigmodel.cn/api/paas/v4",
api_key=os.environ["ZHIPU_API_KEY"],
)
response = client.chat.completions.create(
model="glm-4.7-flash",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.choices[0].message.content)curl https://open.bigmodel.cn/api/paas/v4/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ZHIPU_API_KEY" \
-d '{
"model": "glm-4.7-flash",
"messages": [{"role": "user", "content": "Explain closures in one paragraph."}]
}'Worth knowing
- The Flash models are the free ones (glm-4.7-flash, glm-4.5-flash). glm-4.7, glm-5 and glm-5.2 bill per token.
- open.bigmodel.cn wants a Chinese phone number. The international portal at z.ai is email-only.
Models you get for free4
- GLM 4.7 Flash
glm-4.7-flash - GLM 4.5 Flash
glm-4.5-flash - GLM 4.6 Flash
glm-4.6-flash - GLM 4 Flash
glm-4-flash