Skip to content

Instantly share code, notes, and snippets.

@rivol
rivol / statusline-command.py
Created January 26, 2026 09:57
Claude Code statusline-command.py
#!/usr/bin/env python3
import json
import sys
def format_tokens(tokens: int) -> str:
"""Format token counts (e.g., 106500 -> 107k)."""
if tokens >= 1000:
return f"{round(tokens / 1000)}k"
return str(tokens)