Skip to content

Amp Data Source (Beta)

Amp support is experimental. Expect breaking changes while both ccusage and Amp continue to evolve.

ccusage can read Amp thread files as one of its supported local data sources, using the same reporting experience as the rest of ccusage: responsive tables, JSON output, LiteLLM-based pricing, cache token accounting, and credit totals where Amp records them.

Focused Views

bash
bunx ccusage amp --help
bash
npx ccusage@latest amp --help
bash
pnpm dlx ccusage amp --help

Data Source

The CLI reads Amp thread JSON files from AMP_DATA_DIR (defaults to ~/.local/share/amp). AMP_DATA_DIR can be one directory or a comma-separated list of directories.

bash
AMP_DATA_DIR="$HOME/.local/share/amp,/backup/amp" ccusage amp session
text
~/.local/share/amp/
└── threads/
    └── **/*.json

Report Views

Focused viewDescriptionSee also
ccusage amp dailyAggregate usage by dateDaily Usage
ccusage amp monthlyAggregate usage by monthMonthly Usage
ccusage amp sessionGroup usage by Amp threadSession Usage

These views support --json for structured output, --compact for narrow terminals, and --offline for cached pricing data.

What Gets Calculated

  • Token usage - Amp usage ledger events provide input and output token counts.
  • Cache tokens - Assistant message usage fields provide cache creation and cache read tokens when available.
  • Credits - Amp credit values are summed alongside token and cost totals.
  • Pricing - Costs are calculated from LiteLLM pricing data for Claude and Anthropic model names, including provider-prefixed variants.

Environment Variables

VariableDescription
AMP_DATA_DIROverride the root directory, or comma-separated root directories, containing Amp data
LOG_LEVELAdjust verbosity (0 silent ... 5 trace)

Troubleshooting

No Amp usage data found

Ensure the data directory exists at ~/.local/share/amp/threads/. Set AMP_DATA_DIR if your Amp data lives elsewhere or in multiple archive roots.

Costs showing as $0.00

If a model is not in LiteLLM's database, the cost will be $0.00. Open an issue to request alias support.

Released under the MIT License.