OpenClaw
Add a custom Anthropic provider to OpenClaw.
OpenClaw is an open-source personal AI assistant that runs on your own machine and connects to chat apps. It accepts custom model providers in both the OpenAI-compatible and the Anthropic format.
- Protocol: OpenAI-compatible or Anthropic
- Base URL:
https://tokenfunc.com/v1for OpenAI-compatible,https://tokenfunc.comfor Anthropic - Models: any, for example
claude-sonnet-4-5
Option 1: setup wizard
Run the wizard
openclaw onboardChoose More… → Custom Provider.
Screenshot pendingThe Custom Provider option in openclaw onboardtools/openclaw-onboard.png
Enter the provider details
Prompt OpenAI-compatible Anthropic Base URL https://tokenfunc.com/v1https://tokenfunc.comAPI key sk-xxxxxxxxxxxxxxxxsk-xxxxxxxxxxxxxxxxCompatibility OpenAI-compatible Anthropic-compatible Model ID claude-sonnet-4-5claude-sonnet-4-5With OpenAI-compatible the wizard fetches this site's model list for you to pick from; with Anthropic you type the model ID. Before saving, the wizard makes a real call to confirm it gets a reply.
Verify
openclaw models list --provider tokenfuncIf it lists this site's models, you are set. The wizard names the provider
custom-plus the host by default; replacetokenfuncin the command with the actual name.
Option 2: one command
openclaw onboard --non-interactive --auth-choice custom-api-key \
--custom-provider-id tokenfunc \
--custom-base-url "https://tokenfunc.com/v1" \
--custom-model-id "claude-sonnet-4-5" \
--custom-api-key "sk-xxxxxxxxxxxxxxxx" \
--custom-compatibility openaiOption 3: edit the config file
The config file is ~/.openclaw/openclaw.json (JSON5, comments allowed). Changes apply automatically:
{
agents: { defaults: { model: { primary: 'tokenfunc/claude-sonnet-4-5' } } },
models: {
mode: 'merge',
providers: {
tokenfunc: {
baseUrl: 'https://tokenfunc.com/v1',
apiKey: 'sk-xxxxxxxxxxxxxxxx',
api: 'openai-completions',
models: [
{
id: 'claude-sonnet-4-5',
name: 'claude-sonnet-4-5',
contextWindow: 200000,
maxTokens: 8192,
},
],
},
},
},
}- For the Anthropic format, set
baseUrltohttps://tokenfunc.comandapito"anthropic-messages". - For image input, add
input: ["text", "image"]to the model. - To change the default model:
openclaw models set tokenfunc/claude-sonnet-4-5.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Model unavailable / not allowed by modelPolicy | The model is only listed under agents.defaults. It must also be in providers.tokenfunc.models |
| "returned no token usage" | Add compat: { supportsUsageInStreaming: true } to the model |
| Upstream rejects reasoning_effort | Add compat: { supportsReasoningEffort: false } to the model |
| 404 | The OpenAI-compatible baseUrl is missing /v1 |
Changes made with openclaw configure do nothing | Providers are changed through openclaw onboard or the config file |