The core API keys page (backend/apikeys/, business/apiKeys/) and the host
sidecar's /homelab-env writer are retired: a managed plugin that declares
managed.keyHealth gets the same page on its Settings page, generic.
Manifest
- settings.links[]: {label, url} https:// links with {{config.<field>}}
placeholders (URL-quoted; a link whose field is empty is left out).
- managed.keyHealth: alertLimit + currency (alertLimitEur still reads),
secretKey (default: the first hub secret), legacyLedgerTool (a core ledger
tool whose rows count as the plugin's spend: nanobanana → plugin:nanobanana).
Store / metering
- set_secret keeps a non-secret last-4 hint (installed.json → secretHints);
secrets stored before hints get theirs on first read.
- Runtime key settings per plugin (alertLimit, currency, pushAtPct,
pushOnBreak) over the manifest defaults.
- Key health: ok / broken states set the state, other failures are listed
only; a break pushes once (type error), the recovery once ("✅ <Plugin> key
works again", type success); the month pushes at pushAtPct and at 100 %,
each once per month; spend merges the legacy ledger tool.
Routes
- GET /api/plugins/{pid}/spend (plugins.manage): health + hint, settings,
month, byCaller, byModel, 30 days with failures, recent successes +
failures with session links, the links filled in (plugins/keyspend.py).
- PUT /api/plugins/{pid}/key-settings (plugins.manage).
- POST /api/plugins/{pid}/test records the testAction's verdict (its _meter
billed as via "test", or a structured _error whose kind is a key state).
- PUT /api/plugins/{pid}/secrets/{key} on the watched hub key: checked with
testAction before saving — the run's handler token carries the candidate in
memory (plugins.proxy.register_candidate) so its proxy calls use it;
invalid / denied → 400, no-credit / capped → saved, anything else → 502.
- /proxy/tools/nanobanana/<model> (the cli hub edition) reads the plugin's hub
key and feeds its health; Gemini's classify moves to toolproxy/catalog.
Frontend
- PluginKeyHealthSection (status + hint + Test / Replace + links, month with
progress, threshold marker and the limit / currency / alerts form, by caller
/ model + 30-day bars with failure dots, recent calls) on PluginSettingsPage
for the owner; /settings/api-keys redirects to /settings/plugin/nanobanana;
the settings entry, mock, lazy page and unused French strings go.
openapi.json is not re-dumped here (the coordinator does it after Batch 2).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>