Cost Thresholds

Directory, Node version when a package.json is around, added and removed lines with a net-direction arrow, a token bar, and a session cost that changes color as it grows.

Before you install

  • This version was reviewed before it was listed on Jul 6, 2026
  • Doesn't ask to connect to the internet
  • Calls jq and bc, plus node -v when the folder has a package.json
  • The bar counts session totals (total_input_tokens plus output), not used_percentage, and hides at 0
  • Its segment separator is empty, so segments are split by spaces only
Not showing after you paste? Fix it

Preview

Clean repo
app ⏱ 10m ▲ +128 -34 ▓░░░░░░░ 22% $0.41 ◆ Opus
New session
app ⏱ 10m $0.00 ◆ Opus
Dirty branch
app ⏱ 10m ▲ +128 -34 ▓▓▓░░░░░ 48% $0.41 ◇ Sonnet
Near-full
app ⏱ 10m ▲ +128 -34 ▓▓▓▓▓▓▓░ 91% $4.12 ◆ Opus
1M context
app ⏱ 10m ▲ +128 -34 ▓▓▓▓▓░░░ 64% $0.41 ● Fable 5
Post-compact
app ⏱ 10m ▲ +128 -34 $0.41 ○ Haiku
Worktree
feature ⏱ 10m ▲ +128 -34 ▓▓░░░░░░ 37% $0.41 ◆ Opus
Non-git
scratch ⏱ 10m ▲ +128 -34 ▓░░░░░░░ 22% $0.41 ◆ Opus

In Claude Desktop

Cost Thresholds in Claude Desktop

Recorded with statusline-anywhere.

What it does

One line with the folder, session time, lines added and removed, an 8-cell token bar, session cost and model. The cost turns yellow at $2 and red at $10.

Written in
Bash
Network access
None requested
Works in
Terminal

How it works

  1. Reads folder, model, token totals, cost, duration and line counts from stdin with jq
  2. Divides input plus output tokens by the window size; yellow from 50%, red from 75%
  3. A green ▲ means more lines added than removed, a red ▼ the reverse
  4. Opus, Sonnet and Haiku get their own symbol and color, while Fable 5 shows in gray

Source

#!/bin/bash
export TERM=xterm-256color
input=$(cat)
cwd=$(echo "$input" | jq -r '.workspace.current_dir')
model=$(echo "$input" | jq -r '.model.display_name // empty')

# Token usage
input_tokens=$(echo "$input" | jq -r '.context_window.total_input_tokens // 0')
output_tokens=$(echo "$input" | jq -r '.context_window.total_output_tokens // 0')
context_limit=$(echo "$input" | jq -r '.context_window.context_window_size // 0')
total_tokens=$((input_tokens + output_tokens))

# Cost & stats
cost=$(echo "$input" | jq -r '.cost.total_cost_usd // empty')
duration_ms=$(echo "$input" | jq -r '.cost.total_duration_ms // 0')
lines_added=$(echo "$input" | jq -r '.cost.total_lines_added // 0')
lines_removed=$(echo "$input" | jq -r '.cost.total_lines_removed // 0')

# Colors - basic ANSI codes compatible with most terminals
RED=$'\033[31m'
GREEN=$'\033[32m'
YELLOW=$'\033[33m'
BLUE=$'\033[34m'
MAGENTA=$'\033[35m'
CYAN=$'\033[36m'
GRAY=$'\033[90m'
RESET=$'\033[0m'

SEP="${GRAY}${RESET}"
short_dir=$(basename "$cwd")

# Node version (only if package.json exists)
node_info=""
if [ -f "$cwd/package.json" ] 2>/dev/null; then
  node_ver=$(node -v 2>/dev/null | sed 's/v//')
  [ -n "$node_ver" ] && node_info=" ${SEP} ${GREEN}⬢ ${node_ver}${RESET}"
fi

