Skip to content
AI

OpenClaw Model Provider Setup: Run GPT, Claude, and Gemini Through One API

POSTED ON UPDATED ON 13 min read MixRoute

OpenClaw Model Provider Setup: Run GPT, Claude, and Gemini Through One API
OpenClaw Model Provider Setup: Run GPT, Claude, and Gemini Through One API

To run GPT, Claude, Gemini and other models in OpenClaw, add MixRoute as a custom provider in ~/.openclaw/openclaw.json. Set baseUrl to https://api.mixroute.ai/v1, set api to openai-completions, list the model IDs you want under the provider’s models, and point agents.defaults.model.primary at mixroute/your-model-id. One provider entry and one key then reach 250+ models. Backups go in agents.defaults.model.fallbacks, so a failed primary does not stop scheduled jobs. The examples use gemini-3.8-flash, claude-sonnet-5-5 and kimi-k3, checked against MixRoute model pages on 2026-10-19.

You self hosted OpenClaw for control. The model is still the catch.

OpenClaw keeps your context, skills and history on your own hardware and talks to you through Telegram, Discord and other channels. The model is the part that is not local, because every request goes out to a provider.

Pointing OpenClaw at a single vendor means that vendor’s lineup, that vendor’s key and that vendor’s bill. It also means a single point of failure. An assistant that sends a morning briefing and watches alerts around the clock goes quiet when its one provider has a bad hour, because there is no second model to switch to.

What an OpenClaw model provider actually is

A model provider is an entry under models.providers in the OpenClaw config. Each entry holds a base URL, a key, an API type and a list of model IDs. For OpenAI compatible gateways the API type is openai-completions, which OpenClaw’s docs use for custom endpoints. The other value in OpenClaw’s custom-provider examples is anthropic-messages.

You declare the provider once, list the models, and refer to each one as provider/model-id. A model ref such as mixroute/gemini-3.8-flash goes into agents.defaults.model.primary, and a list of backups goes into fallbacks. OpenClaw accepts a list of backup models, so a gateway that exposes many models behind one provider fits that design.

MixRoute is that kind of gateway: one OpenAI compatible endpoint for 250+ models, including GPT, Claude, Gemini, DeepSeek and open models such as Kimi. Switching models means changing the model ID in one line of openclaw.json. A single balance covers every model, topped up with Visa, Mastercard or JCB, or with USDT or USDC, and credits never expire.

Powering OpenClaw: single vendor vs local vs a gateway

A gateway gives the widest model choice with the least account work, local models give the most privacy, and a single vendor sits in between on capability but narrowest on choice. The table compares the three.

ApproachModels you can reachSwitch modelsWhen a provider goes downBilling
Single cloud vendorThat one vendor’s modelsNew account and key per vendorOpenClaw fallbacks only help if you also hold keys for another vendorOne bill per vendor
Local models on your hardwareWhatever your machine can runDownload another modelNot applicable, it is your boxNo usage bill, but you buy the hardware
MixRoute gateway250+ across vendorsChange one model IDAutomatic failover on the gateway side, plus OpenClaw fallbacksOne balance, card or USDT/USDC

Local models are the purest privacy option, and the limit is hardware. A laptop or a Mac mini will not run a frontier model at full size, so you trade capability for locality. A single cloud vendor gives frontier capability but brings back the per-vendor accounts and lock in that self hosting was meant to avoid. The gateway gives frontier models on demand under one key.

The three also combine. Say a household assistant answers routine private messages from a local model and sends heavy reasoning to a gateway model. Because fallbacks can name models from different providers, one config can hold both.

How to connect OpenClaw to MixRoute

Get OpenClaw running on its own first, then add the MixRoute provider in four steps. With a working baseline, a later error is either a setup problem or a provider problem, never both.

Before you start

  • Node.js 24.16 or newer, or 26.1 or newer. OpenClaw recommends Node 26, and Node 22 is not supported.
  • A MixRoute API key from the MixRoute console.
  • The MixRoute base URL: https://api.mixroute.ai/v1. The /v1 suffix is required.

Step 1: Get OpenClaw running first

On macOS or Linux, run the installer, which starts the onboarding wizard. The second command runs onboarding with the Gateway installed as a background service.

Code
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw onboard --install-daemon
openclaw gateway status
openclaw dashboard

On Windows, the PowerShell installer is iwr -useb https://openclaw.ai/install.ps1 | iex. OpenClaw is healthy when openclaw gateway status shows the Gateway listening on port 18789 and openclaw dashboard opens the Control UI in your browser. Telegram and Discord can wait.

Step 2: Store your MixRoute key as an environment variable

Keep the key out of the config file. Set it in your shell, in the service environment, or in a .env file OpenClaw can read.

Code
export MIXROUTE_API_KEY="sk-your-mixroute-key"

