Anthropic / Claude
概述
Anthropic 是 Claude 系列模型的開發者。Claude Opus 4 和 Sonnet 4 在程式設計任務上表現極為出色,是很多開發者的首選程式設計 AI。
重要區別:Claude Pro($20/月)和 Claude Max($100/月)訂閱是 claude.ai 網頁版的,不等於 API 權限。要在 OpenClaw 中使用 Claude,你需要在 Anthropic Console 中單獨取得 API Key 並儲值。兩者是完全獨立的帳單系統。
取得 API Key
1
註冊 Anthropic 帳號
造訪 console.anthropic.com,註冊帳號。需要信箱驗證和手機號驗證。
2
進入 API Keys 頁面
3
建立 API Key
點擊 "Create Key",命名後會生成以 sk-ant- 開頭的金鑰。立刻複製保存,只會顯示一次。
sk-ant-api03-xxxx...xxxx
4
儲值 API 額度
進入 Plans & Billing,綁定信用卡儲值。Anthropic API 按用量計費,建議先儲 $5 試用。新註冊用戶可能有 $5 的免費額度。
設定到 OpenClaw
openclaw configure --provider anthropic
或者手動編輯 ~/.openclaw/openclaw.json:
{
"providers": {
"anthropic": {
"baseUrl": "https://api.anthropic.com/v1",
"apiKey": "sk-ant-api03-你的金鑰",
"models": ["claude-opus-4-6", "claude-sonnet-4-6"]
}
}
}
設定完成後重啟閘道器:
openclaw gateway restart
可用模型
| 模型 | 特點 | 推薦用途 |
|---|---|---|
| claude-opus-4-6 | 最強模型,深度推理 | 複雜程式設計、架構設計 |
| claude-sonnet-4-6 | 平衡型,速度與品質兼顧 | 日常程式設計、程式碼審查 |
| claude-haiku-4-5 | 輕量高速,價格低 | 簡單任務、快速互動 |
程式設計場景推薦:複雜程式碼寫
查看 Claude 模型詳細評測 — 與其他模型的對比分析
→
claude-opus-4-6,日常編碼用 claude-sonnet-4-6,簡單補全用 claude-haiku-4-5。Claude 在程式碼理解和生成方面的優勢非常明顯。