OpenClaw Custom Provider Setup: Use Any OpenAI-Compatible API
Set up a custom provider in OpenClaw: install it, add an OpenAI-compatible base URL, API key and model to openclaw.json, then verify the connection.
On this page
OpenClaw is an AI agent framework that routes between several model providers. It does not ship tied to one vendor: you give it a custom provider, meaning a base URL, an API key and a model id, and it calls that endpoint with the OpenAI request format. Any OpenAI-compatible API works as a custom provider.
This guide sets up APIKO as the custom provider. The same steps work for any OpenAI-compatible endpoint; only the base URL and key change.
What a custom provider needs
OpenClaw needs four values per provider:
| Field | What it is | APIKO value |
|---|---|---|
type | Request format | openai |
baseURL | Where /chat/completions lives | https://api.apiko.app/v1 |
apiKey | Sent as Authorization: Bearer <key> | Your sk-… key |
model | An id the endpoint recognises | e.g. claude-sonnet-5-5, gpt-6.1-sol |
Because the endpoint speaks the OpenAI protocol, one key covers every model behind it. You can define several providers that point at the same base URL with different models, and let OpenClaw route between them.
Prerequisites
- Node.js v18 or higher
- An APIKO API key from API Keys in the console
OpenClaw API key setup
Sign up, open API Keys in the console and create a key. The full key is shown once, so copy it straight away. Consider a separate key just for OpenClaw: each key can carry its own spending limit, and an agent that loops cannot spend past it.
If you sign in with Google using a Gmail address, $0.20 is added to your balance automatically, no card needed, once per person. It works with every model, including the Claude models in the example config below.
Step 1: Install OpenClaw
Install the CLI globally:
npm install -g openclaw@latest
Initialize the daemon. This also creates the config file you edit in the next step:
openclaw onboard --install-daemon
Check the installation:
openclaw --version
Step 2: Add APIKO as a custom provider
Edit ~/.openclaw/openclaw.json. The example defines two providers on the same APIKO key, a fast one and a balanced one, and routes to the balanced one by default:
{
"providers": [
{
"name": "apiko-fast",
"type": "openai",
"baseURL": "https://api.apiko.app/v1",
"apiKey": "your-apiko-api-key",
"model": "claude-haiku-4-5",
"priority": 1
},
{
"name": "apiko-balanced",
"type": "openai",
"baseURL": "https://api.apiko.app/v1",
"apiKey": "your-apiko-api-key",
"model": "claude-sonnet-5-5",
"priority": 2
}
],
"routing": {
"default": "apiko-balanced",
"fallback": "apiko-fast"
}
}
Replace your-apiko-api-key with your key. Three details matter:
baseURLends in/v1. Without it, requests go to the wrong path and fail.- Use
api.apiko.app, notapiko.app. The second is the console, which does not serve/v1traffic. routing.fallbackis what OpenClaw switches to when the default model is slow or unavailable. Adjust thepriorityvalues to change the routing order.
To use a different model, change the model string. Don't guess ids; list the ones your key can call:
curl https://api.apiko.app/v1/models \
-H "Authorization: Bearer $APIKO_API_KEY"
The model catalog shows the same ids with prices and supported parameters. If you are deciding between the two Claude tiers for agent work, Claude Sonnet 5.5 vs Opus 5.5 compares cost and behaviour on the same tasks.
Step 3: Verify the configuration
openclaw status
Every configured provider should show as connected. Then open an interactive session and send a message to check routing:
openclaw chat
Debugging a provider that won't connect
Agent tools can hide the real HTTP error behind a generic "request failed". Before changing OpenClaw settings, test the key and model outside it:
curl https://api.apiko.app/v1/chat/completions \
-H "Authorization: Bearer $APIKO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [{"role": "user", "content": "Hello"}]
}'
If this returns a normal chat completion, the endpoint and key are fine and the problem is in openclaw.json: a typo in baseURL, a stale key, or a JSON syntax error. If it fails, the status code tells you what to fix:
| Status | Meaning | Fix |
|---|---|---|
401 | Key missing, mistyped or deleted | Check apiKey holds the full key and the key still exists in API Keys |
403 insufficient_user_quota | Balance used up | Top up in Billing |
404 model_not_found | Wrong or retired model id | Copy an id from GET /v1/models |
429 rate_limit_error | Over 500 requests per minute for the account | Slow the agent down; 429s are not billed |
Other 5xx | Upstream failure after the gateway's retries | Retry later; failed requests are refunded. Check /status |
For more checks, such as latency and whether billing matches usage, see how to test an AI API key.
Tracking what OpenClaw spends
You don't control the exact requests an agent sends, so the easiest place to see cost is the console. Task Logs lists each request with its model, key, duration, cost and status. With a dedicated key for OpenClaw, its usage is easy to separate from your other apps. Billing is per token with no subscription: a pre-hold when the request starts, settled to real usage when it finishes, refunded if it fails. Current rates are on /pricing.
Telegram, Feishu and the auto installer
Once the custom provider works, OpenClaw can serve it through chat apps. Each connector is another block in the same openclaw.json, followed by openclaw restart and a pairing command:
- OpenClaw + Telegram: create a bot with @BotFather, add the token, then
openclaw pair telegram. - OpenClaw + Feishu: create an enterprise app, enable WebSocket mode, then
openclaw pair feishu. - OpenClaw Auto Install: a desktop manager that writes the provider config for you and runs several instances, each with its own key.
Next steps
The custom provider pattern is the same for every OpenAI-compatible tool: base URL, key, model id. If you also call the API from your own code, the OpenAI-compatible API quickstart covers the SDK setup, streaming usage and error handling in more depth.
Frequently asked questions
How do I add a custom provider in OpenClaw?
Add an entry to the providers array in ~/.openclaw/openclaw.json with a name, "type": "openai", the provider's baseURL, your apiKey, a model id and a priority. For APIKO the base URL is https://api.apiko.app/v1. Then run openclaw status to check that the provider shows as connected.
Where is the OpenClaw config file?
At ~/.openclaw/openclaw.json. The openclaw onboard --install-daemon command creates it during installation, so run that first if the file does not exist.
Which model ids can I use?
Any id your key can call. Run curl https://api.apiko.app/v1/models -H "Authorization: Bearer $APIKO_API_KEY" and copy an id exactly, for example claude-sonnet-5-5 or gpt-6.1-sol. A wrong id returns HTTP 404 with model_not_found.
How does OpenClaw fall back to another model?
The routing block names a default provider and a fallback provider. When the default model is slow or unavailable, OpenClaw can switch to the fallback. The priority value on each provider controls the routing order.
Can I try APIKO free with OpenClaw?
Yes. Sign in with Google using a Gmail address and $0.20 is added to your balance automatically, no card needed, once per person. It works with every model, including the Claude models in the example config, which is enough for a few test requests before you top up.
Can I connect OpenClaw to Telegram or Feishu?
Yes. Once the provider works, add a connectors entry to the same openclaw.json, restart OpenClaw and pair with openclaw pair telegram or openclaw pair feishu. The APIKO docs have a step-by-step guide for each.