mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 05:12:11 +03:00
fix(open-sse): add 'has been exhausted' to CREDITS_EXHAUSTED_SIGNALS (fixes #8631)
Adds 'has been exhausted' string to CREDITS_EXHAUSTED_SIGNALS array so free-tier depletion errors like 'The free tier of the model has been exhausted.' are classified as QUOTA_EXHAUSTED rather than falling through to generic error handling.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user