Skip to content

Conversation

@ryoppippi
Copy link
Owner

Summary

Adds a new @ccusage/amp package for analysing Amp CLI usage data, following the established patterns from codex and opencode packages.

What Changed

  • New apps/amp package with full CLI implementation
  • Parses Amp thread JSON files from ~/.local/share/amp/threads/
  • Extracts token usage from usageLedger.events[] and messages[].usage
  • Displays Amp credits alongside calculated USD costs using LiteLLM pricing
  • Supports three report types: daily, monthly, session (thread-based)
  • Includes JSON output (--json) and compact table mode (--compact)

Data Structure

Amp stores usage in JSON files (not JSONL) with structure:

  • usageLedger.events[] - billing events with model, credits, tokens
  • messages[].usage - detailed cache token information per message

Testing

  • Unit tests pass: pnpm --filter @ccusage/amp test
  • Build succeeds: pnpm --filter @ccusage/amp build
  • Manual testing with real Amp data confirmed working

Implements @ccusage/amp for analysing Amp CLI usage data stored in
~/.local/share/amp/threads/.

Features:
- Parses Amp thread JSON files containing usageLedger events
- Extracts token usage (input, output, cache creation, cache read)
- Displays Amp credits alongside calculated USD costs
- Supports daily, monthly, and session (thread) reports
- Includes JSON output format and compact table mode

The package follows the same patterns as codex and opencode packages,
using LiteLLM pricing data for cost calculations with Anthropic Claude
models.
@coderabbitai
Copy link

coderabbitai bot commented Jan 9, 2026

Warning

Rate limit exceeded

@ryoppippi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9d41053 and c1e980b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • apps/amp/CLAUDE.md
  • apps/amp/eslint.config.js
  • apps/amp/package.json
  • apps/amp/src/_consts.ts
  • apps/amp/src/_macro.ts
  • apps/amp/src/_types.ts
  • apps/amp/src/commands/daily.ts
  • apps/amp/src/commands/index.ts
  • apps/amp/src/commands/monthly.ts
  • apps/amp/src/commands/session.ts
  • apps/amp/src/data-loader.ts
  • apps/amp/src/index.ts
  • apps/amp/src/logger.ts
  • apps/amp/src/pricing.ts
  • apps/amp/src/run.ts
  • apps/amp/tsconfig.json
  • apps/amp/tsdown.config.ts
  • apps/amp/vitest.config.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide c1e980b Jan 09 2026, 12:14 PM

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 9, 2026

Open in StackBlitz

@ccusage/amp

npm i https://pkg.pr.new/ryoppippi/ccusage/@ccusage/amp@785

ccusage

npm i https://pkg.pr.new/ryoppippi/ccusage@785

@ccusage/codex

npm i https://pkg.pr.new/ryoppippi/ccusage/@ccusage/codex@785

@ccusage/mcp

npm i https://pkg.pr.new/ryoppippi/ccusage/@ccusage/mcp@785

@ccusage/opencode

npm i https://pkg.pr.new/ryoppippi/ccusage/@ccusage/opencode@785

@ccusage/pi

npm i https://pkg.pr.new/ryoppippi/ccusage/@ccusage/pi@785

commit: c1e980b

@ryoppippi ryoppippi merged commit acfacba into main Jan 9, 2026
16 checks passed
@ryoppippi ryoppippi deleted the feat/amp-cli branch January 9, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants