Feature Request: Add Token Usage To Status Line Input

Status Closed — not planned
Maintainer reply None cached
Activity 8 comments · opened Aug 20, 2025 · closed Jan 5, 2026

Add input output token usage to the status line input.

View original on GitHub ↗

8 Comments

github-actions[bot] · 1 year ago

---

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5959
  2. https://github.com/anthropics/claude-code/issues/6163
  3. https://github.com/anthropics/claude-code/issues/5929

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

---

coygeek · 1 year ago

Hey, this is a great feature request! I was curious about this myself and did a bit of digging into the documentation to see if it was possible.

From what I can tell, you're right that this isn't currently supported, but it's a fantastic idea for improving visibility on token consumption.

Here’s what I found:

  1. Status Line Data: The custom status line feature is really cool. According to the Status Line Configuration docs, the script you provide gets a JSON object via stdin with session info, the current model, CWD, etc. Unfortunately, it doesn't look like token usage or cost from the last turn is included in that JSON payload.
  1. Existing Cost Tracking: The closest thing right now is the /cost command, which gives you a summary for the entire session. It's useful, but not the real-time, per-turn feedback you're looking for.

So, it seems like the core of your feature request is for the claude app to add token/cost data to the JSON object it sends to the status line script.

A Possible (but complex) Workaround

Thinking about a hacky way to get something close to this, you might be able to chain together a couple of features. This is definitely not ideal, but could be a fun experiment:

You could potentially use the Hooks feature. The Stop hook, as described in the Hooks Reference, runs when Claude finishes responding and is given the path to the session transcript file (transcript_path).

You could create a script for the Stop hook that:

  1. Reads the session transcript JSONL file.
  2. Parses the last few lines to find the final result message, which often contains cost info (like in the SDK output).
  3. Writes that cost/token info to a temporary file (e.g., ~/.claude/last_cost.txt).

Then, your separate /statusline script could simply cat ~/.claude/last_cost.txt as part of its output.

It's a bit convoluted and might have some lag, but it's the only way I can think of to get that data from one part of the app to the other without official support.

Anyway, I'm giving this issue a thumbs up. Hopefully, the devs see this and consider adding it natively. It would be a huge quality-of-life improvement

MaheshNat · 1 year ago

I'm doing something similar to your suggestion for the time being without the whole hook + temp file, just having the status line itself read and parse the contents of the transcript_path from stdin given to statusline

artnikbrothers · 1 year ago
Hey, this is a great feature request! I was curious about this myself and did a bit of digging into the documentation to see if it was possible. From what I can tell, you're right that this isn't currently supported, but it's a fantastic idea for improving visibility on token consumption. Here’s what I found: 1. Status Line Data: The custom status line feature is really cool. According to the Status Line Configuration docs, the script you provide gets a JSON object via stdin with session info, the current model, CWD, etc. Unfortunately, it doesn't look like token usage or cost from the last turn is included in that JSON payload. 2. Existing Cost Tracking: The closest thing right now is the /cost command, which gives you a summary for the entire session. It's useful, but not the real-time, per-turn feedback you're looking for. So, it seems like the core of your feature request is for the claude app to add token/cost data to the JSON object it sends to the status line script. #### A Possible (but complex) Workaround Thinking about a hacky way to get something close to this, you might be able to chain together a couple of features. This is definitely not ideal, but could be a fun experiment: You could potentially use the Hooks feature. The Stop hook, as described in the Hooks Reference, runs when Claude finishes responding and is given the path to the session transcript file (transcript_path). You could create a script for the Stop hook that: 1. Reads the session transcript JSONL file. 2. Parses the last few lines to find the final result message, which often contains cost info (like in the SDK output). 3. Writes that cost/token info to a temporary file (e.g., ~/.claude/last_cost.txt). Then, your separate /statusline script could simply cat ~/.claude/last_cost.txt as part of its output. It's a bit convoluted and might have some lag, but it's the only way I can think of to get that data from one part of the app to the other without official support. Anyway, I'm giving this issue a thumbs up. Hopefully, the devs see this and consider adding it natively. It would be a huge quality-of-life improvement

This already existed in version 1.0.81 - token counter and time. It was just removed in version 1.0.82. See this thread https://github.com/anthropics/claude-code/issues/5929

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

drod3763 · 8 months ago

I dont think this works yet.

github-actions[bot] · 7 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.