延伸阅读
OpenClaw Cloud LLM API Configuration Guide: Connect OpenAI, Claude, DeepSeek, and More
OpenClaw doesn't come with its own "brain" — it needs you to connect a large language model API. This guide covers how to obtain and configure API keys from major providers, plus strategies for choosing the right model.
Core Concepts
Before we start, understand three concepts:
- API Key: A secret token (e.g.,
sk-xxxxxxxx) — your "access pass" from the LLM provider - Base URL: The API endpoint address. Most major providers are auto-configured in OpenClaw.
- Pricing: Most providers charge per token (with separate rates for input and output tokens)
Important: API keys are sensitive credentials. Never post them to social media or commit them to a public Git repository. If compromised, regenerate immediately.
Provider Configuration Guides
1. OpenAI (GPT-4o / GPT-4.1)
Best for: Overall strongest — English writing, complex reasoning, code generation
How to get it:
1. Go to platform.openai.com
2. Sign up (requires supported-region phone verification)
3. Dashboard → API Keys → "Create new secret key"
4. Copy the key (format: sk-proj-xxxxxxxx)
5. ⚠️ The key is shown only once — save it securely
Pricing: GPT-4o: input $2.50/1M tokens, output $10.00/1M tokens (verify current rates on the official site)
OpenClaw configuration: Select OpenAI preset template → paste API key → test connection → save
2. Anthropic Claude (Sonnet 4 / Opus 4)
Best for: Long-form writing, deep analysis, safety-critical use cases
How to get it:
1. Go to console.anthropic.com
2. Sign up → API Keys → Create Key
3. Select a workspace and create
4. Copy the key (format: sk-ant-xxxxxxxx)
Pricing: Claude Sonnet 4: input $3.00/1M tokens, output $15.00/1M tokens (verify current rates)
OpenClaw configuration: Select Anthropic template → paste API key → save
3. DeepSeek
Best for: Strong Chinese & multilingual performance, great value for money
How to get it:
1. Go to platform.deepseek.com
2. Sign up
3. API Keys → Create → copy (format: sk-xxxxxxxx)
Pricing: DeepSeek-V3: input ¥1.00/1M tokens, output ¥4.00/1M tokens. New users receive 5M free tokens.
OpenClaw configuration: Select DeepSeek (or OpenAI-compatible custom) → Base URL: https://api.deepseek.com/v1 → paste API key → save
4. Google Gemini
Best for: Massive context window (1M tokens), multimodal, generous free tier
How to get it: 1. Go to aistudio.google.com 2. Sign in with Google → Get API Key → Create 3. Copy the key
Pricing: Extremely generous free tier; paid pricing is competitive
OpenClaw configuration: Select Google Gemini template → paste API key → save
Multi-Model Strategy
Choose by Task
| Task | Recommended Model | Why |
|---|---|---|
| Daily writing | DeepSeek / Gemini | Excellent value |
| English copywriting | GPT-4o / Claude | Native English capability |
| Long-form content | Claude | Best long-context coherence |
| Code generation | GPT-4o / DeepSeek-V3 | Strong coding benchmarks |
| Translation | DeepSeek / Claude | Bilingual accuracy |
| Free exploration | Gemini / DeepSeek | Generous free tiers |
Choose by Cost
High-frequency daily tasks → budget models (DeepSeek / Gemini)
↓
Important deliverables (articles, proposals) → premium models (Claude / GPT-4o)
↓
Free exploration → Gemini / DeepSeek (free credits available)
Quick Switching in OpenClaw
In the OpenClaw conversation interface, you can typically switch models on the fly — no need to exit or recreate conversations. Specific UI depends on your OpenClaw version.
API Key Best Practices
Security
- ✅ Store keys in OpenClaw configuration (on your own device)
- ✅ Set usage limits per provider to prevent runaway bills
- ❌ Never share keys in chats, on GitHub, or in public documents
- ❌ Never screenshot panels containing keys for social media
Cost Management
- Set monthly spending caps in each provider's console
- Regularly check the Usage Dashboard
- Route high-frequency simple tasks to budget models; premium models for high-value work
Key Rotation
- Regenerate API keys every 3–6 months
- Update the new key in your OpenClaw panel
FAQ
Q: Why use cloud APIs instead of running locally?
Cloud APIs give you access to top-tier "brains" — models like GPT-4o and Claude Sonnet 4 far exceed what consumer hardware can run locally. For local deployment scenarios requiring data sovereignty, explore KAIHE E1 and above — our Large Model Computer series.
Q: What if my API key is leaked?
Immediately: log into the provider → API Keys → delete the compromised key → create a new one → update in OpenClaw.
Q: Do I need to register with all 6 providers?
No. Register with 2–3: one workhorse (DeepSeek or Gemini — affordable) plus one premium (GPT-4o or Claude — powerful).
Q: How much is 1M tokens in practical terms?
Rough estimate: 1M tokens ≈ the entire text of a typical novel (e.g., The Great Gatsby is ~50K words). For daily chat, 1M tokens lasts a long time. A single long-form article consumes a few thousand tokens.