Admin panel, backup & maintenance
Everything an operator needs day to day.
Everything an operator needs day to day.
The admin panel
Reach it at /dashboard/admin (admin role required). It covers:
Users & plans — user list (sortable by balance/usage), per-user cap resets, credit adjustments, session revocation, impersonation, plan CRUD and reordering, subscription management.
AI & routing — model catalogue (import, activate, price, variant pricing, per-model router overrides), router management and health, model uptime tracking.
Billing — transactions, invoices (with export and reconciliation), coupons, the gift shop (products + codes), and the payment gateway settings.
Engagement — announcements, broadcast (with pause/resume/retry and export), email logs + an email tester, CMS pages, SEO, referrals.
Ops — audit log, live request log (with optional body capture), queue inspector, health, MCP connectors, maintenance mode, analytics, and a live monitor.
Resetting a user's caps
From Admin → Users → (user) → Reset caps, reset individual caps for a user: the 5h / 24h / weekly / monthly windows, the daily free-model token budget, and each modality's daily allowance (image / video / TTS / STT). This re-stamps the window anchors so the meters count from now — the tool for "this user hit a wall unfairly".
Backup & restore
Backups run daily at 03:00 UTC via scripts/backup.sh, writing timestamped
.tar.gz archives to /opt/sleepy-ai/backups/ (7-day retention). Each
archive contains a full PostgreSQL dump, the compose/Caddy/env configs with
secrets redacted, and metadata.
Trigger manually:
bash scripts/backup.sh # CLI
curl -X POST localhost:3000/api/admin/backup?action=trigger # API (admin session)
# or Admin → Settings → System Maintenance → Run Backup Now
Restore onto a new VPS: deploy fresh → scp the archive over → pipe the
dump into psql inside the postgres container → docker compose down && docker compose up -d --build → verify login. Full steps in
Admin Operations.
Maintenance mode
Blocks the API and shows a maintenance page. Toggle from Admin → Settings → System Maintenance, or:
curl -X PUT https://your-domain.com/api/admin/maintenance \
-H "Content-Type: application/json" \
-H "Cookie: <admin-session>" \
-d '{"enabled":true}'
Health & readiness
GET /api/healthz— liveness, DB-free (safe for load balancers during a deploy)GET /api/readyz— readiness: checks the database and that migrations have applied (bounded to a 15-minute window so a stale record warns but still returns 200)GET /api/status— public per-model health bars (no auth, outside the maintenance-mode 503 so status pages stay up)
Logs & diagnostics
| Prefix | Where | What it tells you |
|---|---|---|
[PROXY POST] / [PROXY GET] | dashboard logs | every API request (path, user, status, tokens) |
[SESSION-CHECK] | dashboard logs | auth verdicts (valid, key_revoked, invalid_token, suspended) |
[TOKEN-REFRESH] | dashboard logs | CLI token refresh outcomes |
[UsageService] | dashboard logs | missing-model fallback pricing |
docker logs sleepy-ai-dashboard-1 --tail 200 2>&1 | grep -E "PROXY|SESSION-CHECK|UsageService"
Cron jobs
Background jobs (all guarded by CRON_SECRET):
- Backups — daily 03:00 UTC
- validate-payments — confirms pending PipraPay deposits, expires stale ones
- expire-subscriptions — reconciliation so a lapsed subscription stops granting paid entitlement
- release-stale-reservations — reclaims billing reservations stranded by a dead process (6-hour cutoff, conservative by design)
- telegram-reminders — hourly usage-alert DMs at the 80/90/100% bands
- model-uptime — records per-model request outcomes for health tracking
- broadcast — sends scheduled announcements
Common operations
# Rebuild only the dashboard
docker compose up -d --build dashboard
# Restart one service
docker compose restart dashboard
# Clear the model cache (if model changes aren't reflecting)
curl -X POST https://your-domain.com/api/admin/models/cache -H "Cookie: <admin-session>"
# Live resource usage
docker stats
Backup gateway (optional)
A standalone Go gateway (api/) can front the dashboard as a second URL for
the same API and the same virtual keys. It proxies to the dashboard
rather than reimplementing anything, so keys aren't ported or re-issued. Set
API_BACKUP_HOST to surface the backup URL on the API Keys page; leave it
empty to hide it.
Next: Configuration · Install