Haven't installed OpenClaw yet? Click here for one-line install commands
curl -fsSL https://openclaw.ai/install.sh | bash
iwr -useb https://openclaw.ai/install.ps1 | iex
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Worried about affecting your computer? ClawTank runs in the cloud with no installation — no risk of accidental deletion
Key Findings
  • OpenClaw natively supports six API Providers (Anthropic, OpenAI, Google, DeepSeek, Ollama, OpenRouter), each authenticable via OAuth or API Key, with a Primary + Fallback dual-layer model switching mechanism[1]
  • In benchmark testing, Anthropic Claude 3.5 Sonnet performed best in code generation and reasoning tasks; Google Gemini 2.5 Flash offered the best cost-performance ratio for daily conversation and summarization tasks at extremely low cost[11]
  • DeepSeek V4 is currently the lowest-cost cloud model option in the OpenClaw ecosystem — input tokens at just $0.27/1M, suitable for bulk document processing and budget-sensitive use cases[6]
  • For local deployment, Ollama integration allows users to run OpenClaw in a completely offline environment, achieving near-cloud-model performance with open-source models like Qwen 2.5 32B or Llama 3.3 70B[7]
  • Enterprise deployments should adopt a three-layer Fallback strategy of "Claude Sonnet primary + GPT-4o backup + local model safety net" to ensure 99.9%+ service availability[8]
  • OAuth authentication eliminates key management complexity compared to API Keys but is limited by individual Provider rate quotas; API Keys offer more flexible usage control and billing separation[2]

1. Why Model Selection Is OpenClaw's Most Important Decision

As the most prominent open-source AI agent framework of 2026, OpenClaw's core capabilities come from the large language models (LLMs) it connects to.[10] However, different models vary enormously in reasoning ability, code generation quality, response speed, and cost structure. Choose the right model, and your AI agent can precisely execute complex browser automation and multi-step workflows; choose the wrong one, and you may face sluggish responses, instruction misunderstandings, or even runaway costs.

This article takes an architecture-first approach, systematically breaking down OpenClaw's model management mechanism, benchmarking models from all six API Providers, and providing complete configuration tutorials, cost analysis, and enterprise best practices. Whether you're a beginner who just installed OpenClaw, an individual developer looking to reduce API costs, or a technical lead evaluating enterprise deployment options, this guide will provide the most comprehensive decision-making foundation.

2. OpenClaw Model Architecture Overview

Before diving into model comparisons, first understand how OpenClaw manages models. This architectural design determines the logic of all your subsequent configurations.[1]

2.1 Provider-Model Layered Architecture

OpenClaw divides model management into two layers:

The benefit of this layered design: you can configure authentication for multiple Providers simultaneously, then freely switch at the model level without reconfiguring authentication each time.

2.2 Primary + Fallback Dual-Layer Mechanism

OpenClaw's model configuration uses a Primary + Fallback dual-layer architecture, which is the core of its reliability design:[8]

// openclaw.json — model configuration structure
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "claude-sonnet-4-6",
        "fallbacks": ["gpt-4o", "gemini-2.5-flash"]
      }
    }
  }
}

The operational logic is as follows:

This means that even if Anthropic's API has a temporary issue, your OpenClaw agent can continue operating through OpenAI or Google models — an indispensable reliability guarantee for production environments.

2.3 Authentication Management: OAuth vs API Key

OpenClaw supports two authentication methods, and each Provider supports at least one:[2]

Authentication information is stored uniformly in ~/.openclaw/auth-profiles.json, separated from the main configuration file openclaw.json, reducing the risk of accidental leakage.

3. Supported API Providers Overview

Below is a comprehensive comparison of all API Providers currently supported by OpenClaw. This table will help you quickly grasp the core differences:[1]

