no warning when api-key in arrearage There is no response for chat when api-key in…
- User
no warning when api-key in arrearage There is no response for chat when api-key in arrearage, please give me a warning
Evaluation contract
Treat HTTP 402, normalized billing/quota tokens such as
insufficient_quota,quota_exceeded,quota_exhausted,billing_hard_limit_reached, andpayment_required, and unambiguous billing text such as “exceeded your current quota”, “insufficient balance”, or “payment required” as account-arrearage failures. Surface a non-empty billing-specific message that does not expose the raw provider dump and takes precedence over a configured generic error message. A plain HTTP 429rate_limit_exceeded, timeouts, connection failures, HTTP 5xx responses, successful responses, and ordinary text that merely mentions a quota are not arrearage. Persist only the existing model-error placeholder in session history.Interface
Type: Function Name: is_arrearage_response Path: nanobot/providers/base.py Input: cls, response: LLMResponse Output: bool Description: Detects API-key arrearage, quota, or billing errors that won't clear on retry. Returns True for HTTP 402 status, billing semantic tokens (e.g., 'insufficient_quota'), or matching text markers in the response content.
- Assistant
I'll locate how provider errors are handled today and where chat responses are built, so we can add arrearage detection and a clear billing warning.
- Assistant
Implementing
is_arrearage_responseand wiring it into the runner so billing failures show a clear warning instead of a blank or raw provider error. - Assistant
Adding tests for arrearage detection and runner billing warnings.
- Assistant
Billing and quota failures now show a clear warning in chat instead of a blank reply or raw provider JSON.
is_arrearage_response(nanobot/providers/base.py)Detects account arrearage via:
- HTTP 402
- Billing tokens:
insufficient_quota,quota_exceeded,quota_exhausted,billing_hard_limit_reached,payment_required(from structured fields or JSON in content) - Billing text:
"exceeded your current quota","insufficient balance","payment required"
Does not treat plain
rate_limit_exceeded, timeouts, connection errors, 5xx, or casual quota mentions as arrearage.Runner warning (
nanobot/agent/runner.py)On LLM error, if arrearage is detected, the user sees:
Your API provider account has insufficient credits or has reached a billing limit. Please check your account balance and billing settings, then try again.
This overrides both the raw provider payload and any configured generic error message. Session history still stores only the existing placeholder:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.