·SuperBuilder Team

OpenClaw API Keys: Which LLM Provider to Choose? (2026)

openclawapillmanthropicopenaigoogleclaudegpt

OpenClaw API Keys: Which LLM Provider to Choose? (2026)

OpenClaw supports multiple LLM providers, and choosing the right one significantly affects your agent's quality, speed, and cost. This guide compares the three major providers — Anthropic, OpenAI, and Google — with current pricing, quality analysis, and recommendations for different use cases.

LLM provider comparison overview
LLM provider comparison overview

The Three Major Providers

Anthropic (Claude)

Anthropic makes Claude, widely regarded as the best model for agentic tasks in 2026. Claude excels at following complex instructions, writing code, and maintaining context across long conversations.

Available Models:

ModelInput/1M tokensOutput/1M tokensContext WindowStrengths
Claude Opus 4$15.00$75.00200KBest reasoning, most capable
Claude Sonnet 4$3.00$15.00200KBest value for quality
Claude Haiku 3.5$0.25$1.25200KFast and cheap

Why choose Anthropic:

Setup:

# Get your API key from https://console.anthropic.com
openclaw config set llm.provider anthropic
openclaw config set llm.api_key "sk-ant-your-key-here"
openclaw config set llm.model "claude-sonnet-4-20250514"

OpenAI (GPT)

OpenAI is the most well-known provider and offers competitive pricing, especially at the lower tiers.

Available Models:

ModelInput/1M tokensOutput/1M tokensContext WindowStrengths
o3$10.00$40.00200KAdvanced reasoning
GPT-4o$2.50$10.00128KStrong all-around
GPT-4o mini$0.15$0.60128KCheapest capable model

Why choose OpenAI:

Setup:

openclaw config set llm.provider openai
openclaw config set llm.api_key "sk-your-key-here"
openclaw config set llm.model "gpt-4o"

Google (Gemini)

Google offers the most generous free tier and competitive pricing at scale.

Available Models:

ModelInput/1M tokensOutput/1M tokensContext WindowStrengths
Gemini 2.5 Pro$1.25$10.001MEnormous context window
Gemini 2.5 Flash$0.075$0.301MCheapest capable model
Gemini 2.5 Pro (free)FreeFree1MRate-limited free access

Why choose Google:

Setup:

openclaw config set llm.provider google
openclaw config set llm.api_key "AIza-your-key-here"
openclaw config set llm.model "gemini-2.5-pro"

Pricing per million tokens bar chart
Pricing per million tokens bar chart

Quality Comparison

Price is only half the equation. Here is how the models compare in quality for typical OpenClaw tasks:

Instruction Following

How well does the model adhere to your SOUL.md rules?

ModelScoreNotes
Claude Opus 49.5/10Best in class. Follows nuanced instructions precisely
Claude Sonnet 49/10Nearly as good as Opus for most rules
o38.5/10Strong but occasionally ignores subtle constraints
GPT-4o8/10Good but can drift on long conversations
Gemini 2.5 Pro8/10Solid but less refined than Claude
GPT-4o mini7/10Misses nuances in complex instructions
Gemini Flash7/10Fast but less precise
Claude Haiku7.5/10Good for simple instructions

Code Generation

ModelScoreNotes
Claude Opus 49.5/10Excellent across all languages
Claude Sonnet 49/10Great for most coding tasks
o39/10Strong reasoning about code
GPT-4o8.5/10Good general coding
Gemini 2.5 Pro8.5/10Improving rapidly

Tool Use / Skill Execution

ModelScoreNotes
Claude Sonnet 49.5/10Best tool use implementation
Claude Opus 49/10Excellent but slower
GPT-4o8.5/10Mature function calling
Gemini 2.5 Pro8/10Good but occasionally malforms calls

Long Context Retention

ModelScoreNotes
Gemini 2.5 Pro9.5/101M context, excellent retrieval
Claude Opus 49/10200K context, very accurate
Claude Sonnet 48.5/10200K context, reliable
GPT-4o8/10128K context, occasional misses

Quality comparison radar chart
Quality comparison radar chart

Cost Scenarios

Scenario 1: Light Personal Use (500K tokens/month)

ProviderModelMonthly Cost
GoogleGemini Flash$0.19
GoogleGemini Pro (free)$0.00
OpenAIGPT-4o mini$0.38
AnthropicClaude Haiku$0.75
OpenAIGPT-4o$6.25
AnthropicClaude Sonnet$9.00

Recommendation: Google Gemini free tier or Flash for budget users. Claude Haiku if you want better quality.

Scenario 2: Daily Power Use (5M tokens/month)

ProviderModelMonthly Cost
GoogleGemini Flash$1.88
OpenAIGPT-4o mini$3.75
AnthropicClaude Haiku$7.50
GoogleGemini Pro$56.25
AnthropicClaude Sonnet$90.00
OpenAIGPT-4o$62.50

Recommendation: Claude Sonnet for quality, Gemini Flash for budget.

Scenario 3: Heavy Business Use (20M tokens/month)

ProviderModelMonthly Cost
GoogleGemini Flash$7.50
OpenAIGPT-4o mini$15.00
AnthropicClaude Haiku$30.00
OpenAIGPT-4o$250.00
AnthropicClaude Sonnet$360.00
AnthropicClaude Opus$1,800.00