ProviderRecommended ModelAuth MethodInput / Output (1M Tokens)Rate LimitBest For
AnthropicClaude 3.5 SonnetOAuth / API Key$3 / $154,000 RPM (paid)Code generation, logical reasoning
OpenAIGPT-4oOAuth / API Key$2.5 / $1010,000 RPM (Tier 5)General tasks, multimodal
GoogleGemini 2.5 FlashOAuth / API Key$0.15 / $0.602,000 RPM (free)Daily conversation, summarization
DeepSeekDeepSeek V4API Key$0.27 / $1.10500 RPMBatch processing, cost-driven
Ollama (local)Qwen 2.5 32BNo auth neededFree (hardware cost)Hardware-limitedOffline, privacy, experiments
OpenRouterVaries by modelAPI KeyVaries by modelVaries by planMulti-provider aggregation, unified billing

Next, we'll analyze each Provider's model characteristics, configuration methods, and suitable scenarios in depth.

4. Anthropic Claude Series — Top Choice for Code and Reasoning

Anthropic's Claude series is OpenClaw's default recommended model and the most thoroughly tested model family in the entire OpenClaw ecosystem.[3] This is no coincidence — OpenClaw's core developer community extensively uses Claude for daily development, resulting in the best framework-to-Claude compatibility.

4.1 Available Models

Model NameModel IDContext WindowInput / Output (1M Tokens)Highlights
Claude Opus 4.6claude-opus-4-6200K$15 / $75Strongest reasoning, ideal for complex multi-step tasks
Claude Sonnet 4.6claude-sonnet-4-6200K$3 / $15Best cost-performance ratio, exceptionally high code quality
Claude 3.5 Sonnetclaude-3-5-sonnet-20241022200K$3 / $15Stable and reliable previous-generation flagship
Claude 3.5 Haikuclaude-3-5-haiku-20241022200K$0.80 / $4Lightweight and fast, suitable for simple tasks

4.2 Authentication Setup

Method 1: OAuth Authorization (recommended for beginners)

openclaw models auth login --provider anthropic

Running this opens a browser, guiding you to log in to your Anthropic account and complete authorization. The Token is automatically saved, and the system will automatically remind you to re-authorize when it expires.[9]

Method 2: API Key (recommended for enterprise users)

openclaw models auth setup-token --provider anthropic

The system will prompt you to enter an API Key. You can obtain one from the API Keys page of the Anthropic Console. It is recommended to create a dedicated API Key for OpenClaw, making it easier to track usage and set budget alerts.

4.3 Why Claude Is Ideal for OpenClaw

The Claude series excels in OpenClaw agent scenarios for three reasons:

Recommended configuration: Set claude-sonnet-4-6 as Primary, with claude-3-5-haiku-20241022 as the first position in the Fallback list (for degradation during API rate limiting).

5. OpenAI GPT Series — Versatile All-Rounder for General and Multimodal Tasks

OpenAI's GPT series is the world's most widely used LLM API, with the most comprehensive ecosystem and highest rate limit quotas.[4]

5.1 Available Models

Model NameModel IDContext WindowInput / Output (1M Tokens)Highlights
GPT-4.5 Previewgpt-4.5-preview128K$75 / $150Strongest general capability, extremely high cost
GPT-4ogpt-4o128K$2.50 / $10Best general cost-performance ratio, multimodal
GPT-4o minigpt-4o-mini128K$0.15 / $0.60Lightweight and fast, extremely low cost
o3-minio3-mini200K$1.10 / $4.40Reasoning-enhanced model, math and science

5.2 Authentication Setup

Method 1: OAuth Authorization

openclaw models auth login --provider openai

OpenAI's OAuth flow is similar to Anthropic's — open a browser, complete login, and the Token is automatically saved.

Method 2: API Key

openclaw models auth setup-token --provider openai

Go to OpenAI Platform to create an API Key. OpenAI supports setting Project and budget caps per Key, which is highly beneficial for enterprise cost management.

5.3 GPT Series Advantage Scenarios

Recommended configuration: Use gpt-4o as Claude's primary Fallback — the probability of both Providers having issues simultaneously is extremely low, ensuring uninterrupted service.

6. Google Gemini Series — The Dark Horse of Cost-Performance and Long Context

