":{"message":"No available accounts: All accounts failed or unhealthy.","type":"...

2026年02月05日 17:54 状态: processing

🚨 错误信息

503 {"error":{"message":"No available accounts: All accounts failed or unhealthy.","type":"overloaded_error"},"type":"error"} Retrying in 6 seconds… (attempt 5/10)

🤖 AI解决方案

错误翻译

原文:No available accounts: All accounts failed or unhealthy.
译文:无可用账户:所有账户均失败或状态异常。
原因分析
这是一个API服务过载错误,表明:
  • 使用的API账户池中所有账户都处于不可用状态

  • 可能是账户额度耗尽、服务异常或并发请求过多

  • 系统已自动重试5次仍无法获得可用账户解决方案
  • javascript
    // 1. 检查账户配置和额度
    const accounts = [
    { apiKey: 'key1', isValid: true },
    { apiKey: 'key2', isValid: true }
    ];

    // 2. 实现备用账户切换逻辑
    async function makeRequestWithFallback() {
    for (const account of accounts) {
    try {
    const response = await fetch('https://api.example.com/endpoint', {
    headers: { 'Authorization': Bearer ${account.apiKey} }
    });
    if (response.ok) return await response.json();
    } catch (error) {
    console.warn(账户 ${account.apiKey} 失败,尝试下一个);
    account.isValid = false;
    }
    }
    throw new Error('所有账户均不可用');
    }

    // 3. 增加请求间隔和重试逻辑
    const delay = ms => new Promise(resolve => setTimeout(resolve, ms));

    async function makeRequestWithRetry(maxRetries = 3) {
    for (let i = 0; i < maxRetries; i++) {
    try {
    return await makeRequestWithFallback();
    } catch (error) {
    if (i === maxRetries - 1) throw error;
    await delay(1000 * Math.pow(2, i)); // 指数退避
    }
    }
    }
    预防措施

  • ✅ 账户健康监控:定期检查API账户的可用性和剩余额度

  • ✅ 请求限流策略:实现指数退避重试和请求频率限制

  • ✅ 多账户轮询:维护多个备用账户并自动切换,避免单点故障
  • 建议工具

  • 使用 axios-retryretry-axios 库简化重试逻辑

  • 监控API使用率和账户状态的仪表板工具