Skip to main content

Why Choose Anthropic Native Mode

OpenClaw supports two ways to call Claude models. If you need tool calling (tool_use) and other advanced features, Anthropic native mode (anthropic-messages) is strongly recommended:
With openai-completions, basic chat works fine, but multi-turn tool calling (tool_calls → tool_result → tool loop) may be rejected with a 400 error. Switching to anthropic-messages allows tool_use + tool_result format to work properly.
Edit ~/.openclaw/openclaw.json and add the following provider configuration:

Critical Configuration Notes

The following three points must be set correctly, or you will encounter 400 errors:
  1. baseUrl without /v1: Must be https://api.apiyi.com — adding /v1 would result in .../v1/v1/messages causing request failure
  2. headers must include anthropic-version: Set to 2023-06-01
  3. anthropic-beta set to empty string: Disables beta feature headers to avoid triggering unsupported features

About reasoning: false

Claude models on APIYI will return a 400 error if the request contains thinking-related fields (thinking / output_config).Setting "reasoning": false in the model entry prevents OpenClaw from sending thinking fields, avoiding this issue.

Model Allowlist Configuration

Add models to agents.defaults.models, otherwise OpenClaw may report the model as “unregistered” and silently fall back to another model:

Comparison with OpenAI Compatible Mode

Claude Model ID List

Configure both OpenAI compatible and Anthropic native providers, switching as needed:
Use /model apiyi/gpt-5.4 or /model apiyi-claude/claude-sonnet-4-6 in chat to switch models.

Verify Configuration

After setup, verify that the configuration is working:
In the returned JSON, check that meta.agentMeta.provider and meta.agentMeta.model match your configuration.

Troubleshooting

This is usually caused by thinking-related fields in the request. Ensure:
  • Model entries have "reasoning": false set
  • Headers include "anthropic-beta": "" correctly configured
Existing chat sessions may have cached the old model configuration. Two solutions:Patch the session model:
Or reset the session:
Check if the model has been added to the agents.defaults.models allowlist. Unregistered models will be automatically fallen back by OpenClaw.
The Anthropic native mode baseUrl must not include /v1. Using https://api.apiyi.com/v1 will result in .../v1/v1/messages, causing a 404 error.