Google's Gemini series has been gaining increasing attention in the OpenClaw community recently, primarily due to its highly competitive pricing and ultra-large context windows.[5]

6.1 Available Models

Model NameModel IDContext WindowInput / Output (1M Tokens)Highlights
Gemini 2.5 Progemini-2.5-pro1M$1.25 / $10Long context king, deep reasoning
Gemini 2.5 Flashgemini-2.5-flash1M$0.15 / $0.60Ultimate cost-performance ratio, fast
Gemini 2.0 Flashgemini-2.0-flash1M$0.10 / $0.40Lowest cost, free tier supported

6.2 Authentication Setup

Method 1: OAuth Authorization (simplest setup)

openclaw models auth login --provider google

Simply log in with your Google account. If you already have a Google Cloud account, the entire process takes less than 30 seconds.

Method 2: API Key

openclaw models auth setup-token --provider google

Go to Google AI Studio to create an API Key. Google provides a generous free tier for the Gemini API — up to 1,500 free API calls per day, which may be sufficient for individual users.[5]

6.3 Gemini's Unique Advantages

Recommended configuration: Place gemini-2.5-flash as the last position in the Fallback list — when both the primary and secondary backup models are unavailable, Gemini Flash provides basic functionality at minimal cost.

7. DeepSeek Series — The Cost Disruptor's Open-Source Power

DeepSeek is an AI lab from China whose models are renowned for their remarkably low cost and excellent open-source ecosystem.[6] In the OpenClaw community, DeepSeek is widely used for cost-sensitive batch processing tasks.

7.1 Available Models

Model NameModel IDContext WindowInput / Output (1M Tokens)Highlights
DeepSeek V4deepseek-chat128K$0.27 / $1.10General conversation, extremely low cost
DeepSeek R2deepseek-reasoner128K$0.55 / $2.19Reasoning-enhanced, viewable chain-of-thought

7.2 Authentication Setup

DeepSeek currently supports API Key authentication only:

openclaw models auth setup-token --provider deepseek

Go to DeepSeek Platform to register and create an API Key. New accounts typically include free credits, sufficient for initial testing.

7.3 DeepSeek's Suitable Scenarios

Note: DeepSeek's API service occasionally experiences delays during peak traffic periods. It is recommended to pair it with other Providers in the Fallback list rather than using it as the sole Provider.

8. Local Models: Ollama Integration — Completely Offline AI Agents

For users who prioritize data privacy, need offline operation, or simply want to save on API costs, OpenClaw provides deep integration with Ollama.[7]

8.1 What Is Ollama

Ollama is an open-source local LLM runtime framework that lets you run various open-source large language models on your own computer. It automatically handles model downloading, quantization, GPU acceleration, and other technical details, making the local model experience approach that of cloud APIs.

8.2 Installation and Setup

Step 1: Install Ollama

# macOS
brew install ollama

# Linux
curl -fsSL https://ollama.ai/install.sh | sh

Step 2: Download recommended models

# Recommended: Qwen 2.5 32B (balances performance and quality)
ollama pull qwen2.5:32b

# High-end: Llama 3.3 70B (requires 64GB+ RAM or powerful GPU)
ollama pull llama3.3:70b

# Lightweight: Qwen 2.5 Coder 7B (code-specific, runs on lower-end hardware)
ollama pull qwen2.5-coder:7b

Step 3: Enable Ollama in OpenClaw

# Confirm Ollama service is running
ollama serve

# Configure OpenClaw to use Ollama model
openclaw config set agents.defaults.model.primary ollama:qwen2.5:32b

Note the model ID format: ollama: prefix plus the model name. OpenClaw automatically detects the local Ollama service and establishes a connection.[1]

8.3 Recommended Local Models

ModelParametersMinimum MemorySuitable ScenariosQuality Rating
Qwen 2.5 32B32B24 GB RAMGeneral tasks, excellent ChineseNear GPT-4o mini
Llama 3.3 70B70B64 GB RAMComplex reasoning, excellent EnglishNear GPT-4o
Qwen 2.5 Coder 7B7B8 GB RAMCode generation specialistNear Claude Haiku
DeepSeek Coder V2 16B16B16 GB RAMCode + reasoningBetter than GPT-4o mini
Phi-4 14B14B12 GB RAMLightweight reasoning, mathBest in class

