mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-11-01 07:02:30 +00:00
Read lithos-llm's quota_exceeded kind as a billing failure
A spent quota can come back as HTTP 429, which the banner showed as a temporary rate limit and told the user to retry. lithos-llm marks it quota_exceeded, which backoff never clears, so give it the billing wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f85866c65b
commit
16abf08fa7
2 changed files with 14 additions and 1 deletions
|
|
@ -50,6 +50,15 @@ describe("buildRunFailureView", () => {
|
|||
expect(failure?.nextStep).toBe("Add credit or raise the spend limit with Anthropic, then choose Retry from Actions.");
|
||||
});
|
||||
|
||||
test("reads a spent quota as billing, though the provider answered 429", () => {
|
||||
const failure = view(
|
||||
failedRun({
|
||||
message: "model request failed (quota_exceeded): provider gemini Quota exceeded for metric generate_content_requests [provider gemini, status 429, code RESOURCE_EXHAUSTED]",
|
||||
}),
|
||||
);
|
||||
expect(failure?.headline).toBe("gemini declined the request for billing reasons");
|
||||
});
|
||||
|
||||
test("names an unknown provider by its id", () => {
|
||||
const failure = view(
|
||||
failedRun({ message: "model request failed (authentication): provider acme bad key [provider acme, status 401, code unauthorized]" }),
|
||||
|
|
|
|||
|
|
@ -141,7 +141,11 @@ function parseModelRequest(message: string): ModelRequest | null {
|
|||
}
|
||||
|
||||
function requestAdvice({ kind, status, code }: ModelRequest, message: string, who: string): Advice {
|
||||
if (/credit balance|insufficient[_ ]quota|payment required|billing|spend limit/i.test(message) || status === 402) {
|
||||
if (
|
||||
kind === "quota_exceeded" ||
|
||||
status === 402 ||
|
||||
/credit balance|insufficient[_ ]quota|payment required|billing|spend limit/i.test(message)
|
||||
) {
|
||||
return {
|
||||
headline: `${who} declined the request for billing reasons`,
|
||||
nextStep: `Add credit or raise the spend limit with ${who}, then ${RETRY}.`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue