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.

sequenceDiagram participant You as Your Agent participant API as AI Provider API participant Model as AI Model (Claude) You->>API: "What should I reply?" + API Key API->>API: Verify key & check quota API->>Model: Process request Model->>API: Generated response API->>You: "Here's what to say..."

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

  1. Go to console.anthropic.com
  2. Create an account or sign in
  3. Navigate to Settings → API Keys
  4. Click "Create Key"
  5. Copy the key (starts with sk-ant-)
⚠️
Keep your key secret

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.

graph TD Agent[Your AI Agent] -->|Single API Key| OR[OpenRouter] OR --> Claude[Anthropic Claude] OR --> GPT[OpenAI GPT-4] OR --> Gemini[Google Gemini] OR --> Llama[Meta Llama] OR --> Mistral[Mistral] style OR fill:#312e81,stroke:#a78bfa,color:#fff

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

  1. Go to openrouter.ai
  2. Create an account
  3. Add credits ($5 minimum)
  4. Copy your API key from the dashboard

Which should you use?

Our recommendation

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:

  1. Go to your instance settings
  2. Under AI Provider, choose Anthropic or OpenRouter
  3. Paste your API key
  4. Select your preferred model
  5. Save — your agent will start using the new key immediately
💡
MyClaw includes $15/month in AI credits

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:

flowchart LR Key[API Key Created] --> Use[Used in Agent] Use --> Monitor[Monitor Spending] Monitor --> Rotate[Rotate Every 90 Days] Rotate --> Key style Key fill:#14532d,stroke:#22c55e,color:#fff style Rotate fill:#1e1b4b,stroke:#3b82f6,color:#fff

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.