ModelStream LogoModelStream Logo
Models
Video API
Image API
Chat API
Audio API
Studio
Pricing
Docs
Menu
IntroductionQuickstartAPI KeysUse with Hermes AgentUse with OpenClaw
Model ListBilling Guide
ModelStream
Getting Started
Use with OpenClaw

Use ModelStream with OpenClaw

Run your OpenClaw agent on ModelStream — every model, every modality, one endpoint. Drop-in OpenAI-compatible, with smart routing that cuts the average bill ~18% and built-in failover so your agent keeps running when a provider goes down.

~10 minutes
~18% lower average bill
Built-in failover
No card required

You'll need a ModelStream account (modelstream.ai — no card required) and a machine running macOS, Linux, or Windows.

How it works

OpenClaw supports any OpenAI-compatible provider through its models.providers config. ModelStream exposes a single OpenAI-compatible endpoint in front of 300+ models, so you register it once as a custom provider and then switch models by changing one string — no new auth, no code changes.

Step 1 — Install OpenClaw

Skip this if OpenClaw is already installed.

macOS / Linux / WSL2

bash
curl -fsSL https://openclaw.ai/install.sh | bash

Windows (PowerShell)

powershell
iwr -useb https://openclaw.ai/install.ps1 | iex

The installer detects your OS, installs Node if needed (Node 24 recommended, 22.19+ minimum), and launches onboarding. Prefer managing Node yourself? npm install -g openclaw@latest && openclaw onboard --install-daemon.

Verify:

bash
openclaw --version
openclaw gateway status

Step 2 — Get your ModelStream API key

  1. 1Sign up at modelstream.ai.
  2. 2Go to Dashboard → API Keys → Create Key, name it (e.g. openclaw), and copy it.
  3. 3Export it where the OpenClaw gateway runs:
bash
export MODELSTREAM_API_KEY="ms-..."
If the gateway runs as a daemon (LaunchAgent/systemd), put the key in the gateway host's environment or reference it from config as shown below — a variable exported only in your interactive shell won't reach the daemon.

Step 3 — Register ModelStream as a provider

Add this to your OpenClaw config (~/.openclaw/openclaw.json):

openclaw.json
{
  agents: {
    defaults: {
      model: { primary: "modelstream/gpt-4o-mini" },
    },
  },
  models: {
    mode: "merge",
    providers: {
      modelstream: {
        baseUrl: "https://api.modelstream.ai/v1",
        apiKey: "${MODELSTREAM_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "gpt-4o-mini",
            name: "GPT-4o mini (via ModelStream)",
            input: ["text", "image"],
            contextWindow: 128000,
            maxTokens: 16384,
          },
          {
            id: "claude-sonnet",
            name: "Claude Sonnet (via ModelStream)",
            input: ["text", "image"],
            contextWindow: 200000,
            maxTokens: 64000,
          },
          {
            id: "modelstream-auto",
            name: "ModelStream Smart Routing",
            contextWindow: 128000,
            maxTokens: 16384,
          },
        ],
      },
    },
  },
}

Notes that save you a support ticket:

  • mode: "merge" keeps OpenClaw's built-in provider catalog alongside ModelStream.
  • Every model you want to call must appear in the provider's models[] list. If you also set agents.defaults.models (it acts as an allowlist), add each modelstream/<id> there too — otherwise you'll hit the classic "model not allowed" error even with a valid key.
  • Model refs are provider/model, e.g. modelstream/claude-sonnet.
  • Set input: ["text", "image"] on vision-capable models so image attachments are passed natively.
  • contextWindow/maxTokens are optional (defaults: 200000 / 8192) but set real values per model.

Step 4 — Set your default model and verify

bash
openclaw models set modelstream/gpt-4o-mini
openclaw models list     # ModelStream models should appear
openclaw doctor          # config sanity check

Then send your agent a message and run /models in the chat — your ModelStream models should be listed and selectable.

Switch models in one line. Routing the same agent to a different model is just:

bash
openclaw models set modelstream/claude-sonnet

Or let ModelStream pick the cheapest model that meets your quality bar:

bash
openclaw models set modelstream/modelstream-auto

Step 5 (optional) — Failover

ModelStream already does multi-region provider failover behind one model slug. For model-level fallbacks inside OpenClaw (e.g. fall back to a cheaper model if your primary is rate-limited), configure a fallback chain — see Model failover in the OpenClaw docs.

Troubleshooting

Symptom
Fix
"model not allowed"
Add the model to models.providers.modelstream.models[] and to agents.defaults.models if that allowlist is set.
401 / auth errors
Confirm MODELSTREAM_API_KEY is set in the gateway's environment, not just your shell. Restart the gateway after changing it.
404 on requests
Base URL must include /v1: https://api.modelstream.ai/v1.
Images sent as text
Add input: ["text", "image"] to that model's entry.
Slow/long responses time out
Set models.providers.modelstream.timeoutSeconds (e.g. 300).
Config not picked up
Run openclaw doctor, then restart: openclaw gateway restart.

Next steps

  • Browse the full catalog in your ModelStream dashboard and add slugs to the config as you need them.
  • Estimate your monthly bill with the ModelStream cost calculator.
  • Coming from OpenAI or Anthropic elsewhere in your stack? The migration is the same one-line base-URL swap — see the ModelStream migration guides.
Prefer Hermes Agent? Use ModelStream with Hermes Agent
ModelStream

Video API

  • Seedance 2.0
  • Happyhorse 1.0
  • Vidu Q3
  • Kling V3.0
  • Veo 3.1
  • Wan 2.7
  • More Video Models →

Image API

  • GPT Image 2
  • Nano Banana 2
  • Seedream 5.0
  • Imagen 4
  • Qwen Image 2.0
  • Z-Image Turbo
  • More Image Models →

Audio API

  • Suno Music
  • Qwen3 TTS Flash
  • More Audio Models →

Chat API

  • GLM-5.2
  • Claude Opus 4.8
  • Gemini 3.5 Flash
  • Qwen 3.7 Max
  • GPT 5.5
  • More Chat Models →

About Us

  • Privacy Policy
  • Terms of Service
  • Support
  • Enterprise

© 2026 ModelStream Inc. All rights reserved.