📖 使用指南 简单 约 7 分钟阅读

OpenClaw Model Configuration

OpenClaw 支持多种 AI 模型,包括 Claude、GPT、DeepSeek、Kimi 和本地模型。本文介绍如何配置和选择模型。

V
Victor.Chen
2026年3月19日

Source: OpenClaw Orange Paper v1.2.0, Chapters 24-27

Model Provider Overview

OpenClaw has a model-agnostic architecture and supports 50+ AI model providers.

Model Categories

Type Providers Highlights
International models OpenAI, Anthropic, Google Best quality, requires international network access
Chinese models DeepSeek, Kimi, Baidu Friendly to mainland networks, affordable
Local models Ollama, LM Studio Completely free, privacy-safe

Configuring International Models

Claude (Anthropic)

Rating: ⭐⭐⭐⭐⭐

Model Strength Price
Claude 3.5 Sonnet Best all-round $3/1M tokens
Claude 3 Opus Strongest reasoning $15/75 tokens
Claude 3 Haiku Fast and economical $0.25/1.25M tokens

Getting an API Key:

  1. Visit https://console.anthropic.com/
  2. Sign up for an account
  3. Create an API Key

Sample configuration:

model: claude-3-5-sonnet-20241022
api_key: sk-ant-xxx
base_url: https://api.anthropic.com

GPT-4 (OpenAI)

Rating: ⭐⭐⭐⭐⭐

Model Strength Price
GPT-4o Latest flagship $2.5/10 tokens
GPT-4 Turbo Great value $10/30 tokens
GPT-3.5 Turbo Budget option $0.5/1.5 tokens

Getting an API Key:

  1. Visit https://platform.openai.com/api-keys
  2. Sign up for an account
  3. Create an API Key

Gemini (Google)

Rating: ⭐⭐⭐⭐

Model Strength Price
Gemini Pro Free Free tier available
Gemini Ultra Most powerful Pay-as-you-go

Getting an API Key:

  1. Visit https://aistudio.google.com/apikey
  2. Create an API Key
  3. Free quota: 1500 requests per day

Configuring Chinese Models

DeepSeek

Rating: ⭐⭐⭐⭐⭐ (top pick for users in mainland China)

Model Strength Price
DeepSeek Chat General chat ¥1/2M tokens
DeepSeek Coder Code specialist ¥1/2M tokens

Getting an API Key:

  1. Visit https://platform.deepseek.com/
  2. Sign up for an account
  3. Create an API Key

Advantages:

  • Direct connection from mainland networks
  • Extremely low pricing (¥1 per million tokens)
  • Quality close to GPT-4

Kimi (Moonshot AI)

Rating: ⭐⭐⭐⭐

Model Strength Price
Kimi Long context Free tier available
Kimi K2 Latest version Pay-as-you-go

Getting an API Key:

  1. Visit https://platform.moonshot.cn/
  2. Sign up for an account
  3. Create an API Key

Baidu ERNIE

Rating: ⭐⭐⭐

Model Strength Price
ERNIE 4.0 Most capable Pay-as-you-go
ERNIE 3.5 Economical Free tier available

Getting an API Key:

  1. Visit https://console.bce.baidu.com/qianfan/
  2. Create an app
  3. Get your API Key and Secret Key

Configuring Local Models

Ollama

Rating: ⭐⭐⭐⭐⭐ (top pick for cost-sensitive users)

Install:

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

# Download models
ollama pull llama3
ollama pull qwen2

Configuration:

model: ollama://llama3
base_url: http://localhost:11434

Recommended models:

Model Size Memory Quality
llama3:8b 4.7GB 8GB ⭐⭐⭐⭐
qwen2:7b 4.4GB 8GB ⭐⭐⭐⭐
deepseek-coder:6b 3.8GB 6GB ⭐⭐⭐⭐
mistral:7b 4.1GB 8GB ⭐⭐⭐⭐

Advantages: completely free, data processed locally, no network restrictions

Model Selection Advice

By Use Case

Scenario Recommended models Why
Daily chat Gemini / Kimi Free tiers available
Coding Claude / DeepSeek Coder Strong at code
Complex reasoning Claude / GPT-4 Best results
Cost-sensitive Ollama local models Completely free
Users in mainland China DeepSeek / Kimi Network-friendly

By Budget

Budget Recommended setup
¥0 Ollama local models
¥10/mo Gemini free tier
¥50/mo DeepSeek
¥100/mo Claude / GPT-4

Multi-Model Configuration

You can configure multiple models and have OpenClaw pick one automatically based on the task:

models:
  - name: claude-main
    model: claude-3-5-sonnet
    use_for: [complex, reasoning]

  - name: deepseek-coder
    model: deepseek-coder
    use_for: [code, programming]

  - name: gemini-free
    model: gemini-pro
    use_for: [simple, daily]

API Key Management

Secure Storage

  1. Use environment variables:
export ANTHROPIC_API_KEY="sk-ant-xxx"
export OPENAI_API_KEY="sk-xxx"
  1. Use a config file:
# ~/.openclaw/config.yaml
api_keys:
  anthropic: ${ANTHROPIC_API_KEY}
  openai: ${OPENAI_API_KEY}

Spend Monitoring

Check API usage regularly:

Want this set up for you?

Tell us the first job you want automated - join the 14-day setup experiment.

This 14-day experiment

Email is only used to send the pack and a checkout link. No resale. No charge happens on this page.