Overview
Thesession command displays Claude Code usage statistics grouped by conversation sessions. Each session represents an individual conversation or coding session with Claude, identified by a unique session ID.
Usage
Flags
Command-Specific Flags
Load usage data for a specific session ID. Shows detailed information for a single session instead of listing all sessions.Short flag:
-iExample: ccusage session --id abc123-def456Common 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 session --jq '.sessions[] | select(.totalCost > 1.0)'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. Displays detailed token usage for each model used.Short flag:
-bUse cached pricing data for Claude models instead of fetching from API.Short flag:
-ONegatable: Use --no-offline to disableShow 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 (better for screenshots).
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:- Session: Last two parts of session ID (for brevity)
- Input: Input tokens
- Output: Output tokens
- Cache Creation: Cache creation tokens
- Cache Read: Cache read tokens
- Total: Total tokens
- Cost: Total cost in USD
- Models: Models used in session
- Last Activity: Timestamp of last activity in session
In narrow terminals or with
--compact flag, some columns (cache metrics and total tokens) may be hidden. A message will indicate compact mode is active.JSON Output
With--json flag, outputs structured JSON:
Examples
List all sessions
View specific session details
Filter sessions from March 2024
Export session data to JSON
Show detailed model breakdown per session
Find expensive sessions using jq
Get total cost of all sessions
Session ID Format
Session IDs are unique identifiers assigned by Claude Code to each conversation. They typically follow a UUID-like format with multiple hyphen-separated segments. The table view shows only the last two segments for readability, but the full ID is available in JSON output and when using--id.