Caricamento in corso...
Caricamento in corso...
Last synced: Today, 22:00
Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
Local is doable, but OpenClaw expects large context + strong defenses against prompt injection. Small cards truncate context and leak safety. Aim high: ≥2 maxed-out Mac Studios or equivalent GPU rig (~$30k+). A single 24 GB GPU works only for lighter prompts with higher latency. Use the largest / full-size model variant you can run; aggressively quantized or “small” checkpoints raise prompt-injection risk (see Security).
If you want the lowest-friction local setup, start with LM Studio or Ollama and
openclaw onboardBest current local stack. Load a large model in LM Studio (for example, a full-size Qwen, DeepSeek, or Llama build), enable the local server (default
http://127.0.0.1:1234json5{ agents: { defaults: { model: { primary: "lmstudio/my-local-model" }, models: { "anthropic/claude-opus-4-6": { alias: "Opus" }, "lmstudio/my-local-model": { alias: "Local" }, }, }, }, models: { mode: "merge", providers: { lmstudio: { baseUrl: "http://127.0.0.1:1234/v1", apiKey: "lmstudio", api: "openai-responses", models: [ { id: "my-local-model", name: "Local Model", reasoning: false, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 196608, maxTokens: 8192, }, ], }, }, }, }
Setup checklist
http://127.0.0.1:1234/v1/modelsmy-local-modelcontextWindowmaxTokensKeep hosted models configured even when running local; use
models.mode: "merge"json5{ agents: { defaults: { model: { primary: "anthropic/claude-sonnet-4-6", fallbacks: ["lmstudio/my-local-model", "anthropic/claude-opus-4-6"], }, models: { "anthropic/claude-sonnet-4-6": { alias: "Sonnet" }, "lmstudio/my-local-model": { alias: "Local" }, "anthropic/claude-opus-4-6": { alias: "Opus" }, }, }, }, models: { mode: "merge", providers: { lmstudio: { baseUrl: "http://127.0.0.1:1234/v1", apiKey: "lmstudio", api: "openai-responses", models: [ { id: "my-local-model", name: "Local Model", reasoning: false, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 196608, maxTokens: 8192, }, ], }, }, }, }
Swap the primary and fallback order; keep the same providers block and
models.mode: "merge"models.mode: "merge"MLX (
mlx_lm.server/v1/chat/completions/v1/responsesjson5{ agents: { defaults: { model: { primary: "local/my-local-model" }, }, }, models: { mode: "merge", providers: { local: { baseUrl: "http://127.0.0.1:8000/v1", apiKey: "sk-local", api: "openai-completions", timeoutSeconds: 300, models: [ { id: "my-local-model", name: "Local Model", reasoning: false, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 120000, maxTokens: 8192, }, ], }, }, }, }
If
apibaseUrlopenai-completions127.0.0.1request.allowPrivateNetwork: trueThe
models.providers.<id>.models[].idmlx_lm.server --model mlx-community/Qwen3-30B-A3B-6bitmodels.providers.mlx.models[].id: "mlx-community/Qwen3-30B-A3B-6bit"agents.defaults.model.primary: "mlx/mlx-community/Qwen3-30B-A3B-6bit"Set
input: ["text", "image"]--custom-image-input--custom-text-inputKeep
models.mode: "merge"models.providers.<id>.timeoutSecondsagents.defaults.timeoutSecondsBehavior note for local/proxied
/v1service_tierstoreoriginatorversionUser-AgentCompatibility notes for stricter OpenAI-compatible backends:
Some servers accept only string
messages[].contentmodels.providers.<provider>.models[].compat.requiresStringContent: trueSome local models emit standalone bracketed tool requests as text, such as
[tool_name][END_TOOL_REQUEST]If a model emits JSON, XML, or ReAct-style text that looks like a tool call but the provider did not emit a structured invocation, OpenClaw leaves it as text and logs a warning with the run id, provider/model, detected pattern, and tool name when available. Treat that as provider/model tool-call incompatibility, not a completed tool run.
If tools appear as assistant text instead of running, for example raw JSON, XML, ReAct syntax, or an empty
tool_callsjson5{ agents: { defaults: { models: { "local/my-local-model": { params: { extra_body: { tool_choice: "required", }, }, }, }, }, }, }
Use this only for models/sessions where every normal turn should call a tool. It overrides OpenClaw's default proxy value of
tool_choice: "auto"local/my-local-modelopenclaw models listbashopenclaw config set agents.defaults.models '{"local/my-local-model":{"params":{"extra_body":{"tool_choice":"required"}}}}' --strict-json --merge
If a custom OpenAI-compatible model accepts OpenAI reasoning efforts beyond the built-in profile, declare them on the model compat block. Adding
"xhigh"/think xhighllm-taskjson5{ models: { providers: { local: { baseUrl: "http://127.0.0.1:8000/v1", apiKey: "sk-local", api: "openai-responses", models: [ { id: "gpt-5.4", name: "GPT 5.4 via local proxy", reasoning: true, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 196608, maxTokens: 8192, compat: { supportedReasoningEfforts: ["low", "medium", "high", "xhigh"], reasoningEffortMap: { xhigh: "xhigh" }, }, }, ], }, }, }, }
Some smaller or stricter local backends are unstable with OpenClaw's full agent-runtime prompt shape, especially when tool schemas are included. First verify the provider path with the lean local probe:
bashopenclaw infer model run --local --model <provider/model> --prompt "Reply with exactly: pong" --json
To verify the Gateway route without the full agent prompt shape, use the Gateway model probe instead:
bashopenclaw infer model run --gateway --model <provider/model> --prompt "Reply with exactly: pong" --json
Both local and Gateway model probes send only the supplied prompt. The Gateway probe still validates Gateway routing, auth, and provider selection, but it intentionally skips prior session transcript, AGENTS/bootstrap context, context-engine assembly, tools, and bundled MCP servers.
If that succeeds but normal OpenClaw agent turns fail, first try
agents.defaults.experimental.localModelLean: truebrowsercronmessagemodels.providers.<provider>.models[].compat.supportsTools: falseIf the backend still fails only on larger OpenClaw runs, the remaining issue is usually upstream model/server capacity or a backend bug, not OpenClaw's transport layer.
curl http://127.0.0.1:1234/v1/modelsterminatedECONNRESETmodel.call.error.failureKindagents.defaults.contextTokenscontextWindowmessages[].content ... expected a stringcompat.requiresStringContent: true/v1/chat/completionsopenclaw infer model run --localmodel runmodel runlocalModelLeancompat.supportsTools: falsetool_callsparams.extra_body.tool_choice: "required"© 2024 TaskFlow Mirror
Powered by TaskFlow Sync Engine