OpenClaw
One provider block in openclaw.json. Any model on the list.
At the end you have OpenClaw running on one custom provider block in openclaw.json, with api: openai-completions and our base URL. Every model on the Models page is then a uplinkswitch/<model-id> ref, Claude included, with the primary set to the one you want. Each request bills per token from your prepaid balance, and the charge comes back on the response. A 30,000-in, 1,000-out turn on Claude Sonnet 5.5 costs $0.039 at $1.20 in and $3.00 out per million tokens.
Where the settings are
~/.openclaw/openclaw.json. It is JSON5, so comments and trailing commas are fine. The Gateway watches the file and applies most changes on save; a few need a restart.
OpenClaw takes an OpenAI-compatible base URL under models.providers with api: "openai-completions". Every model on the Models page answers in that format, Claude included.
You need a key from the console and the base URL https://api.uplinkswitch.com/v1. The same key works in Claude Code, OpenCode and the OpenAI and Anthropic SDKs; a key per tool keeps the spend apart on one balance.
The provider block
mode: "merge" keeps the bundled providers next to yours. Model refs are provider/model, so the primary becomes uplinkswitch/claude-sonnet-5-5.
{
env: { vars: { UPLINKSWITCH_API_KEY: "sk-uplink-live-..." } },
agents: {
defaults: { model: { primary: "uplinkswitch/claude-sonnet-5-5" } },
},
models: {
mode: "merge",
providers: {
uplinkswitch: {
baseUrl: "https://api.uplinkswitch.com/v1",
apiKey: "${UPLINKSWITCH_API_KEY}",
api: "openai-completions",
headers: { "HTTP-Referer": "https://uplinkswitch.ai", "X-Title": "OpenClaw" },
models: [
{ id: "claude-sonnet-5-5", name: "Claude Sonnet 5.5" },
{ id: "claude-opus-5-5", name: "Claude Opus 5.5" },
{ id: "gpt-6.1-sol", name: "GPT-6.1 Sol" },
{ id: "gemini-3.1-pro-preview", name: "Gemini 3.1 Pro" },
{ id: "deepseek-v4-pro-0813", name: "DeepSeek V4 Pro" },
{ id: "kimi-k3", name: "Kimi K3" },
],
},
},
},
}${UPLINKSWITCH_API_KEY} is read from the environment. Inline env.vars only apply when the process env lacks the key; ~/.openclaw/.env works as well. A missing variable stays unresolved and logs a warning. headers go out on every request, and the gateway files X-Title as the client app on the Usage page.
The six ids above are a starting list. Any id on the Models page goes in the same array; the model page for each one, such as Claude Sonnet 5.5, shows its price, context window and input types.
Per-model fields
reasoning, input, cost, contextWindow and maxTokens are optional. Defaults: reasoning: false, input: ["text"], zero cost, no fixed output limit (so max_tokens is left out of the request) and a 200000-token context fallback. OpenClaw recommends explicit values. Set input to include "image" for models that take images, or attachments go in as text.
{
id: "claude-sonnet-5-5",
name: "Claude Sonnet 5.5",
reasoning: true,
input: ["text", "image"],
// contextWindow and maxTokens: the model developer's published limits
}cost is OpenClaw's own field. The charge on your balance is the price in the table further down, whatever the entry says.
Claude, GPT, Gemini and DeepSeek in one provider block
Every id on the list answers the OpenAI chat completions format, so one block with api: "openai-completions" covers Claude as well. There is no Anthropic block to add and no second key. The values for input, contextWindow and maxTokens come from the catalog, which carries the developer's published specs:
| Model | input | contextWindow | maxTokens |
|---|---|---|---|
| Claude Sonnet 5.5 | text, image | 1,000,000 | 128,000 |
| Claude Opus 5.5 | text, image | 1,000,000 | 128,000 |
| GPT-6.1 Sol | text, image | 1,050,000 | 128,000 |
| Gemini 3.1 Pro Preview | text, image, audio, video | 1,048,576 | 65,536 |
| DeepSeek V4 Pro 0813 | text | 1,048,576 | 393,216 |
| Kimi K3 | text, image, video | 1,048,576 | 1,048,576 |
| GLM 5.3 | text | 1,000,000 | 131,072 |
| DeepSeek V4.1 Flash | text, image | 1,048,576 | 393,216 |
Live from GET /v1/catalog: the input types, context window and maximum output the developer publishes for each id.
Put "image" in input on claude-sonnet-5-5, claude-opus-5-5, gpt-6.1-sol, gemini-3.1-pro-preview, kimi-k3, deepseek-v4.1-flash. Leave it off a text-only row. Copy contextWindow and maxTokens from the two right-hand columns, so the 200000-token fallback and the missing max_tokens do not apply.
Check it
openclaw models list --provider uplinkswitch
openclaw models statusThe first lists the ids you declared under UplinkSwitch. The second shows the resolved primary model and its auth. Then send a message; the request shows in the console within seconds.
To change the default later: openclaw models set uplinkswitch/gpt-6.1-sol.
From a shell, one small request with -i prints the headers: x-uplink-request-id names the request and x-uplink-charge is what it cost in USD.
curl -i https://api.uplinkswitch.com/v1/chat/completions \
-H "Authorization: Bearer $UPLINKSWITCH_API_KEY" \
-H "content-type: application/json" \
-H "HTTP-Referer: https://uplinkswitch.ai" \
-H "X-Title: OpenClaw" \
-d '{"model": "claude-sonnet-5-5", "max_tokens": 16, "messages": [{"role": "user", "content": "Say ok."}]}'GET /v1/models with the key returns the ids that key can call. Every id in your models[] array should be in that list; one that is not returns 404 model_not_found or 403 scope_denied. An alias made in the console appears with alias_of and goes in models[] like any id.
curl https://api.uplinkswitch.com/v1/models \
-H "Authorization: Bearer $UPLINKSWITCH_API_KEY" \
-H "HTTP-Referer: https://uplinkswitch.ai" \
-H "X-Title: OpenClaw"What a session costs
An agent re-sends the whole conversation on every turn, so input dominates. The last column prices one turn of 30,000 input and 1,000 output tokens, with nothing counted at the cached rate.
| Model | Input / 1M | Output / 1M | List input | List output | Under list | 30k in + 1k out |
|---|---|---|---|---|---|---|
| Claude Sonnet 5.5 | $1.20 | $3.00 | $2.00 | $10.00 | 70% | $0.039 |
| Claude Opus 5.5 | $2.80 | $10.00 | $4.00 | $20.00 | 50% | $0.094 |
| GPT-6.1 Sol | $0.60 | $3.00 | $2.00 | $10.00 | 70% | $0.021 |
| Gemini 3.1 Pro Preview | $1.20 | $7.20 | $2.00 | $12.00 | 40% | $0.0432 |
| DeepSeek V4 Pro 0813 | $0.792 | $1.188 | $1.32 | $3.96 | 70% | $0.0249 |
| Kimi K3 | $0.90 | $4.50 | $3.00 | $15.00 | 70% | $0.0315 |
| GLM 5.3 | $0.3276 | $1.0296 | $1.092 | $3.432 | 70% | $0.0109 |
| DeepSeek V4.1 Flash | $0.06 | $0.18 | $0.30 | $1.20 | 85% | $0.002 |
USD per million tokens, live from GET /v1/catalog. List: the price on the developer’s own page. Under list: on output, rounded down.
Real-model check today: Claude Sonnet 5.5, steady since Oct 19; Claude Opus 5.5, steady since Oct 19; GPT-6.1 Sol, steady since Oct 19; Gemini 3.1 Pro Preview, steady since Nov 24; DeepSeek V4 Pro 0813, steady since Nov 24; Kimi K3, steady since Nov 6; GLM 5.3, steady since Oct 24; DeepSeek V4.1 Flash, steady since Nov 10. Each verdict is the live one from the real-model check, not a typed claim.
A hundred such turns on Claude Sonnet 5.5 come to $3.90, a working day for one agent. The same hundred turns on Claude Opus 5.5 come to $9.40, so pick the primary by the turn column and keep the larger model for the tasks that need it.
OpenClaw drops prompt-cache hints on a host other than OpenAI's, so price a session at the full input rate. When a response does report cached tokens, they bill at the cached rate on a model that has one; the Models page lists it per id. The Claude Code API cost post works a day and a month of agent use at these rates, and the LLM API pricing post puts the whole list next to each developer's page. Whether a per-token key or a flat plan comes out ahead for your hours is the coding plans versus API question: variable use favors the key, all-day use favors a plan.
Errors and fixes
${UPLINKSWITCH_API_KEY}unresolved, with a warning in the log: the variable is not in the process env,env.varsor~/.openclaw/.env. Set it in one of the three and save; the Gateway picks the file up on save.- A ref such as
uplinkswitch/glm-5.3is not callable: the id is not inmodels[]under the provider. Add{ id: "glm-5.3", name: "GLM 5.3" }to the array. 401 invalid_api_key: the key is wrong or revoked. Copy it again from the console and check the variable it lands in.404 model_not_found: the id is not on the Models page. Check the spelling; the id is the part after the slash in the ref.402 insufficient_balance: the balance does not cover the request. Top up in the console and the next request goes through.402 monthly_limit_reached: the key hit the monthly spend limit set on it. Raise the limit on the key, or wait for the first of the month, when the counter restarts.403 scope_denied: the key is limited to certain models and this is not one of them. Pick an allowed id or use a key without the limit.429 rate_limited: a rate limit refused the request: the account's tier or the key's own. The response carriesretry-after, in seconds; send again after it.reasoning_effortrejected: setcompat.supportsReasoningEffort: falseon the model entry, and the field stays out of the request.
Good to know
- Only the ids in
models[]are callable.agents.defaults.modelsholds aliases and metadata; it does not register a model on its own. - On a host other than OpenAI's, OpenClaw drops the developer role,
service_tier, store flags and prompt-cache hints from the request. Those are OpenAI-only fields; the Models page lists each model's cache read price. - A model with
reasoning: truesendsreasoning_effortwhen thinking is on. Setcompat.supportsReasoningEffort: falseon the entry if that field is rejected. - Custom endpoints do not inherit a catalog route's Code Mode tier. Leave
compat.codeModealone unless you have tested it. - Every response carries
x-uplink-request-id. Quote it when reporting a problem, or fetchGET /v1/requests/{id}with any key of the org for the token counts and the charge.
Get a key in the console: prepaid credit, no subscription, 30-day price lock.