mOperator needs an AI model to work. You have two options for connecting one:
| AI Gateway (Recommended) | Direct API Key | |
|---|---|---|
| Setup | One Vercel API key | One provider-specific key |
| Switch models | Change an env var | Change code + keys |
| Providers | Anthropic, OpenAI, and more | One at a time |
| Logging | Built-in usage dashboard | Roll your own |
| Best for | Teams, production, flexibility | Quick start, single model |
Pick whichever fits your situation. You can always switch later.
AI Gateway is a proxy that routes your AI requests to any supported model provider. One key gives you access to Claude, GPT-4o, and future models. When a better model comes out, you change one env var — no refactoring, no new API keys, no code changes.
AI_PROVIDER in your env vars. No code changes.If you followed the Deploy to Vercel guide, you already have one. If not:
mOperator, set scope to your accountAdd to your .env.local:
AI_GATEWAY_API_KEY=your-vercel-token-here
AI_PROVIDER=anthropic
That's it. The default model is claude-sonnet-4-5-20250929. To use OpenAI instead:
AI_GATEWAY_API_KEY=your-vercel-token-here
AI_PROVIDER=openai
Optional overrides:
# AI_GATEWAY_URL=https://ai-gateway.vercel.sh # Default, rarely needs changing
# AI_MODEL=claude-sonnet-4-5-20250929 # Override specific model
If you just want to get running with a single provider and don't need the flexibility of AI Gateway, you can plug in an API key directly.
.env.local:ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxx
AI_PROVIDER=anthropic
.env.local:OPENAI_API_KEY=sk-xxxxxxxxxxxxx
AI_PROVIDER=openai
With direct keys, switching providers means getting a new API key from a different provider and updating your code/config. AI Gateway removes this friction — but either approach works.
Start your app:
npm run dev
Test via CLI:
npm run cli
Type something like:
hello, are you working?
If you get a response, you're connected.
mOperator defaults to these models:
| Provider | Default Model | Good For |
|---|---|---|
| Anthropic | claude-sonnet-4-5-20250929 | Tool use, structured data, long context |
| OpenAI | gpt-4o | General purpose, fast responses |
To override the model, set AI_MODEL in your .env.local:
AI_MODEL=claude-sonnet-4-5-20250929