OpenClaw
OpenClaw (opens in a new tab) is an open-source agent framework. Route OpenClaw traffic through Xilos to apply routing rules, restriction rules, guardrails, and caching to every agent call.
Prerequisites
- A Xilos account with an active organization.
- An API key from Settings in the Xilos dashboard, or a Virtual Key with scoped limits.
- OpenClaw installed and initialized in your project.
- The base URL:
https://api.xilos.ai/api/v1.
Configuration
OpenClaw uses the OpenAI-compatible provider as its default backend. Set two environment variables and update the model name in your OpenClaw configuration file.
Set environment variables
OpenClaw respects the standard OPENAI_API_KEY and OPENAI_BASE_URL variables. Set them to your Xilos API key and the Xilos base URL.
export OPENAI_API_KEY="your-xilos-api-key"
export OPENAI_BASE_URL="https://api.xilos.ai/api/v1"Add these lines to your shell profile (~/.bashrc or ~/.zshrc) so they persist across sessions.
Configure the model in your OpenClaw config
In your OpenClaw configuration file (typically openclaw.yaml or .openclaw/config.yaml), set the model name to xilos so the Xilos routing engine selects the underlying LLM:
model:
name: xilos
provider: openaiRun your agent
openclaw runAll LLM calls now route through Xilos.
Info: When the model name is
xilos, Xilos applies your routing rules to select the best LLM for each query. To target a specific model, setmodel.nameto a concrete model identifier (for example,claude-sonnet-4).
Verify the Connection
Send a test query from OpenClaw and confirm it appears in the Xilos dashboard:
- Trigger any agent action that requires an LLM call.
- Open your Xilos dashboard.
- Navigate to Query Log.
- Confirm the query appears with the routing decision, governance actions, and cost breakdown.
curl https://api.xilos.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "xilos",
"messages": [{"role": "user", "content": "Hello, Xilos!"}]
}'Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| 401 Unauthorized | The API key is invalid or expired. | Regenerate the key in the Xilos dashboard under Settings and update OPENAI_API_KEY. |
| Requests go to OpenAI directly | OPENAI_BASE_URL is not set or is overridden in the config file. | Ensure OPENAI_BASE_URL is exported and that the OpenClaw config does not hardcode a different endpoint. |
| Routing rules do not apply | The model name is set to a concrete model instead of xilos. | Set model.name to xilos so the Xilos routing engine processes each query. |
| 403 Forbidden | A Xilos restriction rule blocked the query. | Check the Query Log for the triggered rule and adjust the rule or the query content. |
| Connection refused | Network proxy or firewall blocks outbound HTTPS to api.xilos.ai. | Allow outbound traffic to https://api.xilos.ai on port 443. |
Next Steps
- Create a Routing Rule — Direct specific query types to the best model.
- Create a Restriction Rule — Block, mask, or flag sensitive content.
- Manage Virtual Keys — Scope API keys with budget and rate limits.
- Set Up Webhooks — Receive real-time event notifications.