文章摘要
OpenClaw支持通过Anthropic API密钥和Claude CLI访问Claude模型系列,保留现有配置。用户可通过交互或非交互方式设置API密钥,并配置默认模型参数。Claude 4.6模型默认采用自适应思考模式,支持按消息或模型参数覆盖。OpenClaw的快速模式也支持直接访问Anthropic API。
文章总结
Anthropic (Claude) 集成指南
核心功能
Anthropic公司开发的Claude模型系列可通过API和CLI两种方式接入。OpenClaw平台同时支持Anthropic API密钥和Claude CLI复用,并兼容已配置的旧版令牌验证。
接入方式
API密钥接入(推荐)
- 适用场景:标准API访问和按量计费
- 配置方法:
bash openclaw onboard --anthropic-api-key "sk-ant-..." - 配置示例:
json { "env": { "ANTHROPIC_API_KEY": "sk-ant-..." }, "agents": { "defaults": { "model": { "primary": "anthropic/claude-opus-4-6" } } } }
智能思考模式
快速模式
/fast on对应service_tier: "auto"/fast off对应service_tier: "standard_only"- 注意:
- 仅对直连
api.anthropic.com的请求生效 - 显式设置的
serviceTier参数会覆盖默认值
- 仅对直连
提示缓存功能
缓存时长选项: | 值 | 时长 | 说明 | |---|---|---| |
none| 无缓存 | 禁用缓存 | |short| 5分钟 | API密钥默认值 | |long| 1小时 | 长时缓存 |配置示例:
json { "agents": { "defaults": { "models": { "anthropic/claude-opus-4-6": { "params": { "cacheRetention": "long" } } } } } }
百万级上下文窗口(Beta功能)
- 需显式设置
params.context1m: true - 仅支持Opus/Sonnet模型
- 注意:旧版令牌验证(
sk-ant-oat-*)不支持此功能
CLI后端支持
- 支持复用Claude CLI (
claude -p) - 但API密钥仍是生产环境推荐方案
常见问题排查
- 401错误:建议迁移至API密钥验证
- 密钥未找到:需为每个代理单独配置
- 凭证不可用:可通过
openclaw models status检查状态
评论总结
以下是评论内容的总结,平衡呈现不同观点并保留关键引用:
负面评价:产品策略混乱与信任危机 1. 对Anthropic混乱的产品策略和沟通方式表示不满: - "I don’t think I’ve seen a more confused and shambolic product strategy"(评论1) - "No official statement and not even a tweet?"(评论10)
- 用户信任度下降,部分用户已转向竞争对手:
- "The sentient had already sailed. It's hard to trust Anthropic"(评论6)
- "Damage done, users know that Anthrophic will pull the rug from under them again"(评论9)
技术问题与使用体验 1. 代码支持功能的不稳定性: - "Can we get OpenCode support back as well?"(评论3) - "I got sick of the inconsistency caused by Anthropic tinkering with Claude Code"(评论5)
- 账户无故被封禁问题:
- "Anthropic disabled my account without explanation beyond 'suspicious signals'"(评论13)
正面/中立评价 1. 部分用户仍认可其技术伦理: - "I still trust in their ethics. Please don't prove me wrong"(评论24)
- 政策恢复带来希望:
- "OpenClaw says Anthropic says OpenClaw-style Claude CLI usage is okay again"(评论7)
关键争议点 1. 政策反复无常: - "Anthropic staff have had contradictive statements...Their intent for clarifications lead to confusion"(评论12)
计算资源限制的猜测:
- "maybe it was all compute constrained"(评论8)
定价策略担忧:
- "How long till the $1000 ultra plan...or they just want us all paying API credits instead"(评论16)
中文用户观点 1. 对政策摇摆的困惑: - "anthropic seems to be schizophrenic, sometimes worried about insufficient computing power and sometimes worried about user loss"(评论20)
- 技术效率问题:
- "你们不觉得在openclaw里用claude相当浪费token吗?"(评论23)