mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-06 08:06:50 +00:00
Kimi reports Coding Plan window exhaustion (5h/weekly) as a 403 with error.type=access_terminated_error instead of 429. It fell into the generic handleOpenAI403 escalation, so three 403s within 180 minutes permanently disabled accounts that recover by themselves at the window reset. Detect the quota-exhausted 403 for CN coding-plan accounts and cool it down exactly like the 429 path: SetRateLimited until the earliest future window reset from the quota snapshot, falling back to a short temp-unschedulable window when the snapshot is missing. Non-coding-plan accounts keep the generic 403 escalation since the rolling-window recovery mechanism does not apply to them. Also extract cooldownCNProviderToQuotaSnapshotReset and setCNProviderTempUnschedulable so the 429 (OpenCodeGo / Coding Plan) and 403 branches stop carrying three copies of the same sequence. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>