← All agent setup guides

CONFIGURATION, EXPLAINED

OpenClaw Config: Models, API Keys & Gateway Setup

Read one OpenClaw config with model access, third-party gateways, reasoning, tools, heartbeat, MCP and channel settings explained beside the selected line.

Official sources reviewed 2026-10-08One config · select a setting to read its explanation
~/.openclaw/openclaw.json

One continuous config. Click a line for its explanation. Commented lines show optional settings, alternatives or separate setup; the copy button includes active settings only.

JSON CONFIGSections are marked inside the codeSELECTED SETTINGOnly what you click is explained here
{

Model & responses

Select the primary model

agents.defaults.model.primary

Names the provider/model used for ordinary agent work.

In the main config~/.openclaw/openclaw.json
In this example
"anthropic/claude-opus-4-6" is the example value; it is not a universal recommendation.
If you leave it unset
Omission leaves this choice to the installed version, provider and higher-priority configuration.
When to change it
Choose a model available after provider authentication.
What changes / what to watch
Use the provider-qualified ID; a provider alias is not an API key.
Check that it worked
Reload the intended file or start a fresh session. Inspect the active model, tools or setting, then check one small task before relying on the change.
Official reference ↗

Copy keeps the parent structure. Merge it into the file shown above.

},
},
}
}
},
}
},
},
}
},
}
}
}
// ── Connection alternatives & separate-file setup ──
// ~/.openclaw/openclaw.json
// {
// "agents": {
// "defaults": {
// "model": {
// },
// "models": {
// "example/provider-model-id": {
// "params": {
// }
// }
// }
// }
// },
// "models": {
// "providers": {
// "example": {
// "models": [
// {
// }
// ]
// }
// }
// }
// }
// ~/.openclaw/openclaw.json
// {
// "mcp": {
// "servers": {
// "docs": {
// }
// }
// },
// "skills": {
// "load": {
// }
// }
// }
// ~/.openclaw/openclaw.json
// {
// "channels": {
// "telegram": {
// }
// }
// }
Find an explained key & its source

SETTINGS AND OFFICIAL SOURCES

Explained settings index

This index covers the settings explained in this handbook. Follow the official sources for the complete schema, additional plugins and platform-specific options. The index is not a file to paste, and not every key is available in every client or scope.

39 of 39 documented entries · showing 30

Setup, troubleshooting & official sources

Where settings take effect

Official docs checked against OpenClaw revision 4dc47557f10d. openclaw.json accepts JSON5; these examples use strict JSON for reliable copying. Provider and channel availability depends on the installed plugins.

  1. Run OpenClaw onboarding to configure a supported provider, credentials and the gateway. Keep service environment variables available to the actual gateway process.
  2. Edit ~/.openclaw/openclaw.json, or use the supported config commands. Merge only the blocks you intend to enable.
  3. Run openclaw config validate and inspect the installed schema with openclaw config schema; plugin-owned fields depend on what is installed.

OFFICIAL AND THIRD-PARTY ACCESS

Choose how the agent connects.

Use one model-provider route per session. MCP connects tools and data; it does not replace model authentication.

Included model providers

Provider setup from onboarding and the installed catalog.

Authentication
Provider-specific API key or supported account login.
Verify
Inspect the active model and provider status.
Open annotated setup →

Third-party model gateway

models.providers plus a provider-qualified model selection.

Authentication
Environment substitution or a documented SecretRef.
Verify
Validate protocol, tool calls, model capacity and credential route.
Open annotated setup →

MCP tools

mcp.servers connects local or remote tool servers.

Authentication
The tool server's own authentication.
Verify
Inspect discovered tools and their policy.
Open annotated setup →

Telegram

Optional messaging channel.

Authentication
Bot token and DM pairing.
Verify
Test with one paired user before enabling wider access.
Open annotated setup →

AFTER YOU EDIT

Check the effective settings.

  1. Validate config against the live installed schema, then inspect effective provider/model selection.
  2. Keep gateway auth, model credentials and channel tokens separate.
  3. Check tool policy and execution host with a harmless task.
  4. Inspect heartbeat cadence and concurrent runs before enabling ongoing background work.

Documentation-based examples. No live model calls or measured cost savings are claimed.

COMMON QUESTIONS

A few useful distinctions.

Why do both model and models appear?

The model selection chooses a provider/model route. Model maps contain per-model parameters or provider catalog definitions. They do different jobs.

Can I paste every displayed block at once?

The first block is the active example. Commented additions and alternatives require merging into the same file; avoid duplicate object roots or overwriting existing providers.

Official sources

Checked 2026-10-08. Follow the documentation for your installed version and selected model.

Back to the OpenClaw profile →