Skip to content
Lesson 7 of 1258% of the course

Show context usage, cost and plan limits in Claude Code

Put the Claude Code context window, session cost, burn rate and the 5-hour and 7-day limits of Pro and Max plans in your status line, with bars and warning colours that show trouble early.

Video coming soonShow context usage, cost and plan limits in Claude CodeUntil then, the lesson below walks through every step.

Most people add a status line for three numbers: how full the context window is, what the session costs, and how much of their plan's limit is left. This lesson builds a line around them in Statusline Studio and explains what each number means.

Show how full the context window is

The context window is everything Claude Code keeps in mind for the session. When it fills up, Claude Code compacts it (summarises the history) and details get lost. Seeing it fill lets you compact or start fresh at a good moment.

The Context window group has these segments:

SegmentWhat it shows
Context used %How full the window is, in percent
Context remaining %How much is left
Context tokensThe tokens in the window now
Tokens left in windowHow many tokens still fit
Window sizeThe size of the window, like 200k or 1M
Cache read tokens and cache write tokensHow much of the input came from or went to the prompt cache
Last call input and output tokensThe size of the most recent API call
Over 200k badgeA badge that appears once the session passes 200k tokens

Add Context used %, turn on Progress bar and set its colour to heat. It then goes from green to red as it fills.

In a brand-new session, before the first reply, Claude Code has no number yet, so both percent segments stay hidden instead of showing 0%.

Track what the session costs

The Cost & stats group:

  • Session cost is the cost Claude Code reports for this session, as $3.42, 342¢ or rounded
  • Burn rate ($/hr) divides the cost by the session's duration, so you see how fast money goes
  • Session duration and API time show wall time and the time spent waiting for the model
  • Lines changed shows the lines added and removed
Budget Watch: spend, burn rate and the reset.

The cost comes from Claude Code itself. On a subscription plan it is what the session would cost at API prices, which is still a good measure of how heavy the session is.

Watch your 5-hour and 7-day limits

On a Pro or Max plan, usage is limited in a 5-hour window and a 7-day window. The Usage & limits group shows both:

  • 5-hour limit % and 7-day limit % show how much of each window you used
  • 5-hour reset and 7-day reset show when it resets, as time left (2h14m left), a clock time, or both

These segments hide themselves when Claude Code sends no limit data, for example with an API key. So you can keep them in a design you share with people on other plans.

Four more sit in the same group:

  • Spend limit % shows how much of a spend limit you used, when you work behind a Claude apps gateway that sets one, and Spend in dollars shows the same spend as an amount ($271.40). Without a spend limit both hide.
  • Prompt cache warm shows while the cached prompt is still fresh, and hides once it has gone cold. A warm cache makes the next turn cheaper and faster, so it is a hint to keep going rather than take a long break mid-task.
  • Prompt cache misses counts the requests this session that paid again for what the cache already held (2 cache misses), and hides while there are none.

Use heat colour and a Progress bar on the two limit segments too, and a text label (5h, 7d) so they are not confused with the context percentage.

Start from a template

Three templates are built around these numbers. Load one and change it:

TemplateBuilt for
Token WatchThe context window front and centre
Budget WatchSpend, burn rate, and when the window resets
Plan LimitsPro and Max: both windows and when they reset
Plan Limits near the cap.

Test it near the limit

Open Preview data and click Near cap: context at 94%, the 5-hour limit at 97%, the reset in 8 minutes. Every heat-coloured segment should now be red and easy to spot. If one is not, check its colour is set to heat.

Then click Fresh to make sure the line still looks calm when nothing is wrong.

The next lesson covers git, your machine and your own custom segments.

Your progress stays in this browser only.
Contact