OpenClaw API 中转站接入指南

OpenClaw API 中转站接入指南

为什么选 OpenClaw API

  • 官方价1-3折,490元人民币充1200美元额度(6亿token)
  • 国内直连,不需要翻墙,支付宝/微信人民币充值
  • 50+模型一个key搞定,改个model id就切换
  • 官方链路直连,没掺水没降智没偷换模型
  • 双协议兼容:OpenAI Chat Completions + Anthropic Messages
  • Extended Thinking深度思考正常开启,budget可拉满128k
  • 余额永不过期
  • 适配主流工具:Claude Code、Codex、CC-Switch、TRAE、WorkBuddy、OpenClaw

注册链接

https://openclaw-api.com/

注册后到控制台充值(支付宝/微信),然后创建API Key即可使用。

场景一:腾讯云OpenClaw后台接入(无Agent)

进入腾讯云轻量服务器控制台 → 应用管理 → 自定义模型,复制以下JSON粘贴,把key填进去,点「添加并应用」。

Claude Opus 4.8(最新最强)

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com",
  "api": "anthropic-messages",
  "api_key": "你的key填这里",
  "model": {
    "id": "claude-opus-4-8",
    "name": "Claude Opus 4.8"
  }
}

Claude Opus 4.7

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com",
  "api": "anthropic-messages",
  "api_key": "你的key填这里",
  "model": {
    "id": "claude-opus-4-7",
    "name": "Claude Opus 4.7"
  }
}

Claude Opus 4.6(带深度思考,推荐)

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com",
  "api": "anthropic-messages",
  "api_key": "你的key填这里",
  "model": {
    "id": "claude-opus-4-6",
    "name": "Claude Opus 4.6"
  }
}

Claude Sonnet 5

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com",
  "api": "anthropic-messages",
  "api_key": "你的key填这里",
  "model": {
    "id": "claude-sonnet-5",
    "name": "Claude Sonnet 5"
  }
}

Claude Sonnet 4.6(性价比之选)

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com",
  "api": "anthropic-messages",
  "api_key": "你的key填这里",
  "model": {
    "id": "claude-sonnet-4-6",
    "name": "Claude Sonnet 4.6"
  }
}

GPT 5.6 Terra(OpenAI最新)

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com/v1",
  "api": "openai-completions",
  "api_key": "你的key填这里",
  "model": {
    "id": "gpt-5.6-terra",
    "name": "GPT 5.6 Terra"
  }
}

GPT 5.5

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com/v1",
  "api": "openai-completions",
  "api_key": "你的key填这里",
  "model": {
    "id": "gpt-5.5",
    "name": "GPT 5.5"
  }
}

Grok 4.5

{
  "provider": "openclaw-relay",
  "base_url": "https://openclaw-api.com/v1",
  "api": "openai-completions",
  "api_key": "你的key填这里",
  "model": {
    "id": "grok-4.5",
    "name": "Grok 4.5"
  }
}

场景二:已有Agent(自部署OpenClaw)接入

如果你已经有自己部署的OpenClaw Agent(服务器/本地),需要在配置文件中添加provider。

第一步:编辑配置文件

找到你的 openclaw.json(通常在 ~/.openclaw/openclaw.json),在 models.providers 下添加:

"openclaw-api": {
  "baseUrl": "https://openclaw-api.com",
  "apiKey": "你的key填这里",
  "api": "anthropic-messages",
  "models": [
    {
      "id": "claude-opus-4-6",
      "name": "Claude Opus 4.6 Thinking",
      "reasoning": true,
      "contextWindow": 200000,
      "maxTokens": 128000,
      "input": ["text", "image"]
    },
    {
      "id": "claude-opus-4-7",
      "name": "Claude Opus 4.7",
      "reasoning": true,
      "contextWindow": 200000,
      "maxTokens": 128000,
      "input": ["text", "image"]
    },
    {
      "id": "claude-opus-4-8",
      "name": "Claude Opus 4.8",
      "reasoning": true,
      "contextWindow": 200000,
      "maxTokens": 128000,
      "input": ["text", "image"]
    },
    {
      "id": "claude-sonnet-4-6",
      "name": "Claude Sonnet 4.6",
      "reasoning": true,
      "contextWindow": 200000,
      "maxTokens": 128000,
      "input": ["text", "image"]
    }
  ],
  "timeoutSeconds": 900
}

第二步:切换默认模型

在配置文件的 agents.defaults.model 中修改:

"model": {
  "primary": "openclaw-api/claude-opus-4-6",
  "fallbacks": ["你原来的模型作为备用"]
}

第三步:重启生效

openclaw gateway restart

重启后所有session(包括cron任务、subagent、心跳)都会走新模型。

GPT系列的provider配置(OpenAI协议)

如果要用GPT系列,需要单独加一个provider(因为协议不同):

"openclaw-api-openai": {
  "baseUrl": "https://openclaw-api.com/v1",
  "apiKey": "你的key填这里",
  "api": "openai-completions",
  "models": [
    {
      "id": "gpt-5.5",
      "name": "GPT 5.5",
      "contextWindow": 128000,
      "maxTokens": 16384,
      "input": ["text", "image"]
    },
    {
      "id": "gpt-5.6-terra",
      "name": "GPT 5.6 Terra",
      "contextWindow": 128000,
      "maxTokens": 16384,
      "input": ["text", "image"]
    }
  ],
  "timeoutSeconds": 600
}

切换模型(对话中)

在OpenClaw对话框里直接输入:

  • /model openclaw-api/claude-opus-4-6 → Claude Opus 4.6
  • /model openclaw-api/claude-opus-4-7 → Claude Opus 4.7
  • /model openclaw-api/claude-opus-4-8 → Claude Opus 4.8
  • /model openclaw-api/claude-sonnet-4-6 → Claude Sonnet 4.6

注意事项

  • Claude系列的base_url是 https://openclaw-api.com,api用 anthropic-messages
  • GPT系列的base_url是 https://openclaw-api.com/v1,api用 openai-completions
  • Extended Thinking(深度思考)无需额外配置,设 reasoning: true 即可,budget跟随maxTokens自动拉满
  • maxTokens建议设128000,让模型有充足的思考空间
  • timeoutSeconds建议设600-900,深度思考模型响应时间较长
  • 余额永不过期,按token计费,用多少扣多少

全部可用模型

Claude系列(Anthropic协议)

  • claude-opus-4-8
  • claude-opus-4-7
  • claude-opus-4-6
  • claude-sonnet-5
  • claude-sonnet-4-6
  • claude-haiku-4-5-20251001

GPT系列(OpenAI协议)

  • gpt-5.6-luna / gpt-5.6-sol / gpt-5.6-terra
  • gpt-5.5 / gpt-5.5-openai-compact
  • gpt-5.4 / gpt-5.4-mini / gpt-5.4-openai-compact

其他

  • grok-4.5

原创文章,作者:AMS,如若转载,请注明出处:https://www.uqvn.com/1520.html

(0)
AMSAMS
上一篇 2天前
下一篇 2025年8月16日 下午7:39

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注