Stop Juggling API Keys: Setting up Vercel AI Gateway
I remember spending an entire afternoon trying to get three different LLM providers to play nice together. I had to manage separate rate limits, different auth headers, and varying JSON structures. It felt like I was writing boilerplate instead of building features. When I found out OpenClaw supports the Vercel AI Gateway, I switched immediately. It lets me hit hundreds of models through one API key and a single endpoint.
Using the gateway means I don’t have to update my code every time I want to try a new model. I just change a string in my config and keep moving.
What You’ll Need
Section titled “What You’ll Need”- An active Vercel account with an AI Gateway set up.
- The OpenClaw CLI installed on your machine.
- Your
AI_GATEWAY_API_KEY. - A terminal window open.
Quick Start
Section titled “Quick Start”You can get this running in about two minutes. First, you need to tell OpenClaw to use the gateway for authentication.
- Run the onboarding command:
openclaw onboard --auth-choice ai-gateway-api-key- Open your configuration file and set your primary model. Use the
vercel-ai-gatewayprefix followed by the provider and model name:
{ agents: { defaults: { model: { primary: "vercel-ai-gateway/anthropic/claude-opus-4.6" }, }, },}If you prefer to do everything in one command without the interactive prompts, use this:
openclaw onboard --non-interactive \ --mode local \ --auth-choice ai-gateway-api-key \ --ai-gateway-api-key "$AI_GATEWAY_API_KEY"Troubleshooting
Section titled “Troubleshooting”Sometimes things don’t work on the first try. Here are the two most common hiccups:
- API Key is missing in the background: If you run OpenClaw as a daemon (using launchd or systemd), the process might not see your shell’s environment variables. Make sure your
AI_GATEWAY_API_KEYis saved in~/.openclaw/.envso the daemon can find it. - Incorrect Provider String: The gateway uses an Anthropic-compatible API. Double-check that your model path follows the
provider/model-nameformat exactly as shown in the Vercel dashboard.
If you hit a wall that isn’t covered here, you can always ask the AI Setup Assistant for a hand.
What’s Next
Section titled “What’s Next”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.