Skip to content

Commit 950c27e

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@5066f579a26c76c7074cada988418fdb06655251
1 parent 17820af commit 950c27e

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎bun.lock‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎common/src/constants/freebuff-errors.ts‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
/** Provider billing failures observed from CrofAI, OpenRouter, and similar APIs. */
1+
/**
2+
* Provider billing failures observed from CrofAI, OpenRouter, and similar APIs.
3+
*
4+
* "Purchase credits" is OpenRouter's own newer wording and the only credit
5+
* phrase in one of its 402 bodies: "Free BYOK request cap exceeded for this
6+
* month. Purchase credits at https://openrouter.ai/settings/credits". None of
7+
* the verbs here matched it. Measured while Freebuff's OpenRouter balance sat
8+
* at zero on 2026-10-14 (17:42:03Z-17:54:39Z): 915 of the window's 2,002 402s
9+
* carried exactly that sentence, across 10 model ids, and not one of those
10+
* requests had a user key — so there was no account any of those users could
11+
* have purchased credits on. It is ours to refill.
12+
*
13+
* The reliable signal for this whole class is the status (HTTP 402), which is
14+
* what a surface should test when it has one; this alternation is for the
15+
* surfaces that only ever see the body.
16+
*/
217
export const FREEBUFF_PROVIDER_USAGE_ERROR_PATTERN =
3-
/\b(?:(?:not enough|insufficient|out of)\s+credits?|(?:add|refill|top up)\s+(?:more\s+)?credits?)\b/i
18+
/\b(?:(?:not enough|insufficient|out of)\s+credits?|(?:add|purchase|refill|top up)\s+(?:more\s+)?credits?)\b/i
419

520
/**
621
* The Codebuff API's own 402 for a paid (non-free) request names the user's

0 commit comments

Comments
 (0)