Compatibility is pinned to Wei-Shaw/sub2api commit c2c19a7cbe8486ebb5b56834d1a6e07b3f12cffc, whose server version is 0.1.159. The dashboard requires zero upstream source changes.
| Purpose | Method and path | Authentication |
|---|---|---|
| Public settings | GET /api/v1/settings/public |
none |
| Login | POST /api/v1/auth/login |
none |
| Two-factor login | POST /api/v1/auth/login/2fa |
temporary token in request body |
| Refresh | POST /api/v1/auth/refresh |
refresh token in request body |
| Current user | GET /api/v1/auth/me |
Authorization: Bearer <user token> |
| Available groups | GET /api/v1/groups/available |
Authorization: Bearer <user token> |
| Group account page | GET /api/v1/admin/accounts?group=<id>&page=<n>&page_size=<n> |
x-api-key: <admin key> |
| Passive account usage | GET /api/v1/admin/accounts/<id>/usage?source=passive |
x-api-key: <admin key> |
There is no generic pass-through route. The dashboard does not call mutation, active test, billing, probe, forced refresh, or user-management endpoints.
A new sub2api deployment must complete its own setup/bootstrap flow before this dashboard can work. Create or configure the upstream admin API key in upstream and provide it as SUB2API_ADMIN_API_KEY; the BFF sends it only as x-api-key on the two admin calls above.
An upstream HTTP 423 is surfaced as HTTP 423 with dashboard code COMPLIANCE_LOCKED. Complete the required upstream administrator compliance/setup action. The dashboard does not work around or auto-accept compliance.
- Admin account pages are requested for one allowlisted group and then defensively checked for group ownership.
- Pagination accepts the pinned response conventions used by the BFF (
items/accounts,pages/total_pages, andtotal) and is bounded locally. - Reaching
MAX_PAGESorMAX_ACCOUNTS_PER_GROUPyieldspartial: true. - Passive usage is limited to Anthropic OAuth and SetupToken/setup-style credentials. The call always uses
source=passive. - Lite/local accounts with no safe local quota fields cause no active upstream work; they remain
unknown. - OpenAI OAuth accounts do not use the Anthropic passive endpoint. The BFF can map approved Codex 5-hour/7-day account snapshot fields from
extrainto local windows; 0% remains a known value. It prefers explicit reset timestamps, otherwise derives them from the usage update time plus reset-after seconds. Expired resets remain visible as stale utilization withoutresetsAt. - Other non-Anthropic accounts may use existing normalized top-level
quota_*fields only. Unknown data remainsunknown, never zero. - Account pagination is followed immediately by a whitelist normalization boundary, so account caches do not retain full
extra, credentials, email, proxy, or cost fields.
For every upstream upgrade, inspect the exact target commit and verify:
- Every path and HTTP method in the table still exists.
- User auth remains Bearer and admin auth remains
x-api-key. - Login 2FA still uses a non-empty
temp_tokenandtotp_code. - Group availability and account membership fields retain compatible semantics.
- Pagination field names, termination behavior, and filters remain compatible.
- Passive usage still means no active request and still accepts
source=passivefor Anthropic OAuth/SetupToken. - Compliance still returns 423 and has not introduced a required mutating acknowledgement.
- Response-size, timeout, and error behavior remain safely normalized.
- Contract, integration, E2E, lint, typecheck, build, and format checks all pass against a mock updated from the target SHA.
Record the new full SHA in CLAUDE.md, this document, and the README only after these checks. Do not track main implicitly.