OpenClaw

One provider block in openclaw.json. Any model on the list.

Checked 2026-10-21

·All guides·Models

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.

~/.openclaw/openclaw.json
{
  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.

model entry
{
  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:

ModelinputcontextWindowmaxTokens
Claude Sonnet 5.5text, image1,000,000128,000
Claude Opus 5.5text, image1,000,000128,000
GPT-6.1 Soltext, image1,050,000128,000
Gemini 3.1 Pro Previewtext, image, audio, video1,048,57665,536
DeepSeek V4 Pro 0813text1,048,576393,216
Kimi K3text, image, video1,048,5761,048,576
GLM 5.3text1,000,000131,072
DeepSeek V4.1 Flashtext, image1,048,576393,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

shell
openclaw models list --provider uplinkswitch
openclaw models status

The 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.

shell
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.

shell
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.

ModelInput / 1MOutput / 1MList inputList outputUnder list30k in + 1k out
Claude Sonnet 5.5$1.20$3.00$2.00$10.0070%$0.039
Claude Opus 5.5$2.80$10.00$4.00$20.0050%$0.094
GPT-6.1 Sol$0.60$3.00$2.00$10.0070%$0.021
Gemini 3.1 Pro Preview$1.20$7.20$2.00$12.0040%$0.0432
DeepSeek V4 Pro 0813$0.792$1.188$1.32$3.9670%$0.0249
Kimi K3$0.90$4.50$3.00$15.0070%$0.0315
GLM 5.3$0.3276$1.0296$1.092$3.43270%$0.0109
DeepSeek V4.1 Flash$0.06$0.18$0.30$1.2085%$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.vars or ~/.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.3 is not callable: the id is not in models[] 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 carries retry-after, in seconds; send again after it.
  • reasoning_effort rejected: set compat.supportsReasoningEffort: false on the model entry, and the field stays out of the request.

Good to know

  • Only the ids in models[] are callable. agents.defaults.models holds 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: true sends reasoning_effort when thinking is on. Set compat.supportsReasoningEffort: false on the entry if that field is rejected.
  • Custom endpoints do not inherit a catalog route's Code Mode tier. Leave compat.codeMode alone unless you have tested it.
  • Every response carries x-uplink-request-id. Quote it when reporting a problem, or fetch GET /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.

Questions

By input price, which is what an agent re-sends on every turn, DeepSeek V4.1 Flash has the lowest input price in the table at $0.06 per million tokens, $0.18 out. Claude Sonnet 5.5 is $1.20 in and $3.00 out. Every price in the table sits under the developer's list, and the Claude Code API cost post works a day and a month of agent use at these rates.

Yes. Every Claude id here answers the OpenAI chat completions format, so one provider block with api openai-completions covers Claude, GPT, Gemini and DeepSeek. No Anthropic-format block is needed; set reasoning: true on the Claude entries and add image to input.

No. The key bills per token from a prepaid balance with no monthly fee, and each paid top-up locks your rates for 30 days, inside which a price can only go down. The coding plans versus API post compares a flat-rate plan with per-token billing: pay-per-token wins for variable use, a flat plan wins when you run the agent all day.

Only the ids in models[] under the provider are callable; agents.defaults.models holds aliases and metadata and does not register a model. Add the id to models[], save, and run openclaw models list --provider uplinkswitch. If the id is right but the request returns 404 model_not_found, check the spelling against the Models page.

No. On a host other than OpenAI, OpenClaw drops prompt-cache hints along with the developer role, service_tier and store flags. 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, and at the input rate otherwise.

Yes. One balance covers every key on the account, so create one key per tool and the console shows each tool’s spend apart. Claude Code takes the key through ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN; OpenClaw takes it through UPLINKSWITCH_API_KEY in the provider block.

The cost of that request in USD, on every non-streamed response, next to x-uplink-request-id. A streamed response has the same figure at GET /v1/requests/{id} once it finishes, with input_tokens, cache_read_tokens and output_tokens.

Run openclaw models set uplinkswitch/gpt-6.1-sol, or edit agents.defaults.model.primary in openclaw.json. The Gateway watches the file and applies most changes on save; the new primary must already be in models[] under the provider.
Join on Telegram
Help