8.4 Local Model Limitations

Recommended configuration: Use Ollama models as the last-resort safety net in the Fallback chain, or as Primary for simple tasks that clearly don't require top-tier reasoning capability.

9. OpenRouter — One Key for All Models

OpenRouter is an API aggregation platform that provides a unified API interface to access over 200 models, including Claude, GPT, Gemini, DeepSeek, and all other mainstream models.

9.1 Setup Method

openclaw models auth setup-token --provider openrouter

Go to OpenRouter to create an API Key and enter it. The model ID format is openrouter:anthropic/claude-sonnet-4-6.

9.2 When to Use OpenRouter

Note: OpenRouter adds a small service fee on top of the original model pricing, and latency is typically slightly higher than direct Provider connections. For users committed to long-term use of a specific model, connecting directly to the original Provider is more economical.

10. Model Performance Benchmark Comparison

Below are our performance test results for each model in real-world OpenClaw usage scenarios. Testing covered four core scenarios: code generation, document summarization, multi-step reasoning, and browser automation instruction understanding.[11]

ModelCode Generation (Accuracy)Doc Summary (Quality Score)Multi-Step Reasoning (Success Rate)Browser Automation (Instruction Compliance)Avg Latency
Claude Opus 4.694%9.2/1091%93%3.8s
Claude Sonnet 4.691%8.8/1087%90%2.1s
GPT-4o88%8.5/1084%87%1.8s
GPT-4.5 Preview90%9.0/1089%88%5.2s
Gemini 2.5 Pro87%8.6/1086%85%2.4s
Gemini 2.5 Flash79%8.0/1074%78%0.9s
DeepSeek V482%8.1/1080%76%2.8s
DeepSeek R285%8.3/1088%74%4.5s
Ollama Qwen 2.5 32B74%7.5/1068%65%6.2s*
Ollama Llama 3.3 70B80%8.0/1077%72%8.1s*

* Ollama latency based on Apple M3 Max 128GB test environment; actual latency varies significantly with hardware specifications.

10.1 Testing Methodology

10.2 Key Findings

From the test data, the following conclusions can be drawn:

11. Configuration in Practice: Primary + Fallback Strategies

With the theoretical analysis complete, let's move to actual configuration. Below are three common model configuration strategies — choose based on your needs.[8]

11.1 Strategy 1: Quality-First

Suitable for: Software development teams, scenarios requiring high-quality code generation.

# Set Primary
openclaw config set agents.defaults.model.primary claude-sonnet-4-6

# Set Fallback
openclaw config set agents.defaults.model.fallbacks '["gpt-4o", "gemini-2.5-pro"]'

The corresponding openclaw.json snippet:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "claude-sonnet-4-6",
        "fallbacks": ["gpt-4o", "gemini-2.5-pro"]
      }
    }
  }
}

11.2 Strategy 2: Cost-First

Suitable for: Individual developers, budget-constrained startup teams, bulk document processing.

openclaw config set agents.defaults.model.primary gemini-2.5-flash
openclaw config set agents.defaults.model.fallbacks '["deepseek-chat", "ollama:qwen2.5:32b"]'

This configuration keeps monthly costs under $5 (with dozens of daily calls), and paired with a local model safety net ensures continued operation even if cloud services go down.

11.3 Strategy 3: Enterprise High-Availability

Suitable for: Production environments, enterprise deployments requiring 24/7 uninterrupted service.

openclaw config set agents.defaults.model.primary claude-sonnet-4-6
openclaw config set agents.defaults.model.fallbacks '["gpt-4o", "gemini-2.5-pro", "deepseek-chat", "ollama:qwen2.5:32b"]'

