Files
homelab/pkgs/claude-usage.nix
darmanandClaude Opus 5.5 f84611bc6e feat(terra): Claude subscription limits panel on the rail
CLD panel next to luna showing the 5-hour and weekly usage windows (plus
any per-model weekly caps), polled every 5 min via a new `claude-usage`
script that reuses Claude Code's OAuth login and refreshes it when expired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 01:26:44 +02:00

12 lines
498 B
Nix

{ writeShellApplication, coreutils, curl, jq, util-linux }:
# Prints the Claude subscription's rate-limit windows as one JSON line, for the
# rail's CLD panel. Reuses Claude Code's OAuth login rather than a key of its
# own, so there is nothing to provision; always exits 0 with `{"error": ...}`
# so the panel can show why instead of going blank.
writeShellApplication {
name = "claude-usage";
runtimeInputs = [ coreutils curl jq util-linux ];
text = builtins.readFile ./claude-usage.sh;
}