Recommendation: Use model routing — Claude Sonnet for complex tasks, Gemini Flash for simple ones.

Setting Up Multiple Providers

One of OpenClaw's strengths is multi-provider support. Configure multiple providers and route requests based on task complexity:

llm:
  providers:
    anthropic:
      api_key: "${ANTHROPIC_API_KEY}"
      models:
        - claude-sonnet-4-20250514
        - claude-opus-4-20250514
    openai:
      api_key: "${OPENAI_API_KEY}"
      models:
        - gpt-4o
        - gpt-4o-mini
    google:
      api_key: "${GOOGLE_API_KEY}"
      models:
        - gemini-2.5-pro
        - gemini-2.5-flash

  routing:
    default: "claude-sonnet-4-20250514"
    simple_queries: "gemini-2.5-flash"
    complex_reasoning: "claude-opus-4-20250514"
    code_generation: "claude-sonnet-4-20250514"
    
  fallback:
    - "gpt-4o"  # If primary fails, try this
    - "gemini-2.5-pro"  # Then this

This setup gives you the best quality where it matters and saves money on routine tasks.

Multi-provider routing diagram
Multi-provider routing diagram

How to Get API Keys

Anthropic

  1. Go to console.anthropic.com
  2. Create an account
  3. Add a payment method (required even for free credits)
  4. Go to API Keys and create a new key
  5. Copy the key — it starts with sk-ant-

New accounts get $5 in free credits.

OpenAI

  1. Go to platform.openai.com
  2. Sign up or log in
  3. Go to API Keys in the sidebar
  4. Create a new secret key
  5. Copy the key — it starts with sk-

New accounts get $5 in free credits for the first 3 months.

Google

  1. Go to aistudio.google.com
  2. Sign in with your Google account
  3. Click "Get API Key"
  4. Create a key in a new or existing project
  5. Copy the key — it starts with AIza

Free tier available with rate limits. No credit card required.

Switching Providers

If you want to switch your primary provider:

# Change provider and model
openclaw config set llm.provider anthropic
openclaw config set llm.model "claude-sonnet-4-20250514"
openclaw config set llm.api_key "sk-ant-new-key"

# Restart to apply
openclaw restart

# Verify
openclaw config get llm

Your conversation history and memory persist across provider switches. The agent may behave slightly differently with a new model, so update your SOUL.md if needed.

API Key Security

Store Keys Securely

Never put API keys directly in config.yaml. Use environment variables:

# In .env file (chmod 600)
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=AIza...
# In config.yaml, reference variables
llm:
  api_key: "${ANTHROPIC_API_KEY}"

Set Spending Limits

Every provider allows spending limits. Set them immediately after creating your key:

Rotate Keys Periodically

Change your API keys every 90 days:

# Generate new key in provider dashboard
# Update your .env
nano ~/.openclaw/.env

# Restart
openclaw restart

Monitor Usage

Set up spending alerts via email. If your agent's token usage spikes unexpectedly, you want to know immediately. Use Inbounter to send yourself spending alerts:

openclaw cron add --name "cost-alert" "0 * * * *" \
  "Check today's API spending. If it exceeds $5, send an alert 
   email via Inbounter to admin@company.com with the current 
   spending amount and breakdown by model."

API key security best practices
API key security best practices

Our Recommendation

For most OpenClaw users in 2026:

  1. Start with Claude Sonnet 4 as your primary model. It offers the best balance of quality, speed, and cost for agentic tasks.

  2. Add Gemini Flash as your budget model for simple queries and cron jobs.

  3. Keep Claude Opus 4 available for complex reasoning tasks that justify the premium price.

  4. Use model routing to automatically direct queries to the right model based on complexity.

This multi-provider setup gives you top-tier quality where it matters while keeping monthly costs reasonable.

Frequently Asked Questions

Can I use a local LLM with OpenClaw?

Yes. OpenClaw supports Ollama and llama.cpp. Set llm.provider: ollama and point to your local instance. Quality will be lower than cloud APIs but cost is zero after hardware investment.

Which provider has the best uptime?

All three major providers have 99.9%+ uptime. Configure fallback providers so if one goes down, your agent automatically switches to another.

Do I need separate API keys for each model?

No. Each API key gives you access to all models available on your tier within that provider.

Can I use Claude for free?

Claude does not have a free API tier. Anthropic gives $5 in initial credits for new accounts. After that, you pay per token. Google Gemini is the only major provider with an ongoing free tier.

How do I check my current API spending?

openclaw costs estimate  # Shows estimated spending
# Or check directly in each provider's dashboard

Will switching providers affect my agent's personality?

Slightly. Different models interpret SOUL.md differently. After switching, test your agent and adjust SOUL.md wording if the behavior changes in unwanted ways.


Need your OpenClaw agent to send emails or SMS? Inbounter provides communication APIs designed for AI agents. Works with any LLM provider.

SuperBuilder

Build faster with SuperBuilder

Run parallel Claude Code agents with built-in cost tracking, task queuing, and worktree isolation. Free and open source.

Download for Mac