Remember plan-level model errors and surface them in /model (badge, sort, recovery hint)
(AI-assisted report — drafted with my coding agent, reviewed and submitted by me.)
What do you want to change?
When a request fails with a plan-level error — 429 with quotaValue/limit: 0, 404 model-retired, 400 not-in-plan, 401 — record a per-model, per-credential mark via deterministic checks (status code + JSON fields + string match on the error body pi already received). Then:
- In
/model: badge marked models (e.g.no quota on this plan,retired -> gemini-3.6-flash) and sort them below unmarked ones. Never hide them. - At failure time, print a fixed recovery line: "This model has no quota on your plan. Run /model — unmarked models are sorted first."
- Optional, config-gated, off by default: auto-rotate the session to the first unmarked model and announce it.
Marks clear on credential change or a later success. Explicitly not in scope: active probing, or any model-mediated "you should switch to X" guidance — this only replays what the provider already said. The classification must be deterministic because of when this bites: the user has no working model, so the agent itself cannot help them.
Why?
I teach intro computing at Loyola University Chicago. This term 24 students onboarded pi on Gemini free-tier keys; on the first take-home exercise, 15 of 24 documented model-selection dead ends. Every failure was predictable from an error pi had already received and forgotten: limit: 0 means the plan has no quota for that model ever, the 404 body literally names the replacement model, yet the same models reappear undifferentiated in the picker at the next session. My students are novices and most pi users are not — but even experienced users lose turns rediscovering limit: 0.
How? (optional)
The ingredients exist and are unconnected (paths at 400d690): onResponse(ProviderResponse, model) in packages/ai/src/types.ts:149 observes per-model statuses without touching adapters; ModelRuntime.stream/complete (packages/coding-agent/src/core/model-runtime.ts:610) is a single classification point; ModelsStoreEntry (packages/ai/src/models-store.ts:3) already persists per-provider model state; credential mutations are centralized (model-runtime.ts:514) for mark invalidation; sortModels() (.../components/model-selector.ts:231) is current-first/default-second/provider — a marked-last tier slots in. One caveat: provider error prose changes, so the match patterns may belong in each provider's compat.* layer rather than a global table. Happy to implement.
Source: earendil-works/pi