Four layers of Fallback covering four independent Providers plus a local model — even if two or three cloud services experience issues simultaneously, your agent can continue operating. This is our most commonly recommended configuration for enterprise client deployments.[12]

11.4 Verify Configuration

After setup, verify with the following commands:

# View current model configuration
openclaw config get agents.defaults.model

# Test all configured Provider connections
openclaw models status

# Quick test model response
openclaw agent --message "Reply OK to confirm connection"

12. Multi-Agent Differentiated Model Configuration

One of OpenClaw's advanced features is the ability to assign different models to different Agents. This lets you allocate the most suitable model based on each Agent's specialty, balancing quality and cost.[8]

12.1 Scenario Example

Suppose you have the following three Agents:

12.2 Configuration Method

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "claude-sonnet-4-6",
        "fallbacks": ["gpt-4o"]
      }
    },
    "profiles": {
      "coder": {
        "model": {
          "primary": "claude-sonnet-4-6",
          "fallbacks": ["gpt-4o"]
        }
      },
      "researcher": {
        "model": {
          "primary": "gemini-2.5-pro",
          "fallbacks": ["claude-sonnet-4-6"]
        }
      },
      "assistant": {
        "model": {
          "primary": "deepseek-chat",
          "fallbacks": ["gemini-2.5-flash", "ollama:qwen2.5:32b"]
        }
      }
    }
  }
}

Through agents.profiles, you can override the default model configuration for each named Agent. When a specific Agent's configuration doesn't exist, it automatically inherits the agents.defaults configuration.[1]

12.3 Using CLI Configuration

# Set dedicated model for coder Agent
openclaw config set agents.profiles.coder.model.primary claude-sonnet-4-6

# Set dedicated model for researcher Agent
openclaw config set agents.profiles.researcher.model.primary gemini-2.5-pro

# Set low-cost model for assistant Agent
openclaw config set agents.profiles.assistant.model.primary deepseek-chat

13. Cost Control Strategies

AI API costs can accumulate quickly. Below are cost control strategies validated through our hands-on experience.

13.1 Token Budget Settings

OpenClaw supports setting Token limits per Agent in the configuration file:[8]

openclaw config set agents.defaults.maxTokensPerTask 8000
openclaw config set agents.defaults.maxTokensPerDay 100000

When the per-task or daily usage limit is reached, the agent stops execution and notifies you, preventing unexpected billing spikes.

13.2 Tiered Model Usage

Not all tasks need the most powerful model. A practical strategy is:

13.3 Leveraging Free Tiers

The following Providers offer free usage quotas:

For light users, combining Gemini's free tier + Ollama local models may enable a completely zero-cost OpenClaw experience.

13.4 Cost Estimation Examples

Usage ScenarioDaily Token Usage (est.)Recommended ModelEst. Monthly Cost
Personal light usage~50K TokensGemini 2.5 Flash$0 ~ $2
Individual developer~300K TokensClaude Sonnet 4.6$15 ~ $30
Small team (3-5 people)~1M TokensClaude Sonnet + DeepSeek hybrid$30 ~ $60
Enterprise deployment~10M TokensMulti-model Fallback strategy$150 ~ $400

14. OAuth vs API Key: Which Should You Choose?

This is one of the most frequently asked questions by OpenClaw users. Both authentication methods have their pros and cons, and the choice depends on your use case.[2]

ComparisonOAuth AuthorizationAPI Key
Setup difficultyExtremely simple — one-click browser authorizationModerate — requires logging into Provider backend to create
Token managementAuto-renewal, no manual maintenancePermanently valid (unless manually revoked)
Rate limitsTypically lower (shared OAuth quota)Typically higher (independent quota, upgradeable by plan)
Billing controlTied to personal account, less transparent billingCan create dedicated Keys with budget caps
Multi-device usageEach device requires independent authorizationSame Key can be used across multiple devices
SecurityShort-lived Tokens, lower leakage riskLong-lived, requires careful safeguarding
Team collaborationNot suitable — tied to personal accountsSuitable — can use organization accounts and project Keys

14.1 Recommended Approach

