






















@@ -21,6 +21,9 @@ const GEMINI_RESOURCE_EXHAUSTED_MESSAGE =
2121"RESOURCE_EXHAUSTED: Resource has been exhausted (e.g. check quota).";
2222// OpenRouter 402 billing example: https://openrouter.ai/docs/api-reference/errors
2323const OPENROUTER_CREDITS_MESSAGE = "Payment Required: insufficient credits";
24+// Issue-backed Moonshot/Kimi exhausted-balance shape surfaced under HTTP 429 (#43447).
25+const MOONSHOT_INSUFFICIENT_BALANCE_429_PAYLOAD =
26+'{"error":{"type":"rate_limit_reached","message":"Insufficient account balance. Please recharge your Moonshot account."}}';
2427const OPENROUTER_MODEL_NOT_FOUND_PAYLOAD =
2528'{"error":{"message":"Healer Alpha was a stealth model revealed on March 18th as an early testing version of MiMo-V2-Omni. Find it here: https://openrouter.ai/xiaomi/mimo-v2-omni","code":404},"user_id":"user_33GTyP8uDSYYbaeBO48AGHXyuMC"}';
2629const TOGETHER_MONTHLY_SPEND_CAP_MESSAGE =
@@ -293,6 +296,46 @@ describe("failover-error", () => {
293296).toBe("overloaded");
294297});
295298299+it("lets Moonshot/Kimi billing-shaped 429 payloads win over generic rate limit status", () => {
300+expect(
301+resolveFailoverReasonFromError({
302+provider: "moonshot",
303+status: 429,
304+message: MOONSHOT_INSUFFICIENT_BALANCE_429_PAYLOAD,
305+}),
306+).toBe("billing");
307+expect(
308+resolveFailoverReasonFromError(
309+{
310+status: 429,
311+message: MOONSHOT_INSUFFICIENT_BALANCE_429_PAYLOAD,
312+},
313+"kimi-claw",
314+),
315+).toBe("billing");
316+expect(
317+resolveFailoverReasonFromError({
318+provider: "moonshot",
319+status: 429,
320+message: OPENAI_RATE_LIMIT_MESSAGE,
321+}),
322+).toBe("rate_limit");
323+expect(
324+resolveFailoverReasonFromError({
325+provider: "openai",
326+status: 429,
327+message: MOONSHOT_INSUFFICIENT_BALANCE_429_PAYLOAD,
328+}),
329+).toBe("rate_limit");
330+expect(
331+classifyFailoverSignal({
332+provider: "moonshot",
333+status: 429,
334+message: MOONSHOT_INSUFFICIENT_BALANCE_429_PAYLOAD,
335+}),
336+).toEqual({ kind: "reason", reason: "billing" });
337+});
338+296339it("classifies OpenRouter no-endpoints 404s as model_not_found", () => {
297340expect(
298341resolveFailoverReasonFromError({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。