编辑配置文件 ~/.openclaw/openclaw.json,将 apiKey 替换为真实的 API Key:
{
"models": {
"providers": {
"ailink": {
"baseUrl": "https://ailink.nativex.com/v1",
"apiKey": "<你的 API Key>",
"api": "anthropic-messages",
"models": [
{
"id": "<模型名称,请在系统模型价格页获取>",
"name": "<自定义模型名称>"
}
]
}
}
}
}
示例:
{
"models": {
"mode": "merge",
"providers": {
"ailink": {
"baseUrl": "https://ailink.nativex.com/v1",
"apiKey": "sk_xxxx",
"api": "anthropic-messages",
"models": [
{"id": "claude-opus-4.7", "name": "claude-opus-4.7", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 32768},
{"id": "gemini-2.5-pro", "name": "gemini-2.5-pro", "reasoning": false, "input": ["text", "image"], "contextWindow": 1000000, "maxTokens": 65536},
{"id": "gpt-5.5", "name": "gpt-5.5", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 32768}
]
}
}
},
"agents": {
"defaults": {
"model": {"primary": "ailink/claude-opus-4.7"},
"models": {
"ailink/claude-opus-4.7": {},
"ailink/gemini-2.5-pro": {},
"ailink/gpt-5.5": {}
}
}
}
}
配置完成后执行 openclaw gateway restart 重启网关使配置生效。
详细配置步骤请参考官方文档:https://docs.openclaw.ai/providers/litellm