Skip to content

Z.AI

Z.AI 是 GLM 模型的 API 平台。它为 GLM 提供 REST API,并使用 API 密鑰 進行身份驗證。請在 Z.AI 控制台中建立您的 API 金鑰。OpenClaw 使用 zai 提供者 搭配 Z.AI API 金鑰。

  • 提供者: zai
  • 驗證: ZAI_API_KEY
  • API:Z.AI Chat Completions (Bearer auth)

最適合: 大多數使用者。OpenClaw 會從金鑰偵測對應的 Z.AI 端點,並自動套用正確的基底 URL。

  1. 執行入門導覽

    Terminal window
    openclaw onboard --auth-choice zai-api-key
  2. 設定預設模型

    {
    env: { ZAI_API_KEY: "sk-..." },
    agents: { defaults: { model: { primary: "zai/glm-5.1" } } },
    }
  3. 驗證模型已列出

    Terminal window
    openclaw models list --all --provider zai

OpenClaw 在插件清單中附帶了捆綁的 zai 提供者目錄,因此唯讀 列表可以在不載入提供者執行時的情況下顯示已知的 GLM 列:

Terminal window
openclaw models list --all --provider zai

目前基於清單的目錄包括:

模型參考備註
zai/glm-5.1預設模型
zai/glm-5
zai/glm-5-turbo
zai/glm-5v-turbo
zai/glm-4.7
zai/glm-4.7-flash
zai/glm-4.7-flashx
zai/glm-4.6
zai/glm-4.6v
zai/glm-4.5
zai/glm-4.5-air
zai/glm-4.5-flash
zai/glm-4.5v
Forward-resolving unknown GLM-5 models

未知的 glm-5* ID 仍然會在內建的提供者路徑上進行轉發解析,方法是當 ID 符合當前 GLM-5 系列形狀時,從 glm-4.7 模板綜合提供者擁有的元資料。

Tool-call streaming

針對 Z.AI 工具呼叫串流,預設已啟用 tool_stream。若要停用它:

{
agents: {
defaults: {
models: {
"zai/

”: { params: { tool_stream: false }, }, }, }, }, } ```

Thinking and preserved thinking

Z.AI 思考功能遵循 OpenClaw 的 /think 控制。當思考功能關閉時,OpenClaw 會發送 thinking: { type: "disabled" },以避免在可見文字之前將輸出預算花費在 reasoning_content 上。

保留思考是選用功能,因為 Z.AI 需要重新播放完整的歷史 reasoning_content,這會增加提示詞 Token。請針對每個模型啟用它:

{
agents: {
defaults: {
models: {
"zai/glm-5.1": {
params: { preserveThinking: true },
},
},
},
},
}

當啟用且思考開啟時,OpenClaw 會發送 thinking: { type: "enabled", clear_thinking: false } 並為相同的 OpenAI 相容記錄重新播放先前的 reasoning_content

進階使用者仍然可以使用 params.extra_body.thinking 覆寫確切的提供者負載。

Image understanding

內建的 Z.AI 外掛程式會註冊圖像理解功能。

PropertyValue
Modelglm-4.6v

圖像理解功能會從設定的 Z.AI 驗證資訊自動解析 — 不需要 額外的設定。

Auth details
  • Z.AI 使用您的 API 金鑰進行 Bearer 驗證。
  • zai-api-key 入門選項會根據金鑰前綴自動偵測相符的 Z.AI 端點。
  • 當您想要強制使用特定的 API 時,請使用明確的區域選項(zai-coding-globalzai-coding-cnzai-globalzai-cn)。
GLM model family

GLM 模型系列概覽。

Model selection

選擇提供者、模型參照和容錯移轉行為。