Skip to content

OpenClaw 通过 OpenAI 兼容 API 接入 DeepSeek,支持 V4 Flash/Pro 及 V3 模型。配置 API Key 后可用 openclaw onboard --auth-choice deepseek-api-key 快速设置,默认模型为 deepseek/deepseek-v4-flash。V4 模型支持 thinking 控制,OpenClaw 自动处理 reasoning_content 回放以保证多轮 tool use 正常运作。使用 /think xhigh/think max 可请求最大推理努力。

OpenClaw 接入 DeepSeek:API Key 配置与模型选择

DeepSeek 提供强大的 AI 模型,采用 OpenAI 兼容 API。

属性
提供商deepseek
认证方式DEEPSEEK_API_KEY
API 类型OpenAI 兼容
基础 URLhttps://api.deepseek.com

快速开始

  1. 获取 API Key
    platform.deepseek.com/api_keys 创建 API Key。

  2. 运行交互式引导

    bash
    openclaw onboard --auth-choice deepseek-api-key

    输入 API Key 后,默认模型设为 deepseek/deepseek-v4-flash

  3. 验证模型是否可用

    bash
    openclaw models list --provider deepseek

    如需查看静态内置模型列表(无需启动 Gateway),使用:

    bash
    openclaw models list --all --provider deepseek

非交互式设置

用于脚本或无人值守安装,直接传入所有参数:

bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice deepseek-api-key \
  --deepseek-api-key "$DEEPSEEK_API_KEY" \
  --skip-health \
  --accept-risk

WARNING

如果 Gateway 以守护进程(launchd/systemd)方式运行,请确保 DEEPSEEK_API_KEY 对该进程可用(例如,在 ~/.openclaw/.env 中或通过 env.shellEnv 设置)。

内置模型

模型 ref名称输入上下文最大输出说明
deepseek/deepseek-v4-flashDeepSeek V4 Flashtext1,000,000384,000默认模型;支持 thinking 的 V4 表面
deepseek/deepseek-v4-proDeepSeek V4 Protext1,000,000384,000支持 thinking 的 V4 表面
deepseek/deepseek-chatDeepSeek Chattext131,0728,192DeepSeek V3.2 非思考表面
deepseek/deepseek-reasonerDeepSeek Reasonertext131,07265,536启用推理的 V3.2 表面

TIP

V4 模型支持 DeepSeek 的 thinking 控制。OpenClaw 在后续回合中自动回放 DeepSeek 的 reasoning_content,使得包含 tool call 的 thinking 会话可以继续。
使用 /think xhigh/think max 请求 DeepSeek V4 模型的最大 reasoning_effort

Thinking 与工具调用

DeepSeek V4 的 thinking 会话有一个比大多数 OpenAI 兼容提供商更严格的回放契约:在启用 thinking 的回合中使用工具后,DeepSeek 要求在后续请求中包含该回合助手消息的 reasoning_content。OpenClaw 在 DeepSeek 插件内部处理此逻辑,因此 deepseek/deepseek-v4-flashdeepseek/deepseek-v4-pro 的多轮工具调用可正常工作。

如果从其他 OpenAI 兼容提供商切换到 DeepSeek V4 模型,已有的助手工具调用回合可能没有原生的 reasoning_content。OpenClaw 会在回放这些消息时自动填充缺失字段,使得 DeepSeek V4 能够接受历史记录,无需调用 /new

当在 OpenClaw 中禁用 thinking(包括 UI 中选择 None),OpenClaw 会发送 thinking: { type: "disabled" },并从发送的历史记录中移除 reasoning_content。这样,禁用 thinking 的会话就走非思考 DeepSeek 路径。

  • 使用 deepseek/deepseek-v4-flash 作为默认快速路径。
  • 使用 deepseek/deepseek-v4-pro 获得更强模型,但接受更高成本或延迟。

实时测试

直接实时模型测试套件包含 DeepSeek V4 现代模型。仅运行 DeepSeek V4 直接模型检查:

bash
OPENCLAW_LIVE_PROVIDERS=deepseek \
OPENCLAW_LIVE_MODELS="deepseek/deepseek-v4-flash,deepseek/deepseek-v4-pro" \
pnpm test:live src/agents/models.profiles.live.test.ts

该实时检查验证两个 V4 模型能否完成对话,以及 thinking/tool 后续回合是否保留了 DeepSeek 所需的回放载荷。

配置示例

json5
{
  env: { DEEPSEEK_API_KEY: "sk-..." },
  agents: {
    defaults: {
      model: { primary: "deepseek/deepseek-v4-flash" },
    },
  },
}

相关文档

常见问题

OpenClaw 中 DeepSeek 的默认模型是什么?

默认模型是 deepseek/deepseek-v4-flash(DeepSeek V4 Flash)。运行 openclaw onboard --auth-choice deepseek-api-key 后自动设置。你也可以在配置中更改 agents.defaults.model.primary

DeepSeek V4 和 V3 模型有什么区别?

V4 模型(Flash/Pro)支持 thinking 控制、更大的上下文(1M token)和更大的输出(384K token)。V3 模型(chat/reasoner)上下文较小(128K),推理模型(reasoner)带链式思考。V4 在 thinking 会话中需要 OpenClaw 的 reasoning_content 回放机制才能正常使用工具。

如何在 thinking 禁用时使用 DeepSeek V4?

在 OpenClaw UI 中将 thinking 设置为 None,或通过配置禁用 thinking。OpenClaw 会自动发送 thinking: { type: "disabled" } 并移除历史中的 reasoning_content,使 V4 模型以非思考模式运行。