vps-health-api/__tests__/fixtures/claude-usage/oauth-usage.json
le king fu 2c95330ffa feat(agent): add the claude-usage agent: plan limits, local cache, push
limits.js reads the Claude Code OAuth credentials read-only and calls the
pinned Anthropic usage endpoint once (redirect refused, 10 s timeout, no
retry, never a refresh); detail codes come from a fixed enum only.
state.js freezes every Toronto day before yesterday, empty ones included,
prunes past 35 days, keeps the last good limits, and writes atomically in
mode 600. push-claude-usage.js writes the cache before pushing, refuses a
non-https URL (exit 1) and a body over 64 KiB (exit 2, nothing sent), and
prints no token. run-claude-usage.sh takes a non-blocking flock so a beat
that overlaps the previous one exits 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 09:28:33 -04:00

53 lines
1.3 KiB
JSON

{
"five_hour": { "utilization": 1.0, "resets_at": "2026-09-27T21:30:00.512345+00:00" },
"seven_day": { "utilization": 50.0, "resets_at": "2026-10-01T07:00:00.512345+00:00" },
"seven_day_oauth_apps": null,
"seven_day_opus": null,
"seven_day_sonnet": null,
"seven_day_fable": null,
"iguana_necktie": null,
"extra_usage": null,
"opaque_a": null,
"opaque_b": null,
"opaque_c": null,
"opaque_d": null,
"opaque_e": null,
"opaque_f": null,
"opaque_g": null,
"opaque_h": null,
"opaque_i": null,
"opaque_j": null,
"opaque_k": null,
"opaque_l": null,
"opaque_m": null,
"opaque_n": null,
"limits": [
{
"kind": "session",
"group": "session",
"percent": 1,
"severity": "normal",
"resets_at": "2026-09-27T21:30:00Z",
"scope": null,
"is_active": true
},
{
"kind": "weekly_all",
"group": "weekly",
"percent": 50,
"severity": "normal",
"resets_at": "2026-10-01T07:00:00Z",
"scope": null,
"is_active": true
},
{
"kind": "weekly_scoped",
"group": "weekly",
"percent": 63,
"severity": "normal",
"resets_at": "2026-10-01T07:00:00Z",
"scope": { "model": { "display_name": "Fable" } },
"is_active": true
}
]
}