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 在代码理解和生成方面的优势非常明显。