Skip to content

通过 DeepInfra 统一 API,OpenClaw 可调用多种开源和前沿模型,无需管理多个 API Key。CLI 命令 openclaw onboard --deepinfra-api-key <key> 或设置环境变量 DEEPINFRA_API_KEY 即可完成配置,默认聊天模型为 deepinfra/deepseek-ai/DeepSeek-V3.2,同时支持图像生成、媒体理解、语音转文字、文字转语音、视频生成和记忆嵌入。

OpenClaw 配置 DeepInfra API 接入教程

DeepInfra 提供 统一 API,将所有主流开源模型和前沿模型路由到同一个端点和一个 API Key 下。它兼容 OpenAI SDK,只需更换基础 URL 即可在 OpenClaw 中使用。

获取 DeepInfra API Key

  1. 访问 https://deepinfra.com/
  2. 登录或注册账号
  3. 进入 Dashboard / Keys,生成一个新 Key 或使用自动创建的 Key

CLI 一键配置(推荐)

bash
openclaw onboard --deepinfra-api-key <key>

或者设置环境变量:

bash
export DEEPINFRA_API_KEY="<your-deepinfra-api-key>" # pragma: allowlist secret

配置文件集成

在 OpenClaw 配置文件中添加以下片段:

json5
{
  env: { DEEPINFRA_API_KEY: "<your-deepinfra-api-key>" }, // pragma: allowlist secret
  agents: {
    defaults: {
      model: { primary: "deepinfra/deepseek-ai/DeepSeek-V3.2" },
    },
  },
}

OpenClaw 支持的功能表面

内置插件注册了所有匹配当前 OpenClaw 提供商合约的 DeepInfra 表面:

表面默认模型OpenClaw 配置/工具
聊天 / 模型提供者deepseek-ai/DeepSeek-V3.2agents.defaults.model
图像生成/编辑black-forest-labs/FLUX-1-schnellimage_generate, agents.defaults.imageGenerationModel
媒体理解图片:moonshotai/Kimi-K2.5入站图片理解
语音转文字openai/whisper-large-v3-turbo入站音频转写
文字转语音hexgrad/Kokoro-82Mmessages.tts.provider: "deepinfra"
视频生成Pixverse/Pixverse-T2Vvideo_generate, agents.defaults.videoGenerationModel
记忆嵌入BAAI/bge-m3agents.defaults.memorySearch.provider: "deepinfra"

DeepInfra 也提供重排序、分类、物体检测等原生模型类型。OpenClaw 当前没有这些类别的一流提供商合约,因此插件目前不注册它们。

可用的模型列表

OpenClaw 启动时会动态发现可用的 DeepInfra 模型。使用 /models deepinfra 命令查看完整列表。

任何在 DeepInfra.com 上可用的模型都可以使用 deepinfra/ 前缀调用:

deepinfra/MiniMaxAI/MiniMax-M2.5
deepinfra/deepseek-ai/DeepSeek-V3.2
deepinfra/moonshotai/Kimi-K2.5
deepinfra/zai-org/GLM-5.1
...以及更多

注意事项

  • 模型引用格式:deepinfra/<供应商>/<模型>(例如 deepinfra/Qwen/Qwen3-Max
  • 默认模型:deepinfra/deepseek-ai/DeepSeek-V3.2
  • 基础 URL:https://api.deepinfra.com/v1/openai
  • 视频生成原生接口:https://api.deepinfra.com/v1/inference/<模型>

参考链接

常见问题

OpenClaw 怎么获取 DeepInfra API Key?

登录 deepinfra.com,进入 Dashboard / Keys 页面,生成一个新 Key 或使用已有 Key。之后通过 CLI 命令 openclaw onboard --deepinfra-api-key &lt;key&gt; 或在配置文件中设置环境变量 DEEPINFRA_API_KEY

OpenClaw 中如何切换使用其他 DeepInfra 模型?

修改 agents.defaults.model 的值为 deepinfra/供应商/模型,例如 deepinfra/Qwen/Qwen3-Max。也可在 /models deepinfra 命令输出的列表中选取模型。

DeepInfra 支持哪些 OpenClaw 功能表面?

支持聊天、图像生成/编辑、媒体理解(图片)、语音转文字、文字转语音、视频生成和记忆嵌入。具体默认模型和配置项见上方表格。