Tutorial

Using ccusage to Monitor Claude Code Usage

2025-08-17 #Claude Code

If you are using Claude Code through a Claude Pro or Max subscription, running /cost will return a prompt telling you there is no need to worry about costs:

With your Claude Pro subscription, no need to monitor cost — your subscription includes Claude Code usage

However, if you are curious about your actual usage of Claude Code—for instance, to confirm if you are getting your subscription's worth, or if using the API directly would be cheaper.

You can use the ccusage project for this.

ccusage works by reading the files under your local ~/.claude/projects directory to perform analysis. It only tracks usage statistics on the local machine, so you can use it with peace of mind.

Installation

The developers of ccusage pay great attention to package size, so you can run it directly via npx or pnpm without installing it:

1
npx ccusage@latest

Of course, it also supports direct global installation so you can run it just by typing ccusage:

1
2
3
4
5
# npm
npm install -g ccusage

# pnpm
pnpm add -g ccusage

How to Use

Run ccusage directly to view your daily usage report:
ccusage-reports

Slacking off, about to lose money (

Running ccusage -i can also display usage reports for different projects.

More commands:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 查看每日报告
ccusage
ccusage daily

# 查看每周报告
ccusage weekly

# 查看每月报告
ccusage monthly

# 查看不同会话的报告
ccusage session

# 按每 5 小时计费窗口进行查看
ccusage blocks

# 实时监控
ccusage blocks --live

Adding ccusage to the Claude Code Status Line

If you want to view your usage reports in real-time while using Claude Code, you can configure it directly inside Claude Code.

Open ~/.claude/settings.json in your editor and add the following code to show your usage in the status line in real-time:

1
2
3
4
"statusLine": {
"type": "command",
"command": "npx ccusage statusline"
}

~/.claude/settings.json is the global configuration for Claude Code, which is not created by default. If you have no other configurations, the complete file contents are as follows:

1
2
3
4
5
6
{
"statusLine": {
"type": "command",
"command": "npx ccusage statusline"
}
}

Then reopen Claude Code, and the output will look like this:
ccusage-in-cc

If you are also curious about your actual consumption when using Claude Code, go ahead and install it to try it out!

Comments
Share

Comments