Skip to content

Claude Code Data Source

ccusage can read Claude Code usage data as one of its supported local data sources. Claude Code is no longer treated as the only ccusage target; it uses the same unified and focused report model as Codex, OpenCode, Amp, and pi-agent.

Focused Views

bash
# Daily Claude Code usage
ccusage claude daily

# Weekly Claude Code usage
ccusage claude weekly

# Monthly Claude Code usage
ccusage claude monthly

# Claude Code sessions
ccusage claude session

Most users can start with unified reports such as ccusage daily. Add the claude namespace only when you want to focus the same report shape on Claude Code usage or pass Claude-specific options.

Data Source

ccusage reads Claude Code project logs from the standard Claude data directories:

SourceDefault paths
Claude Code~/.config/claude/projects/, ~/.claude/projects/

The tool checks both locations and combines valid data. When CLAUDE_CONFIG_DIR is set, that value replaces the default lookup and can contain one directory or a comma-separated list of directories.

Retention

Claude Code can retain logs for only 30 days by default. To review older Claude Code usage, change cleanupPeriodDays in your Claude Code settings.

Claude Code settings - Claude Docs

Report Views

Focused viewDescriptionSee also
ccusage claude dailyAggregate usage by dateDaily Usage
ccusage claude weeklyAggregate usage by weekWeekly Usage
ccusage claude monthlyAggregate usage by monthMonthly Usage
ccusage claude sessionGroup usage by Claude sessionSession Usage

Claude Code Features

Claude Code exposes additional local data that enables features beyond the shared report views:

  • Blocks - Claude Code 5-hour billing window analysis
  • Statusline - Compact real-time usage display for Claude Code status bar hooks

Environment Variables

VariableDescription
CLAUDE_CONFIG_DIROverride the root Claude Code data directory
LOG_LEVELAdjust verbosity (0 silent ... 5 trace)

Custom Claude Code Paths

Set CLAUDE_CONFIG_DIR when Claude Code logs live outside the default locations:

bash
export CLAUDE_CONFIG_DIR="/path/to/your/claude/data"
ccusage claude daily

Use comma-separated directories to combine current and archived Claude Code data:

bash
export CLAUDE_CONFIG_DIR="~/.config/claude,/backup/claude-archive"
ccusage claude monthly

For Codex, OpenCode, Amp, and pi-agent data locations, use the source-specific environment variables listed in Environment Variables.

Directory Detection

When CLAUDE_CONFIG_DIR is not set, ccusage searches in this order:

  1. ~/.config/claude/projects/
  2. ~/.claude/projects/

Data from all valid directories is combined automatically.

Troubleshooting

No Claude Code usage data found

Check whether your logs live under ~/.config/claude/projects/ or ~/.claude/projects/. If your data lives elsewhere, set CLAUDE_CONFIG_DIR or use the relevant path option.

Released under the MIT License.