Omniscio

OmniscioGuidesStatus line examplesCost so far

Claude Code status line: session cost so far

A cost row is the one status line people build and then distrust, because the number is right and it is still not the bill. This page gives you the whole script, then exactly what the figure is an estimate of, the other cost fields you can add, and the five ways the row misleads.

Checked against Claude Code 2.1.332 documentation, November 25, 2026. By the Omniscio team. Updated .

What it shows

One row: the model, the session's estimated cost to two decimal places, and the wall-clock time the session has been running.

[Opus] ๐Ÿ’ฐ $0.42 | โฑ๏ธ 12m 4s

The amount is a dollar figure for the API calls in this session. The time is minutes and seconds of session life, not the time you have spent waiting for the model โ€” those are two different numbers in the same object, and the field table below keeps them apart.

Two decimals is enough. Four would make the row jump on every message and tell you nothing the two do not.

The full script

Save this as ~/.claude/statusline.sh and make it executable. It is Anthropic's cost and duration tracking example, reproduced whole.

#!/bin/bash
input=$(cat)

MODEL=$(echo "$input" | jq -r '.model.display_name')
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
DURATION_MS=$(echo "$input" | jq -r '.cost.total_duration_ms // 0')

COST_FMT=$(printf '$%.2f' "$COST")
DURATION_SEC=$((DURATION_MS / 1000))
MINS=$((DURATION_SEC / 60))
SECS=$((DURATION_SEC % 60))

echo "[$MODEL] ๐Ÿ’ฐ $COST_FMT | โฑ๏ธ ${MINS}m ${SECS}s"

The script needs jq installed โ€” a separate download from jqlang.org that is not on a stock Mac. Check with jq --version before anything else: without it every field reads as empty, and you get a row of zeros rather than an error.

The // 0 fallbacks handle a different case: a real session whose first API response has not landed yet, when the fields are null rather than missing. The fallback is what makes that moment read $0.00 instead of $null.

The arithmetic converts milliseconds to whole seconds first, then to minutes and a remainder. That is why the seconds never run past 59.

The settings entry

In ~/.claude/settings.json, or a project's .claude/settings.json. These are the statusLine keys on their own: add them beside whatever the file already holds, inside the same braces, rather than pasting over it.

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh",
    "refreshInterval": 10
  }
}

The value is in seconds, and refreshInterval matters more here than on any other script in this set. A clock is exactly the time-based data Claude Code names as the reason for the field: without it the row updates only when something triggers it, and those triggers can go quiet while the session sits idle, so a long gap looks like a frozen timer.

Ten seconds is a reasonable compromise: fast enough that the minute changes on time, slow enough that the timer is not the busiest thing on your machine.

On Windows, write the path with forward slashes โ€” C:/Users/you/.claude/statusline.sh rather than C:\Users\you\.claude\statusline.sh. When Git Bash is installed Claude Code runs the command through it, and Git Bash treats an unquoted backslash as an escape character, so the path loses its separators and the row fails without an error. If your user name contains a space, quote the path and escape the quotes for JSON.

What each field means

The cost object has five fields, and the script uses two of them. The rest are worth knowing because they are what people reach for when they want the row to say more. The table ends with the model field every script in this set opens with.

The cost object, plus the model field every row in this set opens with.
FieldWhat it holds
cost.total_cost_usdEstimated session cost in USD, computed client-side at list price unless a modelPricing table is in effect. It may differ from your actual bill, and it resets to $0 when /clear starts a new session
cost.total_duration_msTotal wall-clock time the session has been running, in milliseconds. It accumulates across resumes and does not include time while the session is not running
cost.total_api_duration_msOnly the time spent waiting for API responses. Subtract it from the total to see the time the session spent doing anything else
cost.total_lines_added, total_lines_removedLines of code changed in the session, which is what a diff-shaped row is built from
model.display_nameThe model's display name, the same field every script in this set opens with

The one setting that changes the meaning of the first row is a modelPricing table, and its scope is managed settings: Claude Code ignores it in user, project and local settings. With a table in effect, the estimate follows your contracted rates instead of list price. Without one, it is list price, whatever your organisation actually pays.

So the honest reading of the dollar figure is: what this session would have cost at published rates. That is useful for spotting an expensive habit. It is not an invoice.

How to confirm it renders

Pipe the script a cost and a duration you chose, so the formatting is the only thing under test:

