Skip to content

OpenClaw 已有用户:AI 自动接入一元模型

你已经在使用 OpenClaw 了?太好了!既然你的 AI 已经跑通了,那就让它来帮你完成配置吧。


方式一:让你的 AI 自动安装(推荐)

直接在你当前的 OpenClaw 对话里,发送以下 Prompt:

请帮我在 OpenClaw 中添加一个新的模型提供商「一元模型」。

需要修改以下 3 个文件:

1. ~/.openclaw/openclaw.json
2. ~/.openclaw/agents/main/agent/models.json
3. ~/.openclaw/agents/main/agent/auth-profiles.json

具体配置如下:

提供商名称:timesniper
Base URL:https://timesniper.club(不带 /v1)
API Key:sk-替换为你的真实Key
API 格式:anthropic-messages

需要添加 4 个模型:
- claude-sonnet-4-6(reasoning: false)
- claude-sonnet-4-6-thinking(reasoning: true)
- claude-opus-4-6(reasoning: false)
- claude-opus-4-6-thinking(reasoning: true)

所有模型的通用参数:
- input: ["text", "image"]
- contextWindow: 200000
- maxTokens: 8192
- cost: { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }

在 openclaw.json 中:
- 在 models.providers 下添加 timesniper 提供商
- 在 auth.profiles 下添加 "timesniper:default": { "provider": "timesniper", "mode": "api_key" }
- 在 agents.defaults.model 中将 primary 设为 "timesniper/claude-sonnet-4-6",fallbacks 添加 "timesniper/claude-opus-4-6"
- 在 agents.defaults.models 中为每个模型添加 alias 映射

在 models.json 中:
- 在 providers 下添加完整的 timesniper 提供商(每个模型额外增加 cost 对象和独立的 api: "anthropic-messages" 字段)

在 auth-profiles.json 中:
- 在 profiles 中添加 "timesniper:default": { "provider": "timesniper", "type": "api_key", "key": "sk-你的Key" }
- 在 lastGood 中添加 "timesniper": "timesniper:default"

请直接读取并修改这 3 个文件,保留我现有的其他提供商配置,只在对应位置插入新内容。

⚠️ 记得把 Prompt 中的 sk-替换为你的真实Key 换成你在 一元模型控制台 获取的真实 API Key!

你的 AI 会自动读取这 3 个文件,把一元模型的配置合并进去,不会影响你现有的其他提供商。


方式二:让 AI 阅读配置模板页面后自动安装

如果你的 OpenClaw 已经装了浏览器插件(如 camofox-browser),可以让 AI 直接阅读我们的配置模板页面:

请阅读这个链接的内容,然后按照里面的 3 个 JSON 配置模板,帮我把一元模型(timesniper)添加到我的 OpenClaw 配置中:

https://你的文档站域名/cli/openclaw-config.html

我的 API Key 是:sk-你的真实Key

请读取并修改以下 3 个文件,保留我现有的其他配置:
1. ~/.openclaw/openclaw.json
2. ~/.openclaw/agents/main/agent/models.json  
3. ~/.openclaw/agents/main/agent/auth-profiles.json

方式三:手动复制粘贴

如果你更习惯手动操作,请前往 👉 OpenClaw 配置模板(一键复制) 页面,那里提供了 3 个文件的完整 JSON 模板,可以直接复制粘贴到对应位置。

需要修改的 3 个文件

~/.openclaw/
├── openclaw.json                          ← 主配置
└── agents/
    └── main/
        └── agent/
            ├── models.json                ← 模型定义
            └── auth-profiles.json         ← 认证密钥

操作要点

  1. 不要覆盖整个文件,只需在对应的 JSON 对象中 新增 timesniper 相关配置
  2. baseUrl 必须是 https://timesniper.club不带 /v1
  3. api 必须是 anthropic-messages
  4. 记得把 sk-你的Key 替换为真实 Key(在 3 个文件里都要替换)

安装后验证

配置完成后,重启 OpenClaw,然后:

  1. 输入 /models 查看模型列表,确认出现 timesniper/claude-sonnet-4-6 等模型
  2. 发送一条简单消息测试连通性
  3. 如果响应正常,说明接入成功 🎉

常见问题与异常处理 (FAQ)

错误原因解决方案
401 UnauthorizedAPI Key 错误或为空前往 一元模型控制台 重新获取密钥
404 Not FoundBase URL 格式错误确认为 https://timesniper.club不加 /v1
429 Too Many Requests请求频繁或额度耗尽等待冷却或在充值页面充值
连接超时 / Network Error网络或代理冲突检查代理/VPN,确认 URL 无空格
模型不可用contextWindow 或 maxTokens 过低提升至 contextWindow: 200000maxTokens: 8192

提示: 如果依然无法解决,请携带完整报错截图到客服群中寻求帮助。