openai-completions for GPT, and anthropic-messages for Claude, DeepSeek, and GLM.
Install OpenClaw
OpenClaw needs Node.js>=24.16.0 <25 or >=26.1.0. Node 26 is recommended; Node 24 releases before 24.16.0 are not supported.
The install script sets up Node for you if it’s missing, then starts the onboarding wizard:
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard instead.
If you’d rather manage Node yourself, install with npm and run the wizard, which also installs the background gateway:
--allow-scripts=openclaw. On macOS you can also use the desktop app from the OpenClaw releases page.
Connect with the wizard
1
Create a LaoZhang API token
In Tokens, create tokens with the Usage first billing mode, one per request format you’ll use:If you only use GPT, the first key is enough.
defaultgroup for the OpenAI format (GPT).Claude Codegroup for the Anthropic format (Claude, DeepSeek, and GLM).
2
Run the wizard and pick Custom provider
Run
openclaw onboard, choose Quick start or Custom setup, and select Custom provider when asked for a model provider. Then choose the compatibility type and enter the base URL:- OpenAI compatible:
https://api.laozhang.ai/v1 - Anthropic compatible:
https://api.laozhang.ai
default-group key for OpenAI compatible, or the Claude Code-group key for Anthropic compatible. To change these answers later, run openclaw configure.3
Or run it non-interactively
The same setup in one command, reading the key from the environment:Without
--custom-model-id, OpenClaw reads every model from /v1/models on LaoZhang API. For Claude, DeepSeek, or GLM, use the Anthropic format instead with your Claude Code-group key. It requires a model ID:4
Set the default model and check it
openclaw models status should show laozhang/gpt-6.1-sol as the default.5
Run a test turn
Run one agent turn from the terminal. The prompt asks the model to use a tool, so a correct answer shows that chat and tool calls both work:
--localruns a single turn with the credentials in your config.--modeloverrides the model for this run only.--session-id <name>starts a fresh session if you want a clean history.
openclaw dashboard (optional).Configure GPT, Claude, DeepSeek, and GLM in openclaw.json
To use all four side by side, define both providers in~/.openclaw/openclaw.json. The file is JSON5, so comments and trailing commas are allowed. Run openclaw config file if you’re not sure which file your install reads.
Each provider reads its own key:
laozhang(OpenAI format):LAOZHANG_API_KEY, thedefault-group keylaozhang-anthropic(Anthropic format):LAOZHANG_CLAUDE_API_KEY, theClaude Code-group key
openclaw config validate after editing. What each part does:
api:openai-completionssends Chat Completions requests and is the default when a provider has a base URL but noapi.anthropic-messages: sends Messages requests and adds the Anthropic auth and version headers itself, so you don’t set any headers.baseUrl: include/v1for the OpenAI format. For the Anthropic format, use the bare host, as in OpenClaw’s own docs.input: models accept text only unless you list"image". Add it only for models that take images.contextWindow: OpenClaw assumes 200,000 tokens when it’s missing and uses this value to decide when to compact. Set it to the actual context window from the model vendor’s documentation.maxTokens: Claude models on LaoZhang API return at most 32,768 output tokens per response, so keep Claude at or below that. See Claude model limits.compat.supportsUsageInStreaming: OpenClaw doesn’t request token usage in streamed responses from custom OpenAI-format hosts unless you turn this on. LaoZhang API returns usage in streams, and with real counts compaction stops relying on estimates.
Keep the key out of the file
Each${...} reference is replaced with its environment variable when OpenClaw loads the config. The gateway runs as a background service, so it may not see variables exported only in your shell profile. In that case, define both variables in the config’s env.vars block and keep the references in apiKey:
Switch models
Changes tomodels.providers, agents.defaults.models, and the model selection reload automatically, with no gateway restart. To switch models:
- Default for new sessions:
openclaw models set laozhang-anthropic/claude-sonnet-5-5, or editagents.defaults.model.primary - Current chat only: send
/model laozhang-anthropic/deepseek-v4-pro - See what’s configured:
openclaw models list --provider laozhang-anthropic
provider/model-id.
Request fields for OpenAI-format models
For custom OpenAI-format hosts, OpenClaw sendsmax_completion_tokens and, for models with reasoning: true, reasoning_effort. LaoZhang API accepts both for gpt-6.1-sol. Since November 4, 2026, GPT-6 and GPT-5.6 models also call tools while reasoning, so you don’t need to turn reasoning off for agent work.
If a model you add rejects one of these fields, adjust it in that model’s compat block:
maxTokensFieldchanges which field carries the output limitsupportsReasoningEffort: falsestops OpenClaw from sendingreasoning_effort
Choose a model
All four call tools in OpenClaw agent turns. Other Claude IDs are
claude-opus-5-5 and claude-haiku-5-5. Prices are in the model catalog.
FAQ
”Auto-compaction could not recover this turn”
OpenClaw tried to compact the conversation and it still didn’t fit the model’s context. Work through these in order:- Retry the message once.
- Send
/compactto compact the session manually. - Send
/newto start a fresh session. - Switch to a model with a larger context window.
contextWindow to the model’s real value and turn on compat.supportsUsageInStreaming for OpenAI-format models, so OpenClaw works from actual token counts instead of estimates.
Should I still set reserveTokensFloor?
No. These keys underagents.defaults.compaction are retired:
reserveTokensreserveTokensFloormaxHistoryShare
openclaw doctor --fix to remove them from your config, then let compaction work from an accurate contextWindow for each model.
What does openclaw doctor do?
openclaw doctor checks your install and config and reports problems. Useful options:
--fixapplies the repairs it can, such as removing retired compaction keys--deepruns a more thorough check--jsonprints the report as JSON--generate-gateway-tokencreates a new gateway token
openclaw config validate for a quick check of the config file alone.
Port 18789 is already in use (EADDRINUSE)
Another process is already listening on the gateway port, often a gateway you installed earlier as a background service. Runopenclaw gateway status to see whether it’s running. If it is, use that gateway instead of starting a second one.
I get AUTH_TOKEN_MISMATCH
The gateway and the client are reading different configs. This usually happens when you edited another copy, for example one selected by--profile or the OPENCLAW_STATE_DIR variable. Run openclaw config file in the same environment the gateway runs in, and make your changes in that file.
Do I need to restart after editing openclaw.json?
No, not for providers or models. Changes tomodels.providers, agents.defaults.models, and the selected model reload automatically.
Claude keeps thinking after I set reasoning: false
reasoning: false on the model doesn’t turn off Claude’s adaptive thinking. Send /think off in the chat, or set thinkingDefault in your config to turn it off by default.
I get 401, 403, 404, or 503 errors
- 401: the key is wrong or wasn’t copied in full. Check that both
LAOZHANG_API_KEYandLAOZHANG_CLAUDE_API_KEYare set where the gateway runs. - 403 or 503 “no available channels”: the token’s group doesn’t include the model, or the model ID is misspelled. Check that
laozhanguses adefault-group key andlaozhang-anthropicaClaude Code-group key. See Check model availability. - 404:
/v1is missing from the OpenAI-formatbaseUrlor appears twice. - Insufficient balance: see Insufficient balance.