乐于分享
好东西不私藏

OpenClaw 进阶指南:从换模型到装 Skills,一次给你讲透

OpenClaw 进阶指南:从换模型到装 Skills,一次给你讲透

安装 OpenClaw 只是起点。

就像买了一台顶级相机却不调参数,真正让 OpenClaw 发挥威力的,是换模型装 Skills配工作流这三件事。

本文面向已安装 OpenClaw 的开发者,深入讲解进阶操作。没有废话,全是干货。


一、更换模型:20+ 种 Provider 随意切换

1.1 模型选择逻辑

OpenClaw 支持 provider/model 格式引用任何已配置模型,例如:

anthropic/claude-opus-4-6
openai/gpt-5.4
ollama/llama3.3
google/gemini-3-flash-preview

选择优先级:Primary 模型Fallback 列表Provider 认证切换

1.2 内置 Provider 一览

无需额外配置,只需提供 API Key 即可:

       
                                           
提供商Provider 名示例模型认证方式
OpenAIopenaigpt-5.4, gpt-5.4-proAPI Key
Anthropicanthropicclaude-opus-4-6, claude-sonnet-4-5API Key / Claude Code Token
Google Geminigooglegemini-3-flash-previewAPI Key
OpenRouteropenrouteropenrouter/anthropic/claude-sonnet-4-5API Key
Kilo Gatewaykilocodeclaude-opus-4.6, GPT-5.2API Key
Moonshot (Kimi)moonshotkimi-k2.5API Key
Z.AI (GLM)zaiglm-5API Key
xAI Grokxaigrok-2API Key
Mistralmistralmistral-largeAPI Key
Hugging Facehuggingfacedeepseek-ai/DeepSeek-R1API Key
       
     

国内开发者重点关注:MiniMax(minimax)、GLM(zai)、Moonshot/Kimi(moonshot)、火山引擎豆包(volcengine)均已原生支持,配好 Key 即可使用。

1.3 配置方法

方式一:引导配置(推荐新手)

openclaw onboard

向导会依次引导你选择 Provider、输入 API Key、设置默认模型。

方式二:直接修改配置文件

打开 ~/.openclaw/openclaw.json,添加或修改:

{
  agents: {
    defaults: {
      model: {
        primary: "anthropic/claude-opus-4-6",
        fallbacks: [
          "google/gemini-3-flash-preview",
          "openai/gpt-5.4"
        ]
      }
    }
  }
}

设置 API Key:

# 通过 onboard 向导设置
openclaw onboard --auth-choice anthropic

# 或直接设置环境变量

export
 ANTHROPIC_API_KEY="sk-ant-..."
export
 OPENAI_API_KEY="sk-..."
export
 GEMINI_API_KEY="..."

设置默认模型(CLI 快捷方式):

openclaw models set openai/gpt-5.4
openclaw models status

1.4 模型别名与白名单

{
  agents: {
    defaults: {
      models: {
        "anthropic/claude-opus-4-6": { alias: "Opus" },
        "anthropic/claude-sonnet-4-5": { alias: "Sonnet" },
        "openai/gpt-5.4": { alias: "GPT" }
      }
    }
  }
}

设置白名单后,用户只能使用列表中的模型:

{
  agents: {
    defaults: {
      models: {
        // 白名单之外的模型无法使用
      }
    }
  }
}

1.5 对话中即时切换模型

无需重启,直接在聊天窗口输入:

/model
/model list          # 查看所有可用模型
/model 3             # 选择第3个
/model openai/gpt-5.4
/model status        # 查看当前模型详情

二、接入本地模型:Ollama 完全指南

不想花钱?本地跑模型是零成本方案。

2.1 安装 Ollama

# macOS / Linux
curl -fsSL https://ollama.ai/install.sh | bash

# macOS 也可以用 Homebrew

brew install ollama/tap/ollama

2.2 拉取推荐模型

# 通义代码(coder 推荐)
ollama pull qwen2.5-coder:32b

# DeepSeek 推理(支持思维链)

ollama pull deepseek-r1:32b

# Llama 3.3(通用能力强)

ollama pull llama3.3

# Mistral(轻量高效)

ollama pull mistral

2.3 接入 OpenClaw

第一步:启动 Ollama

ollama serve

第二步:设置环境变量(任意值,Ollama 不强制校验):

export OLLAMA_API_KEY="ollama-local"

第三步:配置 OpenClaw

如果 Ollama 在本机运行,OpenClaw 会自动发现所有带工具调用能力的模型,无需手动配置。

直接使用:

{
  agents: {
    defaults: {
      model: { primary: "ollama/qwen2.5-coder:32b" }
    }
  }
}

2.4 远程 Ollama

Ollama 跑在其他机器上?手动指定地址:

{
  models: {
    providers: {
      ollama: {
        baseUrl: "http://192.168.1.100:11434",
        apiKey: "ollama-local",
        api: "ollama"
      }
    }
  },
  agents: {
    defaults: {
      model: { primary: "ollama/qwen2.5-coder:32b" }
    }
  }
}

⚠️ 重要:不要在 URL 后加 /v1,OpenClaw Ollama 集成使用原生 API(/api/chat),加 /v1 会导致工具调用失败。


三、Skills 系统:让 AI 能力无限扩展

3.1 什么是 Skills?

Skills 是 OpenClaw 的能力扩展包。每个 Skill 是一个文件夹,内含 SKILL.md 说明文档,定义 AI 如何调用某个工具或 API。

Skills 分三类:

       
                                           
