I wanted one number for “what have I burned on models this week” without opening a dashboard. What I ended up with is a five line shell script that two separate sources answer from:
#!/bin/bash
LLM_COST_RAW=$(tokscale --week --json | jq .totalCost)
LLM_COST=$(printf "%.2f" "$LLM_COST_RAW")
GH_USAGE=$(curl --silent http://localhost:4141/usage | jq .quota_snapshots.premium_interactions.quota_remaining)
echo "$ $LLM_COST GH $GH_USAGE"
Output looks like $ 2.26 GH 412. Two things in there are worth explaining, because neither is obvious.
tokscale is a CLI that reads the local session logs of coding agents (Claude Code, Codex, OpenCode, Hermes, and friends), maps token counts onto current model prices, and reports the total. --week scopes it to the rolling seven day window and --json makes it machine readable, so jq .totalCost gives me the dollar figure and printf "%.2f" rounds it before it hits the terminal.