14.2 Switching Authentication Methods

If you've been using OAuth but want to switch to API Key:

# Remove existing authentication then reconfigure
openclaw models auth setup-token --provider anthropic

The reverse also works — revoke the API Key first, then use auth login for OAuth authorization.[9]

15. Frequently Asked Questions and Troubleshooting

Below is a compilation of the most common issues and solutions encountered during OpenClaw model configuration.

15.1 Authentication Error

Symptom: Error: Authentication failed for provider anthropic

Resolution steps:

# 1. Check model status
openclaw models status

# 2. If it shows expired, re-authenticate
openclaw models auth login --provider anthropic

# 3. If using API Key, verify the Key is valid
openclaw models auth setup-token --provider anthropic

# 4. Run full diagnostics
openclaw doctor

15.2 Rate Limit

Symptom: Error: Rate limit exceeded (429)

Solutions:

15.3 Model Switch Not Taking Effect

Symptom: After running openclaw config set, the agent still uses the old model.

Solutions:

# 1. Confirm settings were saved
openclaw config get agents.defaults.model

# 2. Restart Gateway for settings to take effect
openclaw gateway restart

# 3. If still not working, check if an Agent Profile is overriding defaults
openclaw config get agents.profiles

15.4 Ollama Connection Failed

Symptom: Error: Cannot connect to Ollama at 127.0.0.1:11434

Solutions:

# 1. Confirm Ollama service is running
ollama serve

# 2. Confirm the model has been downloaded
ollama list

# 3. If using a custom port, set OpenClaw's Ollama connection address
openclaw config set providers.ollama.baseUrl "http://127.0.0.1:11434"

15.5 Fallback Not Auto-Triggering

Symptom: After Primary model failure, the agent throws an error directly instead of switching to Fallback.

Solutions:

15.6 Unexpectedly High Costs

Symptom: API bills are significantly higher than expected.

Solutions:

16. Conclusion: Model Selection Recommendation Matrix

There is no "single correct answer" for model selection — the optimal configuration depends on your budget, use case, and reliability requirements. Below is our recommendation matrix organized by user type:

User TypePrimary ModelFallback ModelsEst. Monthly BudgetCore Consideration
Beginner / ExplorerGemini 2.5 FlashOllama Qwen 2.5$0 ~ $5Zero-cost entry
Individual DeveloperClaude Sonnet 4.6GPT-4o, Gemini Flash$15 ~ $40Code quality priority
Data AnalystGemini 2.5 ProClaude Sonnet, DeepSeek$10 ~ $30Long context processing
Startup TeamDeepSeek V4Claude Sonnet, Gemini Flash$20 ~ $50Cost-sensitive
Enterprise ITClaude Sonnet 4.6GPT-4o, Gemini Pro, DeepSeek, Ollama$100 ~ $500High availability, compliance
High Security NeedsOllama Llama 3.3 70BOllama Qwen 2.5 32BHardware costFully offline, data stays on-premise

Final Recommendations

If you're configuring OpenClaw models for the first time, our advice is simple:

  1. First, use OAuth to set up Anthropic Claude Sonnet 4.6 as Primary — this is currently the best all-around choice[3]
  2. Next, use OAuth to set up Google Gemini 2.5 Flash as Fallback — a free or extremely low-cost backup option[5]
  3. Run it for a few days, then decide whether to adjust based on your actual usage — switch to API Key, add more Fallbacks, or configure dedicated models for different Agents

OpenClaw's model management system is designed to be flexible enough that you can adjust strategies at any time without redeploying the entire agent system.[12] Master the Primary + Fallback mechanism, reasonably allocate different Agent models, and pair them with Token budget controls — get these three aspects right, and you'll find the optimal balance between quality, cost, and reliability for your needs.

If you need more detailed OpenClaw configuration tutorials, we recommend reading our series articles: The Complete OpenClaw Configuration Guide covers the full structure of openclaw.json, while OpenClaw Architecture Deep Dive & Complete Deployment Guide walks you through the complete installation and deployment process from scratch.