Element guide

Claude Code statusline with cost display

Add a live running cost estimate to your Claude Code statusline so long sessions stay budget-aware.

Open the builder

Why show session cost?

Claude Code reports the accumulated session spend on `cost.total_cost_usd` every time it renders the statusline. Putting that number in your terminal turns it into a quiet ambient signal — useful for long autonomous runs where you want to notice if a loop has burned through ten dollars without you noticing.

The cost element is a computed expression in the IR (`cost_fmt`) — it formats the raw float to a configurable precision and adds a leading ` Claude Code Statusline with Cost Display | statusline.sh . Pair it with a Static element prefix like `spent ` if you want extra context.

How it looks

The preview below combines model, current branch, and the running cost styled in bold yellow. The element accepts any ANSI style — switch to dim gray for a quieter presentation, or to a red 256-color above a threshold using a conditional wrapper.

How to add it

Drag the Cost element from the palette, set precision (typically 2 or 4 decimals), and pick a foreground color. The same IR powers the bash, PowerShell, and browser interpreter backends, so what you see in the preview is byte-for-byte what your terminal will render after install.

Keep exploring