类型位置说明
捆绑 SkillsOpenClaw 安装目录内置功能,不可修改
托管 Skills~/.openclaw/skills所有 Agent 共享
工作区 Skills<workspace>/skills单个 Agent 私有,优先级最高
       
     

3.2 ClawHub:Skills 的应用市场

安装 CLI:

npm i -g clawhub

常用命令:

# 搜索 Skills
clawhub search "weather"
clawhub search "web scraping"

# 安装 Skills(安装到当前目录 ./skills)

clawhub install weather
clawhub install <skill-slug>

# 更新所有已安装的 Skills

clawhub update --all

# 备份/同步本地 Skills 到 ClawHub

clawhub sync --all

# 发布自己的 Skills

clawhub publish ./my-skill --slug my-skill --name "My Skill" --version 1.0.0

安装到指定位置:

clawhub install weather --workdir /root/.openclaw

OpenClaw 会自动从 <workspace>/skills 加载,新 Session 生效。

3.3 从零创建一个 Skill

目录结构:

skills/my-calculator/
├── SKILL.md
└── README.md

SKILL.md 示例:

---
name: my-calculator
description: Perform mathematical calculations with high precision
---


# Calculator Skill


Use this skill when the user asks you to calculate something.

## Available Operations


-
 Addition, subtraction, multiplication, division
-
 Power, square root, logarithm
-
 Trigonometric functions (sin, cos, tan)

## Usage


Always use the `exec` tool to run calculations via `bc` or `python3`:

Addition:
\`\`\`bash
echo "scale=10; $a + $b" | bc -l
\`\`\`

Square root:
\`\`\`bash
echo "sqrt($n)" | bc -l
\`\`\`

3.4 Skill 高级配置

~/.openclaw/openclaw.json 中精细控制:

{
  skills: {
    entries: {
      "weather": { enabled: true },
      "summarize": { enabled: true },
      "some-skill": {
        enabled: true,
        apiKey: { source: "env", provider: "default", id: "API_KEY" },
        env: {
          API_KEY: "sk-..."
        },
        config: {
          endpoint: "https://api.example.com"
        }
      }
    },
    load: {
      watch: true,           // 监听文件变化,实时生效
      watchDebounceMs: 250
    }
  }
}

技能过滤(gating): 可以设置技能只在特定条件下加载:

---
name: mac-only-tool
metadata:
  {
    "openclaw":
      {
        "requires": { "os": ["darwin"], "bins": ["some-binary"] },
      },
  }
---

3.5 热门推荐 Skills

       
                                           
Skill功能来源
Weather天气预报ClawHub
Browser网页浏览、截图OpenClaw 内置
Summarize长文摘要ClawHub
PDFPDF 解析OpenClaw 内置
TTS文字转语音OpenClaw 内置
Firecrawl网页抓取OpenClaw 内置
       
     

浏览更多:https://clawhub.ai


四、个性化配置:打造专属 AI 助手

4.1 修改 System Prompt

OpenClaw 的灵魂由两个文件定义:

  • SOUL.md — 定义 AI 的人格、语气、价值观
  • AGENTS.md — 定义工作流程、工具使用规范

修改它们,AI 的行为就会改变:

# SOUL.md 示例
## Core Truths


**有自己的观点。**
 可以不同意,可以偏好,可以觉得某些事有趣或无聊。
**先行动,再提问。**
 遇到问题先尝试解决,实在卡住再问。
**私人信息保密。**
 用户的东西就是私人的,不对外分享。

4.2 多 Agent 配置

一台机器服务多个用户或团队:

{
  agents: {
    list: [
      {
        id: "dev-team",
        name: "开发团队助手",
        model: { primary: "anthropic/claude-opus-4-6" },
        workspace: "/home/team/agent",
        skills: { allow: ["coding", "git"] }
      },
      {
        id: "general",
        name: "通用助手",
        model: { primary: "openai/gpt-5.4" },
        workspace: "/home/public/agent"
      }
    ]
  }
}

4.3 沙箱安全隔离

当处理不可信输入时,开启沙箱:

{
  agents: {
    defaults: {
      sandbox: {
        mode: "non-main",
        scope: "agent",
        workspaceAccess: "ro",
        docker: {
          image: "openclaw-sandbox:bookworm-slim",
          memory: "1g",
          network: "none",
          capDrop: ["ALL"]
        }
      }
    }
  }
}

这意味着即使用户输入恶意指令,也无法突破容器边界。


五、日常运维:让 Gateway 持续稳定

5.1 常用 CLI 命令

# Gateway 管理
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
openclaw gateway status

# 模型管理

openclaw models list
openclaw models status
openclaw models set <provider/model>

# 插件管理

openclaw plugins list
openclaw plugins enable <plugin>
openclaw plugins disable <plugin>

# 查看日志

openclaw logs --tail 100
openclaw logs --level error

5.2 配置热重载

修改 openclaw.json 后无需重启:

openclaw gateway reload

5.3 资源监控

openclaw status

返回当前运行的 Agent 数量、内存占用、活跃会话数。


结语

OpenClaw 的乐趣,不在于装完即用,而在于持续调优的过程。

换更好的模型、装更合适的 Skills、定义更准确的人格——每一步都能感受到 AI 助手变得越来越懂你、越来越强。

唯一限制它的,是你愿意投入多少时间去配置。

现在,去试试换一个大模型,或者安装一个你需要的 Skill 吧。


相关资源:

  • • 📖 官方文档:https://docs.openclaw.ai
  • • 🛒 Skills 市场:https://clawhub.ai
  • • 💬 Discord 社区:https://discord.gg/clawd
  • • 🐙 GitHub:https://github.com/openclaw/openclaw

「工具本身没有极限,配置它的人才有。」