Skip to content

OpenClaw 接入 DeepSeek 大模型完整教程(2026 最新版)

2026年4月8日

OpenClaw 接入 DeepSeek 大模型完整教程(2026 最新版)

DeepSeek 已成为 OpenClaw 的一级公民。得益于社区版源码改造,现在无需繁琐配置 baseUrl,原生支持 DeepSeek-V3 / R1。这篇教程覆盖两种配置方法,帮你 2 分钟搞定。

为什么选 DeepSeek?

对比项DeepSeekGPT-4Claude
价格¥1/百万 tokens$10/百万 tokens$15/百万 tokens
上下文64K128K200K
中文能力⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
编程能力⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
国内访问✅ 直连❌ 需代理❌ 需代理

DeepSeek 优势:

  • 价格是 GPT-4 的 1/10
  • 国内可直接访问
  • 中文理解能力极强
  • 编程能力一流

Step 1:获取 DeepSeek API Key

注册账号

  1. 打开 platform.deepseek.com
  2. 点击【注册】
  3. 支持手机号、微信、邮箱注册

创建 API Key

  1. 登录后进入【API Keys】页面
  2. 点击【创建 API Key】
  3. 复制保存 Key(只显示一次)

格式示例:

sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

免费额度

新用户送 500 万 tokens,足够测试使用。

Step 2:配置 OpenClaw

OpenClaw CN 版原生支持 DeepSeek,有两种配置方式。

方法一:交互式向导(推荐新手)

运行配置向导:

bash
openclaw config wizard

按提示选择:

? 请选择要配置的模型提供商:
  ❯ DeepSeek    # 选择这一项

? 请输入 DeepSeek API Key:
  sk-xxxxxxxx   # 粘贴你的 Key

? 请选择默认模型:
  ❯ deepseek-chat        # 对话模型
    deepseek-reasoner    # 推理模型 R1

完成后自动保存配置。

方法二:手动修改配置文件

适合熟悉配置文件的用户。

找到配置文件:

bash
# Linux/Mac
~/.openclaw/openclaw.json

# Windows
C:\Users\用户名\.openclaw\openclaw.json

添加配置:

json
{
  "models": {
    "providers": {
      "deepseek": {
        "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "deepseek/deepseek-chat"
      }
    }
  }
}

模型选择:

模型用途价格
deepseek-chat日常对话、编程¥1/百万 tokens
deepseek-reasoner复杂推理(R1)¥4/百万 tokens

方法三:命令行直接配置

bash
# 设置 API Key
openclaw config set models.providers.deepseek.apiKey "sk-xxxxx"

# 设置默认模型
openclaw config set agents.defaults.model.primary "deepseek/deepseek-chat"

Step 3:验证配置

检查配置

bash
# 查看 API Key 是否设置成功
openclaw config get models.providers.deepseek.apiKey

# 查看默认模型
openclaw config get agents.defaults.model.primary

测试调用

bash
# 启动 OpenClaw
openclaw start

# 发送测试消息
# "请介绍一下你自己"

如果返回正常回复,说明配置成功。

DeepSeek 模型详解

deepseek-chat(V3)

适用场景:

  • 日常对话
  • 文本生成
  • 代码编写
  • 翻译润色

特点:

  • 速度快
  • 成本低
  • 中文能力强

deepseek-reasoner(R1)

适用场景:

  • 复杂推理
  • 数学问题
  • 逻辑分析
  • 深度思考

特点:

  • 推理能力强
  • 会展示思考过程
  • 成本较高

模型路由配置

根据任务复杂度自动选择模型:

json
{
  "modelRouting": {
    "simple": "deepseek/deepseek-chat",
    "complex": "deepseek/deepseek-reasoner",
    "code": "deepseek/deepseek-chat"
  }
}

常见问题排查

问题一:Unknown model 错误

症状:

Error: Unknown model: deepseek-chat

原因: 模型名称格式错误

解决:

OpenClaw 使用 提供商/模型名 格式:

json
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "deepseek/deepseek-chat"  // 正确
        // "primary": "deepseek-chat"  // 错误
      }
    }
  }
}

问题二:API Key 无效

症状:

Error: Invalid API key

解决:

  1. 检查 Key 是否完整复制
  2. 检查 Key 是否过期
  3. 去 DeepSeek 平台重新生成

问题三:请求超时

症状:

Error: Request timeout

解决:

  1. 检查网络连接
  2. 增加超时时间:
json
{
  "models": {
    "providers": {
      "deepseek": {
        "apiKey": "sk-xxxxx",
        "timeout": 60000
      }
    }
  }
}

问题四:余额不足

症状:

Error: Insufficient balance

解决:

去 DeepSeek 平台充值,最低 10 元起充。

成本优化建议

控制上下文长度

json
{
  "agents": {
    "defaults": {
      "context": {
        "maxMessages": 20
      }
    }
  }
}

启用缓存

json
{
  "cache": {
    "enabled": true,
    "ttl": 3600
  }
}

监控用量

bash
# 查看今日用量
openclaw stats --today

# 查看本月用量
openclaw stats --month

与其他模型对比

场景推荐原因
日常对话DeepSeek V3性价比最高
复杂推理DeepSeek R1推理能力强
英文任务GPT-4英文能力更强
超长上下文Claude支持 200K
本地离线Ollama完全免费

混合配置示例

同时使用多个模型:

json
{
  "models": {
    "providers": {
      "deepseek": {
        "apiKey": "sk-xxxxx"
      },
      "openai": {
        "apiKey": "sk-xxxxx"
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "deepseek/deepseek-chat",
        "fallback": "openai/gpt-4o"
      }
    }
  }
}

总结

步骤操作
1去 platform.deepseek.com 获取 API Key
2运行 openclaw config wizard 选择 DeepSeek
3粘贴 API Key,选择模型
4测试验证

关键点:

  • OpenClaw CN 原生支持 DeepSeek
  • 模型名格式:deepseek/deepseek-chat
  • 新用户有 500 万 tokens 免费额度

DeepSeek 是国内用户最推荐的模型选择:便宜、快速、中文能力强。配合 OpenClaw 的智能体能力,可以构建高性价比的 AI 助手。

不要孤军奋战啦!

加入微信群一起学习交流 AI

与大神一起使用 OpenClaw、Hermes、Claude Code、Seedance 2.0、GPT-Image-2 等

微信公众号

扫码关注微信公众号
私信 "加群",将自动获取微信群二维码

探索 AI 世界,掌握智能未来