Step 3: Add MixRoute as a provider in openclaw.json

The config file is ~/.openclaw/openclaw.json. Add MixRoute under models.providers, list the models, and set the default. With "mode": "merge", OpenClaw keeps its built in providers next to the new one.

Code
{
  "models": {
    "mode": "merge",
    "providers": {
      "mixroute": {
        "baseUrl": "https://api.mixroute.ai/v1",
        "apiKey": "${MIXROUTE_API_KEY}",
        "api": "openai-completions",
        "models": [
          { "id": "gemini-3.8-flash", "name": "Gemini 3.8 Flash", "contextWindow": 1048576, "maxTokens": 65536 },
          { "id": "claude-sonnet-5-5", "name": "Claude Sonnet 5.5", "contextWindow": 1000000, "maxTokens": 128000 },
          { "id": "kimi-k3", "name": "Kimi K3", "contextWindow": 1048576, "maxTokens": 1048576 }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "mixroute/gemini-3.8-flash",
        "fallbacks": ["mixroute/claude-sonnet-5-5", "mixroute/kimi-k3"]
      },
      "models": {
        "mixroute/gemini-3.8-flash": { "alias": "flash" },
        "mixroute/claude-sonnet-5-5": { "alias": "sonnet" },
        "mixroute/kimi-k3": { "alias": "kimi" }
      }
    }
  }
}

Three things have to line up: the provider name (mixroute), the id values under models, and the mixroute/model-id refs in primary and fallbacks. The agents.defaults.models block only adds aliases. It does not register a model, so every ref still needs a matching entry under models.providers.mixroute.models.

The IDs and limits come from each MixRoute model page. Copy the Model ID from the spec card, not from the address bar: the gemini-3.8-flash page lives at /models/gemini-3-8-flash/.

MixRoute model page for Gemini 3.8 Flash showing Model ID gemini-3.8-flash, 1.048576M context length and 65.536K max output
The spec card on the model page gives the exact Model ID, context length and max output to copy into openclaw.json. Source: MixRoute, captured 2026-10-19.
ModelModel IDContext lengthMax output
Gemini 3.8 Flashgemini-3.8-flash1.048576M65.536K
Claude Sonnet 5.5claude-sonnet-5-51M128K
Kimi K3kimi-k31.048576M1.048576M
GPT-6.1 Solgpt-6.1-sol1.05M128K

The table shows the values as the MixRoute pages print them. The config writes 1M as 1000000 and 128K as 128000. GPT works the same way as the others: add an entry with "id": "gpt-6.1-sol" and refer to it as mixroute/gpt-6.1-sol.

Six OpenClaw config keys with the values used for MixRoute: baseUrl, api, apiKey, models id, primary and fallbacks
Provider keys live under models.providers.mixroute, and the model refs in agents.defaults.model must repeat the id as mixroute/model-id.

contextWindow and maxTokens are optional for a custom provider, but they matter for long context models. OpenClaw’s docs say an omitted contextWindow stays unset and context budgeting then falls back to 200000 tokens, far below the 1M these models list. maxTokens sets the output ceiling for that model, and Kimi K3’s page lists a max output equal to its full context, so lower that value if you want shorter replies.

Callout stating that an omitted contextWindow makes OpenClaw budget 200000 tokens for a custom provider model
Set contextWindow and maxTokens per model, or OpenClaw plans around a 200000 token window.

Step 4: Validate and verify the connection

The Gateway watches the config file and applies edits on its own, and it skips an edit that is invalid. Check the file, and let OpenClaw repair what it can:

Code
openclaw config validate
openclaw doctor --fix
openclaw models list --provider mixroute

The last command should list the three mixroute/ refs. In a chat, /models mixroute lists the same refs, and /model flash switches the current session to the alias you set. A reply from the model confirms the whole path: key, base URL, API type and model ID.

Why fallbacks matter more for an always on assistant

Fallbacks matter because an unattended assistant has no one to retry for it. A chatbot you open on purpose can wait out an outage. An assistant that runs scheduled tasks misses the jobs that fall inside the outage.

Two layers cover this, and they sit in different places. MixRoute’s FAQ lists automatic failover when a provider goes down, which happens on the gateway before the answer reaches OpenClaw. OpenClaw’s own fallbacks list works on your side: when the primary model fails, the next model in the list takes the turn.

One case needs your own setup. If MixRoute itself were unreachable, every mixroute/ fallback would fail with it. A last entry that points at a different provider, such as a local model, covers that. OpenClaw’s docs show fallback lists that mix providers.

The same config also controls spend. Point primary at a cheap fast model for routine messages, and keep a stronger model in the list for work that needs real reasoning. Changing the mix is an edit to openclaw.json, not a new account.

How OpenClaw model fallback behaves

OpenClaw moves to the next model only after the current one has failed in a way it counts as worth failing over. Per its Model failover page, it works in two stages: rotate auth profiles within the current provider, then try the next model in agents.defaults.model.fallbacks. Before either, it makes a bounded retry on the same model for temporary rate limits and provider failures, and continues the existing transcript so partial output survives.

Five stages of OpenClaw model failover in order: retry the same model, rotate auth profile, next fallback model, answer the turn, report failure
The fallback list is the third stage, reached only after retries and auth-profile rotation on the current provider.

A fallback answers one turn and nothing more. The session’s selected model stays the same, and OpenClaw periodically probes the original primary and returns to it after recovery. If every candidate fails, the run ends with an error that lists each attempt.

The catch is that not every model selection falls back. The configured default and a cron job’s model use the fallback list. A model you pick yourself with /model, when it differs from the agent’s default, is strict: if it becomes unreachable, the run fails visibly instead of moving to another model. To follow the config again, run /model default.

OpenClaw documentation table listing which model selection sources use fallbacks and which are strict, including user session selection
OpenClaw's docs list which selections use the fallback list and which, like a model picked with /model, fail visibly. Source: OpenClaw documentation, captured 2026-10-19.

Troubleshooting the OpenClaw MixRoute connection

Most problems are one of these.

  • Missing /v1 in baseUrl. The base URL must be exactly https://api.mixroute.ai/v1.
  • Wrong model ID. Your primary and fallbacks values must match the id fields under models.providers.mixroute.models, and those must match the Model ID on the MixRoute model page.
  • Model missing from /models. An alias under agents.defaults.models does not add a model. Add the entry under models.providers.mixroute.models.
  • New primary ignored. A session pinned to an earlier model keeps it. Run /model default to follow the config.
  • Key not visible to the service. If the Gateway runs as a background service, confirm it can read MIXROUTE_API_KEY in its own environment.
  • Rate limit on a busy day. Parallel agents and scheduled jobs can hit the account limit. MixRoute’s FAQ puts new accounts at 50 RPM, rising to 100 RPM after the first top-up.
  • Need to see the actual error. Run openclaw gateway --port 18789 in the foreground to read the logs, then openclaw doctor --fix to repair the config.

FAQ

What is the best model provider for OpenClaw? It depends on what you need. For frontier models without tying yourself to one vendor, a gateway like MixRoute lets OpenClaw reach 250+ models through one provider entry. For maximum privacy, run a local model on your own hardware and accept the capability ceiling. You can combine them, with the local model as the last fallback.

Can OpenClaw use Claude and GPT at the same time? Yes. Through a single MixRoute provider you can set one model as primary and others as fallbacks, mixing vendors freely, for example Gemini 3.8 Flash first, then Claude Sonnet 5.5 and GPT-6.1 Sol. Each needs its own entry under the provider’s models list. OpenClaw reaches all of them through the one openai-completions provider.

How do I change the model OpenClaw uses? Edit agents.defaults.model.primary in ~/.openclaw/openclaw.json to another mixroute/model-id, as long as that ID is listed under the provider’s models. For a single chat session, /model with a ref or alias switches it without touching the file. No new account or key is needed either way.

Does connecting a cloud gateway break OpenClaw’s privacy? Not for the data OpenClaw stores: memory, skills and history stay on your machine. Each request still carries what the model needs to answer, the same as with any cloud provider, so those prompts leave your machine and pass through the gateway to the model provider. For work that must stay local, use a local model for that agent.

Why does my OpenClaw model fail even though the key is set? Usually the model ID does not match what the provider exposes, or the base URL is missing /v1. Run openclaw gateway --port 18789 in the foreground to read the actual error in the logs.

Can I pay for OpenClaw’s AI usage with crypto? Yes. MixRoute self-serve top-ups accept USDT and USDC as well as Visa, Mastercard and JCB. You fund one balance that powers every model your assistant uses, and credits never expire.

Does OpenClaw switch to another provider automatically when one goes down? It switches to another model, yes, if you list one in fallbacks. OpenClaw makes a bounded retry on the failing model, then tries the next entry, which can sit on a different provider. A model you chose by hand with /model does not fall back. MixRoute’s FAQ also lists automatic failover when a provider goes down, handled on the gateway.

The bottom line

Start with the config from Step 3: one mixroute provider, a cheap fast primary, and one or two stronger fallbacks. Add a local model as the last fallback if the assistant must keep answering when the gateway is unreachable. Later changes are single lines in openclaw.json, because every model sits behind the same key. Start building on MixRoute

Scan to share
Scan to share
AI How to Pay for AI APIs With PYUSD (PayPal USD) MixRoute 11 min read AI How to Pay for AI APIs With Bitcoin, On Chain or Over Lightning MixRoute 10 min read AI How to Pay for AI APIs With ETH (And When You Should Not) MixRoute 12 min read