/v1 API 后提供本地模型服务。OpenClaw 通过通用的 openai-completions 适配器与之对接。
快速开始
1
使用模型启动 inferrs
2
验证服务器是否可访问
3
添加一个 OpenClaw 提供商条目
添加一个显式的提供商条目,并将你的默认模型指向它。请参见下面的配置示例。
完整配置示例
本地inferrs 服务器上的 Gemma 4:
按需启动
OpenClaw 仅在选择inferrs/... 模型时才会自行启动 inferrs。将 localService 添加到同一个 provider 条目中:
command 必须是绝对路径。在 Gateway 主机上运行 which inferrs 并使用该路径。完整字段参考: 本地模型服务。
高级配置
Why requiresStringContent matters
Why requiresStringContent matters
Some
inferrs Chat Completions routes accept only string messages[].content, not structured content-part arrays.Gemma and tool-schema caveat
Gemma and tool-schema caveat
Some That reduces prompt pressure on stricter local backends. If tiny direct requests still work but normal OpenClaw agent turns keep crashing inside
inferrs + Gemma combinations accept small direct /v1/chat/completions requests but fail on full OpenClaw agent-runtime turns. Try disabling the tool schema surface first:inferrs, treat it as an upstream model/server limitation rather than an OpenClaw transport issue.Manual smoke test
Manual smoke test
Test both layers once configured:If the first command works but the second fails, see Troubleshooting below.
Proxy-style behavior
Proxy-style behavior
Because
inferrs uses the generic openai-completions adapter (not openai-responses), native-OpenAI-only request shaping never applies: no service_tier, no Responses store, no prompt-cache hints, and no OpenAI reasoning-compat payload shaping get sent.故障排除
curl /v1/models fails
curl /v1/models fails
inferrs 未运行、无法访问,或未绑定到你配置的主机/端口。请确认服务器已启动并在该地址上监听。messages[].content expected a string
messages[].content expected a string
在模型条目中设置
compat.requiresStringContent: true(见上文)。Direct /v1/chat/completions calls pass but openclaw infer model run fails
Direct /v1/chat/completions calls pass but openclaw infer model run fails
设置
compat.supportsTools: false 以禁用工具 schema 表面(见上面的 Gemma 注意事项)。inferrs still crashes on larger agent turns
inferrs still crashes on larger agent turns
如果 schema 错误已经消失,但
inferrs 在较大的 agent 轮次中仍然崩溃,请将其视为上游 inferrs 或模型限制。减少提示词压力或切换后端/模型。相关内容
本地模型
在本地模型服务器上运行 OpenClaw。
本地模型服务
按需启动已配置提供方的本地模型服务器。
网关故障排除
调试通过探测但在 agent 运行时失败的本地 OpenAI 兼容后端。
模型选择
所有提供方、模型引用和故障转移行为的概览。