Z.ai (Zhipu)
Z.ai 是智譜 Zhipu 的 API,也就是 GLM 背後的實驗室。Flash 線是永久免費檔 —— glm-4.7-flash 和 glm-4.5-flash。GLM-5、GLM-5.2 和 glm-4.7 按 token 計費。OpenAI 相容網址 open.bigmodel.cn/api/paas/v4。
Z.ai 是智譜 Zhipu 的 API,也就是 GLM 背後的實驗室。Flash 線是永久免費檔 —— glm-4.7-flash 和 glm-4.5-flash。GLM-5、GLM-5.2 和 glm-4.7 按 token 計費。OpenAI 相容網址 open.bigmodel.cn/api/paas/v4。
open.bigmodel.cn 要中國大陸手機號碼。z.ai 上的國際入口只用電子郵件,且是另一個帳號。並行按帳號和模型設定,在主控台裡展示。Flash 對話最高 200K。
- 免費模型
- 4
- 最大上下文
- 200K
- 免費額度
- GLM Flash 系列免費
- 註冊要求
- 手機號碼驗證,不要卡
端點
基底網址
https://open.bigmodel.cn/api/paas/v4環境變數
ZHIPU_API_KEY速率限制
Concurrency set per account in the console- OpenAI 相容
- 文字
- 影像
- 視訊
- 推理
程式碼範例
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."}]
}'值得注意
- 免費的是 Flash 系列(glm-4.7-flash、glm-4.5-flash)。glm-4.7、glm-5 和 glm-5.2 按 token 計費。
- open.bigmodel.cn 要中國大陸手機號碼。z.ai 的國際入口只用電子郵件。
你能免費使用的模型4
- 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