OpenClaw with AI Gateway
OpenClaw is a self-hosted gateway that connects messaging platforms and coding agents. Add AI Gateway as a model provider so every agent and channel shares one key, one model catalog, and one spend view.
Run the Vercel CLI setup command for OpenClaw:
npx vercel ai-gateway setup --agent openclawThe command provisions a key, adds the provider and a starter model list to ~/.openclaw/openclaw.json, and exports AI_GATEWAY_API_KEY from a managed block in your shell startup file.
If you can't use the Vercel CLI, configure OpenClaw manually:
Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.
Add the key to your shell configuration file, for example
~/.zshrcor~/.bashrc:Terminalexport AI_GATEWAY_API_KEY="your-ai-gateway-api-key"OpenClaw reads
~/.openclaw/openclaw.json. Add the gateway undermodels.providers:~/.openclaw/openclaw.json{ "models": { "providers": { "vercel-ai-gateway": { "baseUrl": "https://ai-gateway.vercel.sh/coding-agent/v1", "apiKey": "${AI_GATEWAY_API_KEY}", "api": "openai-completions", "models": [ { "id": "anthropic/claude-opus-5", "name": "Claude Opus 5 (Gateway)" }, { "id": "openai/gpt-6-astra", "name": "GPT-6 Astra (Gateway)" }, { "id": "google/gemini-3.6-flash", "name": "Gemini 3.6 Flash (Gateway)" } ] } } }, "agents": { "defaults": { "model": { "primary": "vercel-ai-gateway/anthropic/claude-opus-5" } } } }The
${...}reference is OpenClaw's own environment syntax, resolved when it loads the config, so your key stays out of the file.https://ai-gateway.vercel.sh/coding-agent/v1is the coding agent surface, the default base URL for agents that have no dedicated endpoint. It's the same URL the setup command writes.OpenClaw watches its config file and applies most changes on its own. If the new provider doesn't show up, restart the gateway process.
- Browse the models catalog for available models
- Read OpenClaw's model provider documentation
- Configure spend limits on your API key
- Connect your other agents with the Vercel CLI
Was this helpful?