# Session duration
duration_info=""
if [ "$duration_ms" -gt 0 ] 2>/dev/null; then
  duration_sec=$((duration_ms / 1000))
  if [ "$duration_sec" -ge 3600 ]; then
    hours=$((duration_sec / 3600))
    mins=$(((duration_sec % 3600) / 60))
    duration_fmt="${hours}h${mins}m"
  elif [ "$duration_sec" -ge 60 ]; then
    mins=$((duration_sec / 60))
    duration_fmt="${mins}m"
  else
    duration_fmt="${duration_sec}s"
  fi
  duration_info=" ${SEP} ${CYAN}⏱ ${duration_fmt}${RESET}"
fi

# Lines changed
lines_info=""
if [ "$lines_added" -gt 0 ] || [ "$lines_removed" -gt 0 ] 2>/dev/null; then
  net=$((lines_added - lines_removed))
  if [ "$net" -gt 0 ]; then
    net_symbol="${GREEN}▲${RESET}"
  elif [ "$net" -lt 0 ]; then
    net_symbol="${RED}▼${RESET}"
  else
    net_symbol="${GRAY}=${RESET}"
  fi
  lines_info=" ${SEP} ${net_symbol} ${GREEN}+${lines_added}${RESET} ${RED}-${lines_removed}${RESET}"
fi

# Token usage with progress bar
token_info=""
if [ "$total_tokens" -gt 0 ] 2>/dev/null; then
  if [ "$total_tokens" -ge 1000 ]; then
    tokens_fmt="$((total_tokens / 1000))k"
  else
    tokens_fmt="$total_tokens"
  fi

  if [ "$context_limit" -gt 0 ] 2>/dev/null; then
    pct=$((total_tokens * 100 / context_limit))

    # Color based on usage
    if [ "$pct" -ge 75 ]; then
      bar_color="$RED"
    elif [ "$pct" -ge 50 ]; then
      bar_color="$YELLOW"
    else
      bar_color="$GREEN"
    fi

    # Build progress bar using simple chars: ▓ filled, ░ empty
    bar_width=8
    filled=$((pct * bar_width / 100))
    [ "$filled" -gt "$bar_width" ] && filled=$bar_width
    [ "$filled" -lt 1 ] && [ "$pct" -gt 0 ] && filled=1
    empty=$((bar_width - filled))

    bar="${bar_color}"
    for ((i=0; i<filled; i++)); do bar+="▓"; done
    bar+="${GRAY}"
    for ((i=0; i<empty; i++)); do bar+="░"; done
    bar+="${RESET}"

    token_info=" ${SEP} ${bar} ${GRAY}${pct}%${RESET}"
  fi
fi

# Cost with meaningful colors
cost_info=""
if [ -n "$cost" ] && [ "$cost" != "null" ]; then
  cost_fmt=$(printf "%.2f" "$cost")
  cost_cents=$(printf "%.0f" "$(echo "$cost * 100" | bc)")

  if [ "$cost_cents" -ge 1000 ] 2>/dev/null; then
    cost_color="$RED"
  elif [ "$cost_cents" -ge 200 ] 2>/dev/null; then
    cost_color="$YELLOW"
  else
    cost_color="$GREEN"
  fi
  cost_info=" ${SEP} ${cost_color}\$${cost_fmt}${RESET}"
fi

# Model with tier colors
model_info=""
if [ -n "$model" ]; then
  case "$model" in
    *Opus*) model_color="$MAGENTA"; model_symbol="◆"; short_model="Opus" ;;
    *Sonnet*) model_color="$BLUE"; model_symbol="◇"; short_model="Sonnet" ;;
    *Haiku*) model_color="$GREEN"; model_symbol="○"; short_model="Haiku" ;;
    *) model_color="$GRAY"; model_symbol="●"; short_model="$model" ;;
  esac
  model_info=" ${SEP} ${model_color}${model_symbol} ${short_model}${RESET}"
fi

printf "${BLUE}${short_dir}${RESET}%s%s%s%s%s%s" "$node_info" "$duration_info" "$lines_info" "$token_info" "$cost_info" "$model_info"

Badge for your README

Own this listing? Add it to your README. The badge shows the install count as it grows.

