The blocks command groups your Claude Code usage into 5-hour billing blocks, helping you track costs within Claude’s billing cycle periods.
Basic Usage
- Block start time
- Duration/status (active, elapsed time, or gap)
- Models used
- Total tokens consumed
- Cost in USD
- Percentage of token limit (if specified)
Command Options
Active Block Only
View only the currently active billing block with projections:- Current usage
- Burn rate (tokens/minute, cost/hour)
- Projected usage if current rate continues
- Token limit status (if specified)
Recent Blocks
Show blocks from the last 3 days:Token Limit Tracking
Set a token limit to see quota warnings:Custom Session Duration
Change the billing block duration (default: 5 hours):Claude Code uses 5-hour billing blocks by default. Only change
--session-length if you’re tracking custom time periods.Filter by Date Range
View blocks within a specific date range:JSON Output
Export data in JSON format:jq Integration
Process JSON output with jq:Common Flags
Show only active block with projections (default: false)
Show blocks from last 3 days including active (default: false)
Token limit for quota warnings (e.g., 500000 or “max”)
Session block duration in hours (default: 5)
Filter from date (YYYYMMDD format)
Filter until date (YYYYMMDD format)
Sort order:
desc (newest first) or asc (oldest first). Default: ascOutput in JSON format (default: false)
Process JSON output with jq command (requires jq binary, implies —json)
Cost calculation mode:
auto (use pre-calculated if available), calculate (always calculate from tokens), display (always use pre-calculated)Timezone for date grouping (e.g., UTC, America/New_York, Asia/Tokyo). Default: system timezone
Locale for date/time formatting (e.g., en-US, ja-JP, de-DE). Default: en-US
Force compact mode for narrow displays
Use cached pricing data instead of fetching from API (default: false)
Show pricing mismatch information for debugging (default: false)
Examples
Monitor Active Block
Recent Blocks with Limit
Blocks This Week
High-Cost Blocks
Export Block Data
Understanding Billing Blocks
5-Hour Cycles
Claude Code bills usage in 5-hour blocks. When you start a session:- A new 5-hour block begins
- All usage in that period is billed together
- Gaps between blocks (inactive periods) are shown in gray
- A new block starts when you resume activity
Active Block
The active block is the current billing period where you’re accumulating usage. It shows:- Elapsed time: How long the block has been running
- Remaining time: Time left in the 5-hour window
- Current usage: Tokens and costs so far
- Burn rate: Current rate of token consumption
- Projection: Estimated total if current rate continues
Gaps
Inactive periods between blocks are shown as “gaps” in gray:Projections
For active blocks, ccusage projects final usage based on current burn rate:Token Limit Status
When--token-limit is set, ccusage shows:
- Limit: Your specified token quota
- Current Usage: Tokens used so far
- Remaining: Tokens left in quota
- Projected Usage: Estimated final usage percentage
- Status: Color-coded warning level
- 🟢 Green: Under 80% of limit (OK)
- 🟡 Yellow: 80-100% of limit (WARNING)
- 🔴 Red: Over 100% of limit (EXCEEDS LIMIT)
Use Cases
Real-Time Monitoring
Check your current billing block status:Quota Management
Track usage against your token limit:Cost Prediction
See projected costs for the active block:Historical Analysis
Analyze past billing blocks:Compact Mode
In narrow terminals or with--compact, time information is shown in a condensed format: