OpenClaw
Use RuToken as the model provider for the self-hosted personal AI assistant OpenClaw.
OpenClaw is an open-source, self-hosted personal AI assistant. A single Gateway process connects messaging apps such as Telegram, Discord, WhatsApp and iMessage to AI agents running on your own hardware, with long-term memory, scheduled tasks, tool calling and multi-agent routing. Docs: docs.openclaw.ai, source: GitHub.
Prerequisites
- An API key: open the console, go to API Keys and create a dedicated key (for example, named
OpenClaw). - Node.js 22 or newer.
Installation
Install OpenClaw and run the onboarding wizard (for other methods see Getting Started):
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw onboard --install-daemon
Check that the Gateway and the Control UI work before adding a provider — this makes later troubleshooting much easier:
openclaw gateway status
openclaw dashboard
Configuration
OpenClaw adds OpenAI-compatible gateways through models.providers in its config file, usually ~/.openclaw/openclaw.json (the location can be changed with OPENCLAW_HOME, OPENCLAW_STATE_DIR or OPENCLAW_CONFIG_PATH).
1. Provide the API key
Store the key in an environment variable that the Gateway process can read (current shell, service environment, or an .env file read by OpenClaw):
export NEWAPI_API_KEY="sk-xxxx"
2. Add the provider
Merge this snippet into openclaw.json and list the model IDs you want to use:
{
models: {
mode: "merge",
providers: {
newapi: {
baseUrl: "https://rutoken.ai/v1",
apiKey: "${NEWAPI_API_KEY}",
api: "openai-completions",
models: [
{ id: "gpt-4o-mini", name: "GPT-4o mini" },
{ id: "gemini-2.5-flash", name: "Gemini 2.5 Flash" },
],
},
},
},
agents: {
defaults: {
model: {
primary: "newapi/gpt-4o-mini",
fallbacks: ["newapi/gemini-2.5-flash"],
},
},
},
}
| Key | Description |
|---|---|
models.mode |
merge keeps OpenClaw's built-in providers and adds this one |
providers.newapi.baseUrl |
https://rutoken.ai/v1 — the /v1 suffix is required |
providers.newapi.apiKey |
the key, preferably injected as ${NEWAPI_API_KEY} |
providers.newapi.api |
openai-completions for OpenAI-compatible gateways |
providers.newapi.models |
model IDs exactly as shown in the Model Square |
agents.defaults.model.primary |
default model in provider/model-id format |
agents.defaults.model.fallbacks |
models to try if the primary one fails |
Verify
Restart the Gateway, then check that the new models are listed and chat in the Control UI:
openclaw models list
openclaw dashboard
Models with the newapi/ prefix should appear, and the default model should be newapi/.... Requests show up in the console under Usage Logs.
Troubleshooting
| Symptom | Fix |
|---|---|
401 / invalid API key |
Make sure the Gateway process — not only your terminal — can read NEWAPI_API_KEY, especially when it runs as a background service. |
404 / not found |
baseUrl must end with /v1. |
| Model not found | primary and fallbacks must reference an id listed under providers.newapi.models, and that ID must exist in the Model Square. |
| Unclear errors | Run the Gateway in the foreground to see logs: openclaw gateway --port 18789. |