Reviewed on statuslin.es
[![Reviewed on statuslin.es](https://statuslin.es/badge/c/cost-thresholds-c8eb535b.svg)](https://statuslin.es/c/cost-thresholds-c8eb535b?utm_source=readme-badge)

Or show the preview card:

Preview on statuslin.es
[![Preview on statuslin.es](https://statuslin.es/og/c/cost-thresholds-c8eb535b.png)](https://statuslin.es/c/cost-thresholds-c8eb535b?utm_source=readme-badge)

More status lines

  • 115 installs
Opus 4.8 [high] ~/app main 16:20:55 | ⛁ ██░░░░░░░░ 22% | 5h ●◔○○○ 26% ↻2h7m | 7d ◔○○○○○○ 7% ↻2d1h │ $0.41 ⏱ 10m
Opus 4.8 │ main │ app │ ▓▓░░░░░░░░ 44k/200k │ $0.41
  • 57 installs
Opus 4.8 high ✦ │ ctx 22% │ app (main) │ PR #1287 ● │ $0.41 · 10m +128 -34 Session ● ● ● ● ● ● ● ● ○ ○ ○ 74% left Resets in 2h 6m Weekly ● ● ● ● ● ● ● ● ● ● ○ 93% left Resets in 2d 0h Fable ● ● ● ● ● ● ● ● ● ○ ○ 85% left Resets in 2d 0h ◐ Read:index.ts ✓ Read×1 ✓ Bash×1 ✓ Edit×1 ✓ Grep×1 ◐ code-reviewer Review the change for regressions
Model: Opus 4.8 | Thinking: high | Context: [▰▰▱▱▱▱▱▱▱▱] 45k/200k (22%) | cwd: ~/app | ⎇ main | (+0,-0) Cost: $0.41 | Block: 2hr 6m | Weekly: 7.0% | Session: 10m | In: 916.7 t/s | Out: 29.2 t/s | Cached: 2k | Session: [▰▱▱▱▱] 26.0% Mem: 0.8G/1.0G | (*゚∀゚*) | Session ID: b8e1c0d2-4a6f-4e2a-9c1b-3f5d7a9e2c10
  • 15 installs
🌿 main │ Opus 4.8/hi │ 🟢 Ctx ▓▓░░░░ 22% │ ⏳ 🟢 ▓▓░░░░ 26% ↻ 2h7m │ $0.41 ⏱ 10m
app · main · Opus 4.8 · high ctx 22% 44k · 5h 26% ↻2h6m · 7d 7% ↻2d0h · cost $0.41 · msg $0.757

Related mods

Token Weather Usage in Claude Desktop

One line above the prompt: context tokens with their weather, a bar per recent prompt, your 5-hour and 7-day limits against the time elapsed, the prompt cache with its time left, the session cost with the last prompt's share in dollars and in points of the 5-hour limit, the subagents running, and a one-click pill for the GOs Claude proposes. Labels in English, French or Russian. After Token Weather (Anthropic, Apache-2.0) and the ideas of usage-meter (HolyGrail) and prompt-cache-control (Daniel San).

Deck in Claude Desktop

A cockpit for Claude Code: plan bars and subagent strips, context, usage limits with reset countdowns and burn rates, spend, the model route and a pet. Six bar styles, three collapsed looks. CLI and Desktop.

Flightdeck in Claude Desktop

Flightdeck: a live agent dashboard for Claude Code. Main model vitals, an on-call architect, every permission check, subagent cards and swimlanes, a turn receipt and a session log, all from real session events

⎿ cache-tax: keepwarm on for 6h00m, a ping 50m after each idle stretch keeps the cache read, not re-written ⎿ cache-tax: claude-opus-5-5 state warm, 1h00m left context 44,000 tokens cold cost $0.35 to re-write it (warm turn $0.01) keepwarm on, 6h00m left · ping in 50m break-even up to 40 pings at the read rate cost one cold write, about 33h20m of idle at one ping per 50m guard ask first (/cache-tax guard warn to only show the price) session 0 cold writes paid, $0.00 [>] cache-tax · warm · keepwarm 6h00m left · ping in 50m [-]

A Claude Code mod that keeps the one-hour prompt cache warm during breaks and asks before a cold send, showing its estimated rewrite cost. Warming uses model requests and costs tokens. Requires Claude Code 2.1.287+.