-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
savvy773 edited this page May 26, 2026
·
2 revisions
All endpoints are served by the local SvelteKit server at
http://127.0.0.1:5173.
| Method | Path | Description |
|---|---|---|
GET |
/api/usage |
Latest usage payload |
POST |
/api/usage/refresh |
Start or join a collection run |
GET |
/api/server/logs |
SSE stream of server log lines |
POST |
/api/server/stop |
Stop the server process |
Returns the latest payload from data/usage-latest.json.
Response shape (TypeScript)
{
providers: {
[name: string]: {
status: 'ok' | 'partial' | 'unavailable'
message?: string
current?: { used: number; total: number; percent: number }
weekly?: { used: number; total: number; percent: number }
resetAt?: string // ISO timestamp
resetIn?: string // "Xh Ym"
models?: ModelUsage[] // Gemini only
}
}
history: HistoryBucket[] // last 6 buckets
generatedAt: string // ISO timestamp
nextRefreshAt: string // ISO timestamp
refreshState?: {
refreshing: boolean
startedAt: string
}
}Starts a new collection run, or joins one already in progress.
Invoke-RestMethod `
-Method Post `
-Uri 'http://127.0.0.1:5173/api/usage/refresh' `
-ContentType 'application/json' `
-Headers @{ Origin = 'http://127.0.0.1:5173' } `
-Body '{}'Cooldown: 10 seconds between manual refreshes.
PollGET /api/usageuntilrefreshState.refreshing = false.
Server-Sent Events stream of server log lines.
const es = new EventSource('/api/server/logs')
es.onmessage = e => console.log(e.data)Stops the current server process (used by the Stop button in the UI).
Invoke-RestMethod -Method Post -Uri 'http://127.0.0.1:5173/api/server/stop'| Status | Endpoint | Meaning |
|---|---|---|
403 |
POST /refresh | Missing Origin header or non-JSON body |
429 |
POST /refresh | Cooldown active (10 s) |
503 |
any | Server process stopping |
See also: Architecture · Fix Checklist