OpenProgram Docs

Credential status

statusCauseRecovery
readyusablenone
cooling429: held until the provider's reset, else 60 s doubling per repeat up to 15 minautomatic when the hold ends, or the next success
quota402, or any refusal whose body says the credit or plan is spent (CreditsError, insufficient_quota, "insufficient balance", Alibaba's 400 Arrearage)held until the quota reader's reset, else 24 h; a passing check clears it
invalid_key401 or 403 on a key, whose body does not say the credit is spentreplace the key
needs_login401 or 403 on a sign-in after one refresh, or a refused refresh tokensign in again

A credential's status, cooldown_until_ms and last_error ({at, code, message}) are its whole state. A model the key may not use is blocked on that key alone (blocked_models), not as a status.

The body decides before the status code. OpenCode Zen answers a zero balance with 401 CreditsError; read as a refused key, the page would say "Replace the key" when the fix is a top-up. The phrasings live in one list, errors.py BILLING_MARKERS, taken from the adapters' bodies and the peers' billing tables (hermes-agent _BILLING_PATTERNS, openclaw failover-matches).

What touches the credential

ResponseCredential
429Retry-After of 5 s or less: once more on it. Otherwise cooling; the next one is tried
402, spent quotaquota; the next one is tried
401, 403invalid_key or needs_login; the next one is tried
Model not allowedThat model blocked on it for 24 h
5xx, networkUntouched; sent again on the same key
400, 404, 422Untouched

A switch adds one muted line to the conversation. When nothing is usable, the error lists every credential's state in plain words ("rate limited", "out of quota", "key refused", "sign in again").

Why a hold, and only for these

A limited or spent key must not be sent again on the next request, or every turn pays one refused round trip before switching. A 5xx or a 404 says nothing about the key, so it is never held.

Code

WhereWhat
auth/selection.py classifyA failure as rate limit, quota, refusal, model, server or network; a billing body is quota before 401 or 403 is read
auth/selection.py mark, succeeded, clearSet a status and its hold; a success or a passing check returns it to ready
listing/credentials.py status_from_probeA check writes ready only on proof of use (OpenRouter GET /key remaining, or a ping 200); an auth-only GET /models 200 does not clear quota
auth/carry_over.pyThe one-time move of the old statuses: needs_reauth and revoked become invalid_key or needs_login (a 24 h quota hold when their error is a billing body), billing_blocked a 24 h quota hold from when it was set; repair applies this once to lists already carried
detail/credentials-section.tsxShows each credential's status as a badge with a dot
Peers
ProjectModel
OpenClawcooldownUntil (429, 30 s to 1 m to 5 m), disabledUntil (402 or permanent auth, backoff), blockedUntil (subscription quota reset). 5xx leaves health alone.
opencodeNo pool. 429 and 5xx retried twice with backoff; the rest are structured errors.
Claude CodeSingle account; each failure is a chat message with an action.

Credential validation

Last updated · 2026-11-25