echo '{"model":{"display_name":"Opus"},"cost":{"total_cost_usd":0.4242,"total_duration_ms":724000},"session_id":"test"}' | ~/.claude/statusline.sh

That should come back as [Opus] ๐Ÿ’ฐ $0.42 | โฑ๏ธ 12m 4s: the cost rounded to two decimals, and 724 seconds read as twelve minutes and four seconds. If the formatting is right here, the script is right and anything you see later is the session's own numbers.

Then watch a real session for a minute. The minute changing on time is the proof that refreshInterval is being honoured; if it only moves when you send a message, the field is not being read โ€” check your build, and check the setting is in the file Claude Code is actually loading.

If no row appears at all, claude --debug shows the script's stderr and the exit code of its first invocation.

The common failure

The common failure is not a broken script, it is a broken expectation: the number does not match the bill, and people conclude the field is wrong. It is an estimate, computed on your machine at list price unless a modelPricing table is set, and Anthropic says in the field's own description that it may differ from your actual bill.

The second failure is the reset. /clear starts a new session, so the cost goes back to $0.00 โ€” correctly. If you were using the row as a running total for the day, it is not one.

What you see, and what is actually happening.
What you seeWhat is happening
The figure disagrees with your billIt is a client-side estimate at list price unless a modelPricing table applies, and Anthropic says it may differ from the bill
The row is back to $0.00/clear started a new session, and the field is per session
The timer stops while you are readingThe event triggers can go quiet when the session is idle, so nothing re-runs the script. refreshInterval is the field that keeps a clock honest
The timer is much larger than the useful worktotal_duration_ms is wall-clock time the session has been running; total_api_duration_ms is only the waiting. Compare the two before blaming the model
You see $0.00 until you send a messageThat is right: the cost fields carry nothing until the first API response, and the fallback prints $0.00 rather than $null

The other scripts in this set

Each is a complete script and settings entry, not a fragment. The last is a guide to the pricing behind this row rather than another script.

Where Omniscio fits

The status line is Claude Code's own, and nothing on this page needs Omniscio. Omniscio is a desktop app for running several Claude Code agents side by side, in one list rather than a wall of terminals.

Its agent sessions run Claude Code in print mode, so they show Omniscio's session list rather than a terminal row, while a status line you configure still applies to any claude you run yourself in a terminal.

The features page lists what the app does today.

How this page was checked

Every statement here about Claude Code comes from Anthropic's own documentation, read in its Markdown form on November 25, 2026: the status line page, the settings reference and the changelog. The version line comes from the changelog, whose newest release is 2.1.332, dated November 25, 2026.

The script is Anthropic's cost and duration example reproduced in full. It was not written for this page and not run on our machine; the sample rows on this page are that script's own formatting applied to the numbers given in the check above.

What this page says about Omniscio comes from our own pages. If Anthropic's page and this one ever disagree about Claude Code, Anthropic's page is right, because this part of Claude Code changes on nearly every release.

Sources

  • Customize your status line: the setting, the cost and duration example, the full JSON, the cost fields, the update triggers and the troubleshooting section
  • Settings reference: the statusLine entry and its fields, and the modelPricing table the cost estimate follows
  • The changelog: release 2.1.332, the newest listed
  • jq: the JSON parser the script calls

Omniscio's own pages, for what this section says about this app:

Common questions

Why does the status line cost not match my bill?

Because it is an estimate, calculated by Claude Code on your machine at list price unless a modelPricing table is in effect. Anthropic says it may differ from your actual bill. Treat the row as a running sense of scale, not an invoice.

Why is the cost back at $0.00?

The field resets to $0 when /clear starts a new session. The row is reporting the session you are in, so a cleared session correctly starts again from nothing.

Is the timer wall-clock time or working time?

total_duration_ms is total wall-clock time the session has been running, it accumulates across resumes, and it does not count time while the session is not running. total_api_duration_ms in the same object counts only the time spent waiting for API responses, so the difference is everything else the session did, from running local tools to sitting idle.

Why does the clock look frozen?

The script runs on events, and those triggers can go quiet while the main session is idle, so the row keeps its last output. Set refreshInterval in the statusLine object to re-run it on a fixed timer as well.

Run the sessions behind those status lines, from one window

Install Omniscio, keep your Claude Code sessions in one list, and see what each one needs without hunting through terminals. The features page lists what is in it today.