mirror of
https://github.com/justlovemaki/AIClient-2-API.git
synced 2026-04-27 10:25:50 +03:00
[PR #239] [CLOSED] fix: handle 402 Payment Required error in Kiro provider #315
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AIClient-2-API-justlovemaki#315
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/justlovemaki/AIClient-2-API/pull/239
Author: @rainboxup
Created: 1/14/2026
Status: ❌ Closed
Base:
main← Head:fix/kiro-402-quota-exhausted📝 Commits (1)
7c0d98cfix: handle 402 Payment Required error in Kiro provider📊 Changes
1 file changed (+25 additions, -5 deletions)
View changed files
📝
src/providers/claude/claude-kiro.js(+25 -5)📄 Description
问题描述
当号池中某个 Kiro 账号额度用完时,返回 402 (Payment Required) 错误。
由于代码未处理此错误码,导致请求直接断流,即使号池中还有其他 49 个有额度的账号。
复现步骤
错误日志
[17:03:33] [ERROR] [Kiro] API call failed (Status: 402, Code: ERR_BAD_REQUEST): Request failed with status code 402
[17:03:33] [ERROR] [Server] Error during unary processing: AxiosError: Request failed with status code 402
修复方案
在
claude-kiro.js的三个位置添加 402 错误处理:callApi方法,第 1341-1346 行)streamApiReal方法,第 1743-1748 行)getUsageLimits方法,第 2596-2600 行)当检测到 402 错误时:
代码变更
src/providers/claude/claude-kiro.js)测试
预期效果
修复前:
修复后:
已知限制
Codex 代码审查发现了一些现有错误处理代码的潜在问题(与 401/403 处理共享),这些问题不是本 PR 引入的,建议在后续 PR 中统一改进:
本 PR 专注于修复 402 错误未处理导致的断流问题。
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.