OpenClaw Model Configuration
OpenClaw is model-agnostic and supports auth profile rotation and fallback chains. This chapter explains how to connect and configure models.
Supported Providers
Models are configured in openclaw.json, with support for auth profile rotation and fallback chains — when the primary model is unavailable, it automatically switches to a backup.
Context Window & Local Model Requirements
For reliable operation, the project recommends:
- Context window ≥ 64K tokens
- For local models: 32B+ parameters and 24GB VRAM minimum
The agent must fit memory, tool descriptions, skills, and conversation history into context — too small a window leads to unstable behavior.
Configuring in openclaw.json
Model configuration lives in the main config file openclaw.json (under ~/.openclaw/). Key areas include:
- Provider settings and auth
- Model routing preferences: primary model, fallback chain
- Tool policies and approval gates
- Autonomy level settings
An illustrative snippet (exact fields defer to your version):
Credentials & Environment Variables
Keep secrets like API keys in environment variables or a separate config, out of files that might be shared/committed:
Relevant paths can be overridden via environment variables:
Security tip: never commit keys to Git; keep
~/.openclaw/private.
Three Typical Setups
1) Cloud frontier models (most reliable)
Use strong Anthropic / OpenAI / Google models directly — best tool calling and long-task performance, ideal for stable everyday use.
2) Local models (most private)
Run open models with Ollama or LM Studio so data never leaves your network. Meet the 32B+ / 24GB VRAM recommendation, or complex tasks may be unstable.
3) Hybrid + fallback chain (cost and reliability)
Use a cheap/local model for simple tasks and fall back to a strong cloud model when complex or failing:
Cost Notes
Rough monthly API spend by usage intensity:
Strongly recommended: set spending alerts at the provider level. Shorter heartbeat intervals and pricier models grow the bill faster — see CLI & Automation.
Next Steps
- Tool System — let the model actually take action
- CLI & Automation — control Heartbeat frequency and cost
- Permissions & Security — credential and port security