OpenClaw
OpenClaw 是一个开源的个人 AI 助手框架,支持多平台和多渠道部署。你可以通过 OpenAI 兼容 API 将 OpenClaw 与 MyTokenGate 集成。
特性
- 支持多种聊天渠道:Discord、Telegram、WhatsApp、Slack 等
- 支持自定义模型提供商和 Base URL
- 支持多模型切换和故障转移
- 支持工具调用和自动化
配置方式
方法一:使用 OpenAI 兼容 API
在 ~/.openclaw/openclaw.json 中添加自定义提供商配置:
{
models: {
providers: {
"mytokengate": {
baseUrl: "https://gateway.mytokengate.com/v1",
apiKey: "tg-your-api-key",
api: "openai-completions",
models: [
{
id: "claude-opus-4-6",
name: "Claude Opus 4.6",
contextWindow: 200000,
input: ["text", "image"],
},
{
id: "gpt-5.1",
name: "GPT-5.1",
contextWindow: 400000,
input: ["text", "image"],
},
],
},
},
},
agents: {
defaults: {
model: {
primary: "mytokengate/claude-opus-4-6",
},
},
},
}方法二:使用 Anthropic API
如果你偏好使用 Anthropic 原生 API 格式:
{
models: {
providers: {
"mytokengate-anthropic": {
baseUrl: "https://gateway.mytokengate.com/v1",
apiKey: "tg-your-api-key",
api: "anthropic-messages",
models: [
{
id: "claude-opus-4-6",
name: "Claude Opus 4.6",
contextWindow: 200000,
input: ["text", "image"],
},
],
},
},
},
agents: {
defaults: {
model: {
primary: "mytokengate-anthropic/claude-opus-4-6",
},
},
},
}配置说明
| 参数 | 说明 |
|---|---|
baseUrl | MyTokenGate API 地址,包含 /v1 后缀 |
apiKey | 你的 MyTokenGate API Key |
api | API 协议:openai-completions 或 anthropic-messages |
models | 可用模型列表 |
contextWindow | 模型上下文窗口大小 |
使用 CLI 配置
也可以通过 OpenClaw CLI 进行配置:
# 添加自定义提供商
openclaw config set models.providers.mytokengate.baseUrl "https://gateway.mytokengate.com/v1"
openclaw config set models.providers.mytokengate.apiKey "tg-your-api-key"
openclaw config set models.providers.mytokengate.api "openai-completions"
# 设置默认模型
openclaw models set mytokengate/claude-opus-4-6验证配置
# 查看可用模型
openclaw models list --provider mytokengate
# 测试聊天
openclaw chat相关链接
Last updated on