Overview
Theblocks command displays Claude Code usage statistics grouped by 5-hour billing blocks. This matches Claude’s billing cycle where usage is grouped into continuous 5-hour periods. The command helps track active sessions, monitor burn rates, and project costs.
Usage
Flags
Command-Specific Flags
Show only the active block with projections. Provides detailed view of current session including burn rate and projected usage.Short flag:
-aShow blocks from the last 3 days (including active block). Useful for tracking recent usage patterns.Short flag:
-rToken limit for quota warnings. Can be a number (e.g., 500000) or “max” to use the highest token count from previous sessions.Short flag:
-tExamples:--token-limit 500000- Set explicit limit--token-limit max- Use max from history
Session block duration in hours. Default is 5 hours to match Claude’s billing cycle.Short flag:
-nCommon Flags
Filter from date in YYYYMMDD format (e.g., 20240301).Short flag:
-sFilter until date in YYYYMMDD format (e.g., 20240331).Short flag:
-uOutput in JSON format instead of a formatted table.Short flag:
-jProcess JSON output with jq command. Requires jq binary installed. Implies —json.Short flag:
-qExample: ccusage blocks --jq '.blocks[] | select(.isActive)'Cost calculation mode:
auto: Use costUSD if exists, otherwise calculate from tokenscalculate: Always calculate costs from token countsdisplay: Always use pre-calculated costUSD values
-mChoices: auto, calculate, displayShow per-model cost breakdown.Short flag:
-bUse cached pricing data for Claude models instead of fetching from API.Short flag:
-ONegatable: Use --no-offline to disableSort order:
asc: Oldest firstdesc: Newest first
-oChoices: asc, descShow pricing mismatch information for debugging.Short flag:
-dNumber of sample discrepancies to show in debug output.
Timezone for date grouping (e.g., UTC, America/New_York, Asia/Tokyo). Default: system timezone.Short flag:
-zLocale for date/time formatting (e.g., en-US, ja-JP, de-DE).Short flag:
-lForce compact mode for narrow displays. Automatically enabled for terminals narrower than threshold.
Path to configuration file. Default: auto-discovery.
Enable colored output (default: auto). FORCE_COLOR=1 has the same effect.
Disable colored output (default: auto). NO_COLOR=1 has the same effect.
Output Formats
Table Output (Default)
Displays a formatted table with columns:- Block Start: Start time of the billing block
- Duration/Status: Duration for completed blocks, “ACTIVE” for current block, “(inactive)” for gaps
- Models: Models used in the block
- Tokens: Total tokens consumed
- %: Percentage of token limit (if
--token-limitis set) - Cost: Total cost in USD
- REMAINING: Tokens remaining before hitting limit
- PROJECTED: Projected total usage if current burn rate continues
Compact mode is automatically enabled for narrow terminals. Time and duration formats are shortened to fit smaller displays.
Active Block Detail View
With--active flag, shows detailed information:
JSON Output
With--json flag, outputs structured JSON:
Burn Rate and Projections
For active blocks, the command calculates:-
Burn Rate: Current rate of token/cost consumption
- Tokens per minute
- Cost per hour
-
Projection: Estimated total usage if rate continues
- Projected total tokens
- Projected total cost
-
Token Limit Status: Warnings when approaching limits
- OK: < 80% of limit
- WARNING: 80-100% of limit (yellow)
- EXCEEDS: > 100% of limit (red)
Examples
View current active block
Track recent usage (last 3 days)
Set token limit for monitoring
Use historical max as limit
Export block data to JSON
Find blocks exceeding $1
View active block with token warnings
Check if projected usage will exceed limit
Understanding Billing Blocks
Claude Code groups usage into 5-hour billing blocks:- Each block starts when you begin a new session
- Usage within the same 5-hour window is grouped together
- Gaps between sessions (inactive periods) are marked as “(inactive)”
- Active blocks show real-time usage and projections
The default 5-hour session length matches Claude’s billing cycle. Changing this value with
--session-length will not align with actual billing.Related Commands
- daily - View usage grouped by day
- monthly - View usage grouped by month
- weekly - View usage grouped by week
- session - View usage by session
- statusline - Live monitoring status line