DEV Community

Cover image for How to track Claude Code usage + analytics
Shipyard DevRel
Shipyard DevRel

Posted on • Originally published at shipyard.build

How to track Claude Code usage + analytics

Now that you’ve gotten into the habit of working with Claude Code, you’re probably curious to see how efficiently you’re using it. For example, do you know how many tokens it’s taking you to complete a ticket on average? Since Claude tokens can run out and will reset after 5 hours, you might want to see how much you’re pushing it to the limit.

We’ve tried three different ways to track our Claude Code usage. Here’s what we found.

Option 1 (the classic way): Check the Anthropic Console

If you’re using the Anthropic API for Claude Code access (instead of through a Pro or Max plan), you can track your usage through the Anthropic Console. This is useful for devs and orgs who are doing the “pay as you go” approach, because your number of tokens consumed is directly correlated to how much you’re spending.

If you’re a manager, you can see usage trends for your whole team, and get the data you need to find how Claude Code is impacting developer productivity. You’ll be able to see how often you/others accept Claude’s suggested changes. Anthropic suggests using this as a way to measure your org’s Claude Code adoption, as well.

Option 2 (view within your session): /context slash command

You can also view your current usage directly from a Claude Code session by running the /context slash command.

Claude Code context slash command

This will show you how many tokens you've consumed, how many you have available, and break down token usage by category. It'll also show you a detailed view of how individual actions (including MCP tool uses) have consumed tokens.

Option 3 (view historical usage): ccusage

ccusage is a CLI-based tool that lets you view usage by date, session, or project. We really liked using this tool for seeing how our usage was divided across repos (e.g. which ones did we rely on Claude more for?).

ccusage tracking token spend for Claude Code

It works by reading + analyzing Claude’s local JSONL files. This is super helpful if you have a Pro or Max plan, since you’re paying a flat rate per month and can’t track this via the Anthropic Console.

One cool thing about ccusage is that it’s so small you don’t need to fully install it, you can just run the npx command with whichever args you want to filter by:

npx ccusage@latest report daily
Enter fullscreen mode Exit fullscreen mode

You can also install it:

npm install -g ccusage
ccusage report daily --since 20250801
Enter fullscreen mode Exit fullscreen mode

Since it’s a CLI tool, you can ask Claude Code to run ccusage and retrieve info for specific search params:

Hey Claude, use ccusage to find my analytics for the RecipeBook project between July 3rd and July 7th.
Enter fullscreen mode Exit fullscreen mode

The only limitation is that ccusage can’t show your current, real-time Claude Code analytics. If this is something you want, check out the next tool in our list.

Option 4 (view real-time usage): Claude-Code-Usage-Monitor

Claude-Code-Usage-Monitor is another CLI-based tool for tracking how you use Claude Code. Unlike ccusage, this one gives you a real-time chart of your token consumption, cost estimate, and predictions about how long it’ll take for you to hit your limits.

Claude Code usage monitor

You can install it with pip or uv and run it with the cmonitor command:

pip install claude-monitor
cmonitor
Enter fullscreen mode Exit fullscreen mode

Run it while you’re using Claude in a different window, and see it update live as Claude generates. Like ccusage, this pulls from Claude’s local data.

You can see your historical usage in table view by including a timeframe:

cmonitor --view monthly
Enter fullscreen mode Exit fullscreen mode

Understanding Claude's session model

If you want to best plan out your Claude sessions, you’ll want to understand your constraints. Claude’s tokens are granted by plan based on overall server load, so on busier days you’ll get fewer.

If you’re not using the API for pay-as-you-go Claude access, you’ll want to choose the Claude tier that works best for you.

  • Pro: for a medium-high coding workload. Expect to use continuously for smaller code changes, and as a supplement to your own coding. $20/month
  • Max5: for an intense coding workload. 5x the token allowance of Pro. Opus access. $100/month
  • Max20: for near-autonomous, nonstop, heavy development workloads with multiple sessions/agents. Significantly larger context window. 20x the token allowance of Pro. Opus access. $200/month

Sessions kick off as soon as you send your first message, and last five hours.

It’s most efficient (and guarantees better outputs) if you start different sessions for different tasks.

The Bottom Line

We found the /context slash command, ccusage, and Claude-Code-Usage-Monitor were easy to use, and helped us make sense of our Claude metrics. This was helpful for tracking our own developer productivity, as well as seeing how Claude impacted our work styles.

If you’re using the Pro or Max tiers, you won’t be able to see this info in the Anthropic Console. We suggest using tools to supplement each other: /context to get a good summary by category, ccusage to view your usage trends, and Claude-Code-Usage-Monitor to see your live token consumption and predictions.

Using Claude Code? Give your agents ephemeral environments. They can deploy the code they write, pull logs, find + fix bugs, all with little-to-no human intervention. Try it free for 30 days.

Top comments (0)