aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/__claude-code-statusline
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-22 00:12:30 +0900
committernsfisis <nsfisis@gmail.com>2025-08-22 00:12:30 +0900
commitdfa6010a1ded259c473cde90496c294557f917f1 (patch)
treee238c6ef0985e292ad0f384d936984454e35e9dc /bin/__claude-code-statusline
parent250a29fa2c2149bb62c2aa2af63e2d1630b27ae4 (diff)
downloaddotfiles-dfa6010a1ded259c473cde90496c294557f917f1.tar.gz
dotfiles-dfa6010a1ded259c473cde90496c294557f917f1.tar.zst
dotfiles-dfa6010a1ded259c473cde90496c294557f917f1.zip
claude: show total cost in statusline
Diffstat (limited to 'bin/__claude-code-statusline')
-rwxr-xr-xbin/__claude-code-statusline5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/__claude-code-statusline b/bin/__claude-code-statusline
index 4e1efaa..aca81d8 100755
--- a/bin/__claude-code-statusline
+++ b/bin/__claude-code-statusline
@@ -6,6 +6,7 @@ input="$(cat)"
transcript_path="$(echo "$input" | jq -r '.transcript_path')"
cwd="$(echo "$input" | jq -r '.cwd')"
model="$(echo "$input" | jq -r '.model.display_name')"
+cost="$(echo "$input" | jq -r '.cost.total_cost_usd // 0 | . * 100 | floor / 100 | " ($\(.))"')"
if [[ -n "$transcript_path" && -f "$transcript_path" ]]; then
# Sum consumed token counts and format it like "12.3k".
@@ -13,8 +14,8 @@ if [[ -n "$transcript_path" && -f "$transcript_path" ]]; then
map(.message.usage // empty) |
last |
(.input_tokens // 0) + (.output_tokens // 0) + (.cache_creation_input_tokens // 0) + (.cache_read_input_tokens // 0) |
- [. * 10 / 1000, 1] | max | floor / 10 | " (\(.)k)"
+ [. * 10 / 1000, 1] | max | floor / 10 | " \(.)k"
' < "$transcript_path")"
fi
-echo "[$model]$consumed_tokens ${cwd/#$HOME/\~}"
+echo "[$model]$consumed_tokens$cost ${cwd/#$HOME/\~}"