feat(chat): show a quota hint when the server's key is refused (#953)

On the server's own credentials a provider 403 now gets its own code,
server_key_forbidden, with a hint in all four languages: today's free
quota is used up, it resets tomorrow, and users can add their own key
in model settings. The generic "The provider returned an error." line
is left out for this code.

A daily spend cap that blocks a shared key makes every call return 403.
The old hint said the key may lack access to the model or region, which
points users at a setting they cannot change.

A 403 on the user's own key keeps the old hint and the provider's text.
This commit is contained in:
Dayuan Jiang
2026-10-06 09:49:48 +09:00
committed by GitHub
parent 8639779a23
commit 83f190e1cd
9 changed files with 67 additions and 6 deletions
+2 -1
View File
@@ -139,7 +139,8 @@ describe("provider error texts in the stream", () => {
)
const message = await streamedError({})
expect(message).not.toMatch(/org-operator/)
expect(message).toBe("The provider returned an error.")
// A 403 on the server's key gets its own hint and no message
expect(message).toBe("")
})
})