[BUG] claude code "current_usage" is broken for statusline

Resolved 💬 6 comments Opened Jan 21, 2026 by saidelike Closed Feb 27, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When using the /context command or when using a statusline to show the context, it returns 0 tokens used instead of the actual tokens.

~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh",
    "padding": 0
  },
  "model": "haiku"
}

~/.claude/statusline.sh:

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

# uncomment to save data
#echo $input > ~/.claude/tmp.json

MODEL=$(echo "$input" | jq -r '.model.display_name')
CONTEXT_SIZE=$(echo "$input" | jq -r '.context_window.context_window_size')
USAGE=$(echo "$input" | jq '.context_window.current_usage')

if [ "$USAGE" != "null" ]; then
    # Calculate current context from current_usage fields
    CURRENT_TOKENS=$(echo "$USAGE" | jq '.input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens')
    PERCENT_USED=$((CURRENT_TOKENS * 100 / CONTEXT_SIZE))
    echo "[$MODEL] Context: ${CURRENT_TOKENS}/${CONTEXT_SIZE} (${PERCENT_USED}%)"
else
    echo "[$MODEL] Context: 0/${CONTEXT_SIZE} (0%)"
fi

The current_usage is broken in latest claude:

{"session_id":"...","transcript_path":"....jsonl","cwd":"/...","model":{"id":"claude-haiku-4-5-20251001","display_name":"Haiku 4.5"},"workspace":{"current_dir":"...","project_dir":"..."},"version":"2.1.14","output_style":{"name":"default"},"cost":{"total_cost_usd":0.019783,"total_duration_ms":5329,"total_api_duration_ms":8314,"total_lines_added":0,"total_lines_removed":0},"context_window":{"total_input_tokens":19203,"total_output_tokens":116,"context_window_size":200000,"current_usage":{"input_tokens":0,"output_tokens":0,"cache_creation_input_tokens":0,"cache_read_input_tokens":0},"used_percentage":0,"remaining_percentage":100},"exceeds_200k_tokens":false}

What Should Happen?

We see the current_usage used to work fine in 2.1.7:

{"session_id":"...","transcript_path":"/....jsonl","cwd":"/...","model":{"id":"claude-haiku-4-5-20251001","display_name":"Haiku 4.5"},"workspace":{"current_dir":"/...","project_dir":"/..."},"version":"2.1.7","output_style":{"name":"default"},"cost":{"total_cost_usd":0.02002,"total_duration_ms":5261,"total_api_duration_ms":4371,"total_lines_added":0,"total_lines_removed":0},"context_window":{"total_input_tokens":19465,"total_output_tokens":111,"context_window_size":200000,"current_usage":{"input_tokens":19363,"output_tokens":105,"cache_creation_input_tokens":0,"cache_read_input_tokens":0},"used_percentage":10,"remaining_percentage":90},"exceeds_200k_tokens":false}

Error Messages/Logs

Steps to Reproduce

start claude, run a prompt and check context. We see it says 0k/200k tokens (0%):

% claude
^[[I
 ▐▛███▜▌   Claude Code v2.1.14
▝▜█████▛▘  Sonnet 4.5 · API Usage Billing
  ▘▘ ▝▝    ~

  /model to try Opus 4.5

❯ /model 
  ⎿  Set model to haiku (claude-haiku-4-5-20251001)

❯ hi 

⏺ Hi! How can I help you today?

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯  
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  [Haiku 4.5] Context: 0/200000 (0%)

❯ /context 
  ⎿   Context Usage
     ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀   claude-haiku-4-5-20251001 · 0k/200k tokens (0%)
     ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ 
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   Estimated usage by category
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 2.9k tokens (1.5%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System tools: 16.3k tokens (8.1%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ MCP tools: 293 tokens (0.1%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 156 tokens (0.1%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝   ⛶ Free space: 135k (67.7%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝   ⛝ Autocompact buffer: 45.0k tokens (22.5%)
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ 

     MCP tools · /mcp
     └ mcp__ide__getDiagnostics: 111 tokens
     └ mcp__ide__executeCode: 182 tokens

With version 2.1.7, it was working properly:

% ./bin/claude-2.1.7
^[[I
 ▐▛███▜▌   Claude Code v2.1.7
▝▜█████▛▘  Haiku 4.5 · API Usage Billing
  ▘▘ ▝▝    ~

  /model to try Opus 4.5

❯ hi 

⏺ Hi! How can I help you today? Are you working on something specific, or would you like to explore what I can do?

❯ /context 
  ⎿   Context Usage
     ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀   claude-haiku-4-5-20251001 · 20k/200k tokens (10%)
     ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 2.9k tokens (1.4%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System tools: 16.8k tokens (8.4%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ MCP tools: 293 tokens (0.1%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 153 tokens (0.1%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛶ Free space: 135k (67.5%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛝ Autocompact buffer: 45.0k tokens (22.5%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝ 
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ 
     ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ 

     MCP tools · /mcp
     └ mcp__ide__getDiagnostics: 111 tokens
     └ mcp__ide__executeCode: 182 tokens


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯  
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  [Haiku 4.5] Context: 19357/200000 (9%)

It started to break from 2.1.8:

  % ./bin/claude-2.1.8 
^[[I
 ▐▛███▜▌   Claude Code v2.1.8
▝▜█████▛▘  Haiku 4.5 · API Usage Billing
  ▘▘ ▝▝    ~

  /model to try Opus 4.5

❯ hi 

⏺ Hi! What can I help you with today?

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯  
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  [Haiku 4.5] Context: 0/200000 (0%)   

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.7

Claude Code Version

2.1.14

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