【Bug已解决】openclaw rate limit retry exhausted / 429 Too Many Requests persist — OpenClaw 限流重试耗尽解决方案

📅 2026/7/12 20:07:45
【Bug已解决】openclaw rate limit retry exhausted / 429 Too Many Requests persist — OpenClaw 限流重试耗尽解决方案
【Bug已解决】openclaw: rate limit retry exhausted / 429 Too Many Requests persist — OpenClaw 限流重试耗尽解决方案1. 问题描述OpenClaw 在遇到 429 限流后重试多次仍然失败# 限流重试耗尽 $ openclaw --print task Error: 429 Too Many Requests Retry exhausted after 5 attempts. # 或持续 429 $ openclaw task Error: 429 rate_limit_error Rate limit exceeded. Retries exhausted. # 或 RPM 超限 $ openclaw --print task1 $ openclaw --print task2 $ openclaw --print task3 Error: 429 Requests per minute limit reached. # 或 TPM 超限 $ openclaw very long task... Error: 429 Tokens per minute limit reached.这个问题在以下场景中特别常见高频请求RPM/TPM 超限免费额度限制多人共享 Key重试间隔太短批量任务2. 原因分析原因分类具体表现占比高频请求RPM 超限约 35%TPM 超限tokens/min约 25%重试太短间隔不够约 20%共享 Key多人约 10%免费额度limit约 5%批量任务并发约 5%3. 解决方案方案一增加重试间隔最推荐# 步骤 1增加重试次数和间隔 export OPENCLAW_RETRY_COUNT10 export OPENCLAW_RETRY_DELAY30 # 步骤 2或使用指数退避 export OPENCLAW_RETRY_BACKOFFtrue export OPENCLAW_RETRY_BASE5 export OPENCLAW_RETRY_MAX120 # 步骤 3或在配置中设置 cat .openclaw/config.json EOF { retryCount: 10, retryDelay: 30, retryBackoff: true } EOF # 步骤 4验证 openclaw --print hello方案二降低请求频率# 步骤 1增加请求间隔 export OPENCLAW_REQUEST_INTERVAL10 # 10 秒间隔 # 步骤 2或手动等待 openclaw --print task1 sleep 10 openclaw --print task2 sleep 10 openclaw --print task3 # 步骤 3批量任务使用循环 for task in task1 task2 task3; do openclaw --print $task sleep 15 done # 步骤 4验证 openclaw --print hello方案三减少 Token 消耗# 步骤 1使用更便宜的模型 openclaw --model claude-3-haiku task # 步骤 2减少 max_tokens openclaw --max-tokens 2048 task # 步骤 3精简提示 openclaw --print 简洁回答: task # 步骤 4分步执行 openclaw --print 第一步 --max-tokens 1024 sleep 5 openclaw --print 第二步 --max-tokens 1024方案四使用多个 API Key# 步骤 1创建多个 Key # Key A: sk-ant-KEY_A # Key B: sk-ant-KEY_B # 步骤 2轮换使用 KEYS(sk-ant-KEY_A sk-ant-KEY_B sk-ant-KEY_C) for i in 0 1 2 3 4; do export ANTHROPIC_API_KEY${KEYS[$((i % 3))]} openclaw --print task$i sleep 5 done # 步骤 3验证 openclaw --print hello # 步骤 4或配置多 Key cat .openclaw/config.json EOF { apiKeys: [sk-ant-KEY_A, sk-ant-KEY_B, sk-ant-KEY_C], keyRotation: true } EOF方案五升级计划# 步骤 1登录 console.anthropic.com # Settings → Billing → Upgrade Plan # 步骤 2Free → Pro → Enterprise # Pro: 更高 RPM/TPM # Enterprise: 最高限制 # 步骤 3验证额度 # Usage → 查看当前限制 # 步骤 4测试 openclaw --print hello方案六缓存结果# 步骤 1缓存重复请求 openclaw --print task /tmp/cache_task.txt 21 # 下次直接读取 cat /tmp/cache_task.txt # 步骤 2避免重复请求 # 如果任务相同使用缓存结果 # 步骤 3批量处理 openclaw --print 一次性处理多个: task1, task2, task3 # 步骤 4验证 openclaw --print hello4. 各方案对比总结方案适用场景推荐指数难度方案一增加间隔通用⭐⭐⭐⭐⭐低方案二降低频率高频⭐⭐⭐⭐⭐低方案三减少 Token成本⭐⭐⭐⭐⭐低方案四多 Key高频⭐⭐⭐⭐⭐中方案五升级长期⭐⭐⭐⭐⭐低方案六缓存重复⭐⭐⭐⭐低5. 常见问题 FAQ5.1 429 错误是什么Too Many Requests。请求频率或 Token 超限。5.2 RPM 和 TPM 是什么RPM: Requests Per MinuteTPM: Tokens Per Minute5.3 如何增加重试export OPENCLAW_RETRY_COUNT10 export OPENCLAW_RETRY_DELAY305.4 指数退避是什么每次重试等待时间翻倍5s, 10s, 20s, 40s...5.5 如何降低频率使用sleep 10在请求间等待。5.6 多 Key 合法吗合法。可以在 Anthropic 平台创建多个 Key。5.7 如何减少 Token使用 Haiku 模型减少 max_tokens精简提示。5.8 免费额度限制免费额度 RPM/TPM 较低。升级 Pro 提高。5.9 如何缓存结果openclaw --print task cache.txt cat cache.txt # 下次读取5.10 排查清单速查表□ 1. OPENCLAW_RETRY_COUNT10 □ 2. OPENCLAW_RETRY_DELAY30 □ 3. OPENCLAW_RETRY_BACKOFFtrue □ 4. sleep 10 请求间等待 □ 5. --model claude-3-haiku 便宜模型 □ 6. --max-tokens 2048 减少 □ 7. 多 Key 轮换 □ 8. apiKeys keyRotation 配置 □ 9. 升级 Pro/Enterprise □ 10. cache.txt 缓存结果6. 总结根本原因限流重试耗尽最常见原因是高频请求35%和 TPM 超限25%最佳实践增加重试次数和间隔使用指数退避降低频率使用sleep 10在请求间等待多 Key创建多个 API Key 轮换使用最佳实践建议使用 Haiku 模型减少 Token缓存重复请求升级计划故障排查流程图flowchart TD A[限流重试耗尽] -- B[增加重试间隔] B -- C[OPENCLAW_RETRY_COUNT10] C -- D[OPENCLAW_RETRY_DELAY30] D -- E[OPENCLAW_RETRY_BACKOFFtrue] E -- F[openclaw --print hello 验证] F -- G{成功?} G --|是| H[✅ 问题解决] G --|否| I[降低请求频率] I -- j[sleep 10 请求间等待] j -- K[for 循环 sleep] K -- F F -- L{成功?} L --|是| H L --|否| M[减少 Token] M -- N[--model claude-3-haiku] N -- O[--max-tokens 2048] O -- P[精简提示] P -- F F -- Q{成功?} Q --|是| H Q --|否| R[使用多 Key] R -- S[创建多个 API Key] S -- T[KEYS 数组轮换] T -- F F -- U{成功?} U --|是| H U --|否| V[升级计划] V -- W[Pro/Enterprise] W -- F F -- X{成功?} X --|是| H X --|否| Y[缓存结果] Y -- Z[openclaw cache.txt] Z -- AA[避免重复请求] AA -- H H -- AB[长期: 退避 频率 多 Key Haiku] AB -- AC[✅ 长期方案]