If you're setting up an AI agent for the first time, you've probably hit the "API key" question. What is it? Where do you get one? And why are there different providers?
This guide explains everything in plain English — no prior AI experience needed.
What is an API key?
An API key is like a password that lets your AI agent talk to an AI model (like Claude or GPT). Without it, the agent can't think.
You pay for each request based on how many "tokens" (roughly words) the AI processes. Think of it like a utility bill — you pay for what you use.
Anthropic: direct access to Claude
Anthropic is the company that makes Claude — the AI model that powers MyClaw agents by default.
Pros: - Direct connection — no middleman, lowest latency - Most reliable — you're hitting Anthropic's servers directly - Best for Claude — access to the latest Claude models first
Cons: - Claude only — can't switch to GPT, Gemini, or other models - Rate limits — stricter per-minute limits on new accounts
How to get an Anthropic API key
- Go to console.anthropic.com
- Create an account or sign in
- Navigate to Settings → API Keys
- Click "Create Key"
- Copy the key (starts with
sk-ant-)
Anyone with your API key can make requests that you'll be billed for. Never commit it to Git, share it in screenshots, or paste it in public chats.
OpenRouter: one key, many models
OpenRouter is a unified API gateway that gives you access to dozens of AI models through a single API key.
Pros: - Model flexibility — switch between Claude, GPT-4, Gemini, Llama, and more - Fallback support — if one model is down, route to another - Single billing — one account, one invoice, many models
Cons: - Slightly higher latency — extra hop through OpenRouter's servers - Small markup — OpenRouter adds a fee on top of provider pricing - Dependency — if OpenRouter has issues, all your models are affected
How to get an OpenRouter API key
- Go to openrouter.ai
- Create an account
- Add credits ($5 minimum)
- Copy your API key from the dashboard
Which should you use?
| Anthropic Direct | OpenRouter | |
|---|---|---|
| Best for | Production agents that only need Claude | Experimentation and multi-model setups |
| Latency | Lowest | Slightly higher |
| Model access | Claude only | 50+ models |
| Pricing | Direct pricing | Small markup |
| Reliability | Very high | High (depends on upstream) |
For most MyClaw users, Anthropic direct is the best choice. Claude is the default model and direct access gives you the best performance. Use OpenRouter if you specifically need access to multiple models or want to experiment.
Using your key with MyClaw
MyClaw supports both providers. When you deploy an agent:
- Go to your instance settings
- Under AI Provider, choose Anthropic or OpenRouter
- Paste your API key
- Select your preferred model
- Save — your agent will start using the new key immediately
Every MyClaw plan includes $15/month worth of Anthropic API credits. You only need your own key if you exceed that allowance or want to use a different provider.
Keeping your keys safe
A few best practices:
- Never share keys publicly — treat them like passwords
- Rotate regularly — create a new key every few months and revoke old ones
- Set spending limits — both Anthropic and OpenRouter let you set monthly caps
- Use separate keys per project — makes it easy to track costs and revoke access
That's it — you now understand the two main ways to power your AI agent. Pick one, get your key, and you're ready to go.