Anthropic (Claude) with OpenClaw

Configure Claude Opus, Sonnet, and Haiku — OAuth or API key

Anthropic's Claude is the recommended LLM for OpenClaw: strong long-context handling, better resistance to prompt injection, and high-quality responses. OpenClaw supports Claude Pro and Claude Max subscriptions via OAuth (no API key needed) or API keys for pay-as-you-go or team access.

This guide covers model selection, OAuth vs API key authentication, and typical configuration.

Recommended Setup

Anthropic Pro or Max (100 or 200 requests per day) combined with Opus 4.6 gives the best balance of quality and cost. Use Opus 4.5 or Claude Sonnet for lighter workloads; Claude Haiku for fast, cheap tasks (heartbeats, simple lookups).

Models

  • Claude Opus 4.6 — Top tier, long context, best for complex tasks
  • Claude Opus 4.5 — Previous Opus generation
  • Claude Sonnet — Balanced speed and quality
  • Claude Haiku — Fast, inexpensive, good for background work

Configure model in your Gateway config, e.g. anthropic/claude-opus-4-6. Use tiered routing: reserve Opus for important conversations; use Haiku for scheduled checks and heartbeats. See Example Setups & Cost for patterns.

Authentication: OAuth vs API Key

OAuth (subscription): If you have Claude Pro or Claude Max, you can authenticate with your subscription—no API key. Uses your subscription limits. More convenient for personal use. Set up during openclaw onboard or in the Setup Wizard.

API key: Create an API key at console.anthropic.com. Use for pay-as-you-go, team plans, or when you prefer key-based auth. Store in ~/.openclaw/credentials or via openclaw secrets.

Basic Configuration

Minimal config
{
  "agent": {
    "model": "anthropic/claude-opus-4-6"
  }
}

Authentication is typically configured during onboarding or via environment variables. See Configuration guide for full options.

Why Anthropic for OpenClaw

  • Long context — Handles long conversations and documents well
  • Prompt-injection resistance — Better security for multi-user or group setups
  • Quality — Consistently strong reasoning and writing
  • OAuth support — Use your subscription without managing API keys

Related