feat(admin): show whether the AI key actually works, not just what it spent #5596
ccantynzAI Reviewcommented 1d ago
AI Triage
(no summary)
Priority: medium Risk area: mixed
Suggested labels: (no label suggestions) Suggested reviewers: (no reviewer suggestions)
Suggestions only — nothing has been applied. The PR author stays in control.
gluecron[bot]🤖 botAI Reviewcommented 1d ago
AI review unavailable
The platform's AI balance is exhausted, so AI generation is temporarily unavailable. Nothing was lost. You can queue this as a repair for the internal agent from the repository's Health page, or try again once the balance is restored. The PR is otherwise unchanged.
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
This platform's Anthropic key has been returning
400 credit balance is too lowsince 2026-08-04. Every AI feature has deferred quietly for four weeks. The only way anyone learned it was an agent SSHing into the box and curling the API by hand, then reporting back.Meanwhile
/admin/ai-costsrendered a tidy $1.75 month. A page about AI that could not tell you the AI was dead.What the panel shows
Three facts, kept separate on purpose:
max_tokens 1, ~five millionths of a dollar.POST, notGET, so no prefetcher or link checker bills us on its own schedule; the result returns as redirect params so a refresh doesn't re-bill.credit balance is too lowandinvalid x-api-keyare the same colour of red and demand opposite actions — the humanised "AI unavailable" the rest of the platform shows users is the wrong text for the one person who can fix it.Advice is deliberately narrow
Only errors whose remedy is unambiguous get any. An unrecognised error gets the provider's own words and no guess — a confident wrong instruction costs more than none, because the reader follows it.
The out-of-credit advice names the trap this account actually hit: funds added under a different organisation than the key belongs to.
Safety
The probe never throws. It renders inside an admin page, and a health check that can crash the page it reports on turns a provider outage into what looks like a platform bug.
14 tests, mostly about wording — unusual for a test file and the point: "AI unavailable" and "your key's account is out of credit" are the same fact and different products.