配置 — 提供商示例
已验证的 models.providers 配置。有关每个字段的含义,请参阅自定义提供商和基础 URL。
提供商示例¶
Cerebras (GLM 4.7 / GPT OSS)
官方外部 cerebras 提供商插件可以通过 openclaw onboard --auth-choice cerebras-api-key 来配置此项。仅在需要覆盖默认值时,才使用显式提供商配置。
{
env: { vars: { CEREBRAS_API_KEY: "sk-..." } },
agents: {
defaults: {
model: {
primary: "cerebras/zai-glm-4.7",
fallbacks: ["cerebras/gpt-oss-120b"],
},
models: {
"cerebras/zai-glm-4.7": { alias: "GLM 4.7 (Cerebras)" },
"cerebras/gpt-oss-120b": { alias: "GPT OSS 120B (Cerebras)" },
},
},
},
models: {
mode: "merge",
providers: {
cerebras: {
baseUrl: "https://api.cerebras.ai/v1",
apiKey: "${CEREBRAS_API_KEY}",
api: "openai-completions",
models: [
{ id: "zai-glm-4.7", name: "GLM 4.7 (Cerebras)" },
{ id: "gpt-oss-120b", name: "GPT OSS 120B (Cerebras)" },
],
},
},
},
}
对于 Cerebras,使用 cerebras/zai-glm-4.7;对于 Z.AI 直连,使用 zai/glm-4.7。
Kimi Coding
{
env: { vars: { KIMI_API_KEY: "sk-..." } },
agents: {
defaults: {
model: { primary: "kimi/kimi-for-coding" },
models: { "kimi/kimi-for-coding": { alias: "Kimi Code" } },
},
},
}
兼容 Anthropic 的内置提供商。快捷方式:openclaw onboard --auth-choice kimi-code-api-key。
本地模型 (llama.cpp / llama-server)
标准 llama-cpp 提供商会在托管模式和现有服务器模式下应用 llama.cpp schema 清理器。如果你改为将 自定义提供商 ID 指向远程 llama-server(或另一个 OpenAI 兼容的 llama.cpp 端点),请为每个聊天模板将工具参数编译为 GBNF 的模型设置 compat.toolSchemaProfile: "llamacpp"。该配置档会移除大于或等于 2000 的 pattern 和 maxLength 值,覆盖 cron 工具的 trigger.script 65536 限制。这是一种针对性缓解措施,并非对每个 JSON Schema 约束或 minLength 的完全兼容。
{
agents: {
defaults: {
model: { primary: "my-llamacpp/qwen35" },
},
},
models: {
mode: "merge",
providers: {
"my-llamacpp": {
baseUrl: "http://127.0.0.1:8080/v1",
apiKey: "llamacpp-no-key",
api: "openai-completions",
models: [
{
id: "qwen35",
name: "Qwen3.5 (llama-server)",
contextWindow: 8192,
maxTokens: 2048,
compat: {
supportsTools: true,
toolSchemaProfile: "llamacpp",
},
},
],
},
},
},
}
作为更广泛的手动替代方案,请设置 compat.unsupportedToolSchemaKeywords: ["pattern", "patternProperties", "format", "propertyNames", "uniqueItems", "contains", "minContains", "maxContains", "minLength", "maxLength"]。与配置档不同,这会无条件移除所有列出的关键字。
本地模型 (LM Studio)
请参阅本地模型。简而言之:在高性能硬件上通过 LM Studio Responses API 运行大型本地模型;保留托管模型合并以用于回退。
MiniMax M3 (直连)
{
agents: {
defaults: {
model: { primary: "minimax/MiniMax-M3" },
models: {
"minimax/MiniMax-M3": { alias: "Minimax" },
},
},
},
models: {
mode: "merge",
providers: {
minimax: {
baseUrl: "https://api.minimax.io/anthropic",
apiKey: "${MINIMAX_API_KEY}",
api: "anthropic-messages",
models: [
{
id: "MiniMax-M3",
name: "MiniMax M3",
reasoning: true,
input: ["text", "image"],
cost: { input: 0.6, output: 2.4, cacheRead: 0.12, cacheWrite: 0 },
contextWindow: 1000000,
maxTokens: 131072,
},
],
},
},
},
}
设置 MINIMAX_API_KEY。快捷方式:openclaw onboard --auth-choice minimax-global-api 或 openclaw onboard --auth-choice minimax-cn-api。模型目录默认使用 M3,并且还包括 M2.7 变体。在 Anthropic 兼容的流式路径上,OpenClaw 默认会禁用 MiniMax M2.x 的 thinking,除非你显式设置 thinking;MiniMax-M3(以及 M3.x)默认保持提供商的省略/自适应 thinking 路径。/fast on 或 params.fastMode: true 会将 MiniMax-M2.7 重写为 MiniMax-M2.7-highspeed。
Moonshot AI (Kimi)
{
env: { vars: { MOONSHOT_API_KEY: "sk-..." } },
agents: {
defaults: {
model: { primary: "moonshot/kimi-k2.6" },
models: { "moonshot/kimi-k2.6": { alias: "Kimi K2.6" } },
},
},
models: {
mode: "merge",
providers: {
moonshot: {
baseUrl: "https://api.moonshot.ai/v1",
apiKey: "${MOONSHOT_API_KEY}",
api: "openai-completions",
models: [
{
id: "kimi-k2.6",
name: "Kimi K2.6",
reasoning: false,
input: ["text", "image"],
cost: { input: 0.95, output: 4, cacheRead: 0.16, cacheWrite: 0 },
contextWindow: 262144,
maxTokens: 262144,
},
],
},
},
},
}
对于中国端点:baseUrl: "https://api.moonshot.cn/v1" 或 openclaw onboard --auth-choice moonshot-api-key-cn。
原生 Moonshot 端点会在共享的 openai-completions 传输上声明流式 usage 兼容性,OpenClaw 会依据端点能力,而不是仅依据内置 provider id。
OpenCode
{
agents: {
defaults: {
model: { primary: "opencode/claude-opus-4-6" },
models: { "opencode/claude-opus-4-6": { alias: "Opus" } },
},
},
}
设置 OPENCODE_API_KEY(或 OPENCODE_ZEN_API_KEY)。Zen 目录使用 opencode/... 引用,Go 目录使用 opencode-go/... 引用。快捷方式:openclaw onboard --auth-choice opencode-zen 或 openclaw onboard --auth-choice opencode-go。
Synthetic(Anthropic 兼容)
{
env: { vars: { SYNTHETIC_API_KEY: "sk-..." } },
agents: {
defaults: {
model: { primary: "synthetic/hf:MiniMaxAI/MiniMax-M3" },
models: { "synthetic/hf:MiniMaxAI/MiniMax-M3": { alias: "MiniMax M3" } },
},
},
models: {
mode: "merge",
providers: {
synthetic: {
baseUrl: "https://api.synthetic.new/anthropic",
apiKey: "${SYNTHETIC_API_KEY}",
api: "anthropic-messages",
models: [
{
id: "hf:MiniMaxAI/MiniMax-M3",
name: "MiniMax M3",
reasoning: true,
input: ["text", "image"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 262144,
maxTokens: 65536,
},
],
},
},
},
}
Base URL 应省略 /v1(Anthropic 客户端会自动追加)。快捷方式:openclaw onboard --auth-choice synthetic-api-key。
Z.AI (GLM-4.7)
设置 ZAI_API_KEY。模型引用使用规范的 zai/* provider ID。快捷方式:openclaw onboard --auth-choice zai-api-key。
- 通用端点:
https://api.z.ai/api/paas/v4 - 编码端点:
https://api.z.ai/api/coding/paas/v4 - 默认
zai-api-key认证选项会检查你的密钥,并自动检测它属于哪个端点(如果检测无法确定,则回退到提示,默认选择 Global)。也可使用专用的 CN 和 Coding-Plan 认证选项进行明确选择。 - 对于通用端点,请定义一个带有 base URL 覆盖的自定义 provider。
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/openclaw