diff --git a/open-sse/services/accountFallback.ts b/open-sse/services/accountFallback.ts index 0f43303e81..97ff711685 100644 --- a/open-sse/services/accountFallback.ts +++ b/open-sse/services/accountFallback.ts @@ -183,6 +183,7 @@ export const CREDITS_EXHAUSTED_SIGNALS = [ "out of credits", "payment required", "free tier of the model has been exhausted", + "has been exhausted", // #5239: providers (e.g. DeepSeek/GLM-style) return "Insufficient account balance" // on a depleted key. 402 is already terminalized by status, but catch non-402 // out-of-credit bodies here too. diff --git a/tests/unit/error-classifier.test.ts b/tests/unit/error-classifier.test.ts index ef9b740955..fac4760cbd 100644 --- a/tests/unit/error-classifier.test.ts +++ b/tests/unit/error-classifier.test.ts @@ -27,6 +27,11 @@ test("classifyProviderError: 400 + billing signal => QUOTA_EXHAUSTED", () => { error: { message: "insufficient_quota: exceeded your current quota" }, }); assert.equal(result, PROVIDER_ERROR_TYPES.QUOTA_EXHAUSTED); + + const resultExhausted = classifyProviderError(400, { + error: { message: "The free tier of the model has been exhausted." }, + }); + assert.equal(resultExhausted, PROVIDER_ERROR_TYPES.QUOTA_EXHAUSTED); }); test("classifyProviderError: 429 without billing signal => RATE_LIMITED", () => { @@ -132,10 +137,6 @@ test("classifyProviderError: 404 => MODEL_NOT_FOUND", () => { }); test("classifyProviderError: 404 with provider => MODEL_NOT_FOUND", () => { - const result = classifyProviderError( - 404, - { error: { message: "Not Found" } }, - "v0-vercel" - ); + const result = classifyProviderError(404, { error: { message: "Not Found" } }, "v0-vercel"); assert.equal(result, PROVIDER_ERROR_TYPES.MODEL_NOT_FOUND); });