Back to feed
Dev.to
Dev.to
7/13/2026
Always-On Cost and Plan-Quota Visibility for Claude Code: Building a Statusline

Always-On Cost and Plan-Quota Visibility for Claude Code: Building a Statusline

Short summary

A detailed tutorial for building a Claude Code statusline script that displays 5-hour and 7-day plan quota usage, context window percentage, and session/daily costs — all from JSON piped to stdin, no API calls needed. The script uses jq for parsing, color-codes thresholds, and caches ccusage daily totals with a 2-minute background refresh to avoid stalling renders.

  • Claude Code streams JSON to statusline scripts via stdin — no auth or API calls needed
  • Script shows 5h/7d quota percentages, context usage, and session cost converted to yen
  • Daily cost aggregation uses ccusage with a 2-minute cache and background refresh to avoid render stalls

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more