Skip to main content
statuslinesSource-backed

Claude Code Analytics Burn Statusline

Claude Code statusline that reads Anthropic Claude Code Analytics Admin API data and shows daily estimated cost, hourly pace, sessions, and budget pressure.

by MkDev11·added 2026-06-04·
Language:bash
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://platform.claude.com/docs/en/manage-claude/claude-code-analytics-api, https://github.com/JSONbored/awesome-claude/blob/main/content/statuslines/claude-code-analytics-burn-statusline.mdx
Safety notes
Claude Code Analytics data is daily aggregated and can lag recent activity, so the burn-rate display is a pacing signal rather than real-time billing control., Keep the refresh interval moderate because the statusline calls an authenticated Admin API endpoint., Treat budget thresholds as operational prompts; reconcile invoices and Console reports before making spending decisions.
Privacy notes
The script sends an Admin API request to Anthropic and receives organization-level Claude Code analytics., It prints aggregate cost, session, and budget numbers, not email addresses, model names, prompts, file paths, or code., Admin API keys can expose organization analytics; store them in a scoped local secret manager or shell environment with restricted access., The script feeds the API key to curl through a config file descriptor instead of command-line arguments and unsets the exported key before launching curl, reducing process-list exposure on shared machines.
Author
MkDev11
Submitted by
MkDev11
Claim status
unclaimed
Last verified
2026-06-04

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Config edit

Copy-ready — paste the snippet to get started.

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Prerequisite readiness

Prerequisite readiness

4 prerequisites to line up before setup. Have accounts and credentials ready first.

0/4 ready
Account & credentials1General3

Safety & privacy surface

Safety & privacy surface

3 safety and 4 privacy notes across 4 risk areas. Review closely: credentials & tokens, permissions & scopes.

4 areas
  • SafetyTelemetryClaude Code Analytics data is daily aggregated and can lag recent activity, so the burn-rate display is a pacing signal rather than real-time billing control.
  • SafetyPermissions & scopesKeep the refresh interval moderate because the statusline calls an authenticated Admin API endpoint.
  • SafetyGeneralTreat budget thresholds as operational prompts; reconcile invoices and Console reports before making spending decisions.
  • PrivacyPermissions & scopesThe script sends an Admin API request to Anthropic and receives organization-level Claude Code analytics.
  • PrivacyCredentials & tokensIt prints aggregate cost, session, and budget numbers, not email addresses, model names, prompts, file paths, or code.
  • PrivacyCredentials & tokensAdmin API keys can expose organization analytics; store them in a scoped local secret manager or shell environment with restricted access.
  • PrivacyCredentials & tokensThe script feeds the API key to curl through a config file descriptor instead of command-line arguments and unsets the exported key before launching curl, reducing process-list exposure on shared machines.

Safety notes

  • Claude Code Analytics data is daily aggregated and can lag recent activity, so the burn-rate display is a pacing signal rather than real-time billing control.
  • Keep the refresh interval moderate because the statusline calls an authenticated Admin API endpoint.
  • Treat budget thresholds as operational prompts; reconcile invoices and Console reports before making spending decisions.

Privacy notes

  • The script sends an Admin API request to Anthropic and receives organization-level Claude Code analytics.
  • It prints aggregate cost, session, and budget numbers, not email addresses, model names, prompts, file paths, or code.
  • Admin API keys can expose organization analytics; store them in a scoped local secret manager or shell environment with restricted access.
  • The script feeds the API key to curl through a config file descriptor instead of command-line arguments and unsets the exported key before launching curl, reducing process-list exposure on shared machines.

Prerequisites

  • Anthropic Admin API access for an organization with Claude Code Analytics enabled.
  • ANTHROPIC_ADMIN_API_KEY set in the statusline environment; prefer a narrowly scoped/read-only credential if Anthropic offers one for analytics access.
  • curl and jq available on the machine running the Claude Code statusline command.
  • Optional CLAUDE_CODE_ANALYTICS_EMAIL to limit the display to one user and CLAUDE_CODE_DAILY_BUDGET_USD to set the budget denominator.

Schema details

Install type
config
Troubleshooting
No
Runtime and command metadata
Script language
bash
Script body
#!/usr/bin/env bash
set -u

main() {
if [ -z "${ANTHROPIC_ADMIN_API_KEY:-}" ]; then
  echo "cc analytics: admin key missing"
  exit 0
fi
if ! command -v curl >/dev/null 2>&1; then
  echo "cc analytics: curl missing"
  exit 0
fi
if ! command -v jq >/dev/null 2>&1; then
  echo "cc analytics: jq missing"
  exit 0
fi

day="${CLAUDE_CODE_ANALYTICS_DAY:-$(date -u +%F)}"
limit="${CLAUDE_CODE_ANALYTICS_LIMIT:-1000}"
email="${CLAUDE_CODE_ANALYTICS_EMAIL:-}"
budget="${CLAUDE_CODE_DAILY_BUDGET_USD:-50}"
url="https://api.anthropic.com/v1/organizations/usage_report/claude_code?starting_at=${day}&limit=${limit}"

api_key="$ANTHROPIC_ADMIN_API_KEY"
unset ANTHROPIC_ADMIN_API_KEY
json=$(ANTHROPIC_ADMIN_API_KEY= curl -fsS \
  --config <(printf '%s\n' \
    'header = "anthropic-version: 2023-06-01"' \
    "header = \"x-api-key: ${api_key}\"" \
    'header = "User-Agent: heyclaude-statusline/1.0"') \
  "$url" 2>/dev/null || true)
unset api_key

if [ -z "$json" ]; then
  echo "cc analytics: unavailable"
  exit 0
fi

if [ -n "$email" ]; then
  cents=$(printf '%s' "$json" | jq --arg email "$email" '[.data[]? | select(.actor.email_address == $email) | .model_breakdown[]?.estimated_cost.amount // 0] | add // 0' 2>/dev/null || echo 0)
  sessions=$(printf '%s' "$json" | jq --arg email "$email" '[.data[]? | select(.actor.email_address == $email) | .core_metrics.num_sessions // 0] | add // 0' 2>/dev/null || echo 0)
  scope="user"
else
  cents=$(printf '%s' "$json" | jq '[.data[]? | .model_breakdown[]?.estimated_cost.amount // 0] | add // 0' 2>/dev/null || echo 0)
  sessions=$(printf '%s' "$json" | jq '[.data[]? | .core_metrics.num_sessions // 0] | add // 0' 2>/dev/null || echo 0)
  scope="org"
fi

cost=$(awk -v cents="$cents" 'BEGIN { printf "%.2f", cents / 100 }')
hour=$(date -u +%H)
minute=$(date -u +%M)
elapsed_minutes=$((10#$hour * 60 + 10#$minute + 1))
burn=$(awk -v cost="$cost" -v minutes="$elapsed_minutes" 'BEGIN { printf "%.2f", cost * 60 / minutes }')
pct=$(awk -v cost="$cost" -v budget="$budget" 'BEGIN { if (budget > 0) printf "%.0f", cost * 100 / budget; else print 0 }')

if [ "$pct" -ge 90 ]; then
  state="limit"
elif [ "$pct" -ge 70 ]; then
  state="watch"
else
  state="ok"
fi

printf 'cc analytics: %s | $%s today | burn $%s/h | sessions %s | budget %s%% | %s\n' "$scope" "$cost" "$burn" "$sessions" "$pct" "$state"
}

case $- in
  *n*) ;;
  *) main "$@" ;;
esac
Full copyable content
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/claude-code-analytics-burn-statusline.sh"
  }
}

About this resource

Source notes

  • Anthropic documents the Claude Code Analytics Admin API for daily aggregated Claude Code usage, productivity metrics, token data, and estimated cost by model.
  • The API is explicitly daily aggregated rather than real time, so this statusline reports budget pace from the latest available daily analytics instead of claiming live billing precision.

Duplicate check

Checked existing statuslines, live HeyClaude statuslines, open pull requests, and repository content for claude-code-analytics-burn-statusline, Claude Code Analytics, Claude cost, burn rate, real-time-cost-tracker, and burn-rate-monitor. Existing cost entries use local statusline JSON estimates; this entry uses Anthropic's Claude Code Analytics Admin API with an organization/user reporting scope and a different canonical source.

Disclosure

Editorial statusline recipe. No paid placement or affiliate link is used.

Source citations

Add this badge to your README

Show that Claude Code Analytics Burn Statusline is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/statuslines/claude-code-analytics-burn-statusline.svg)](https://heyclau.de/entry/statuslines/claude-code-analytics-burn-statusline)

How it compares

Claude Code Analytics Burn Statusline side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

1 trust signal differ across this comparison (Submitter).

Field

Claude Code statusline that reads Anthropic Claude Code Analytics Admin API data and shows daily estimated cost, hourly pace, sessions, and budget pressure.

Open dossier

A Claude Code statusline that reads prompt-cache token metrics from session JSON and renders a color-coded hit-rate bar with an estimated token-savings readout.

Open dossier

Real-time burn rate monitor showing cost per minute, tokens per minute, and projected daily spend to prevent budget overruns during Claude Code sessions.

Open dossier

Real-time AI cost tracking statusline with per-session spend analytics, model pricing, and budget alerts

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
SubmitterDiffersMkDev11
Install riskReview firstReview firstReview firstReview first
Notes Safety ✓ Privacy ✓ Safety ✓ Privacy ✓ Safety ✓ Privacy ✓ Safety ✓ Privacy ✓
Brand
Categorystatuslinesstatuslinesstatuslinesstatuslines
SourceSource-backedSource-backedSource-backedSource-backed
AuthorMkDev11JSONboredJSONboredJSONbored
Added2026-06-042025-10-252025-10-252025-10-16
Platforms
Harness
Source repo
Safety notesClaude Code Analytics data is daily aggregated and can lag recent activity, so the burn-rate display is a pacing signal rather than real-time billing control. Keep the refresh interval moderate because the statusline calls an authenticated Admin API endpoint. Treat budget thresholds as operational prompts; reconcile invoices and Console reports before making spending decisions.Runs a bash script on every status-line refresh (about every 2 seconds) that pipes session JSON through jq and bc; it is read-only and makes no network calls or file writes, but status-line commands execute with your shell's permissions, so review the script before adding it to settings.json.Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.
Privacy notesThe script sends an Admin API request to Anthropic and receives organization-level Claude Code analytics. It prints aggregate cost, session, and budget numbers, not email addresses, model names, prompts, file paths, or code. Admin API keys can expose organization analytics; store them in a scoped local secret manager or shell environment with restricted access. The script feeds the API key to curl through a config file descriptor instead of command-line arguments and unsets the exported key before launching curl, reducing process-list exposure on shared machines.Reads Claude Code session cost and token metrics from the status-line JSON on stdin and prints them to your terminal; no data leaves the machine, but the displayed figures may be visible to anyone viewing your screen or a terminal recording.Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.Reads the Claude Code statusline JSON from stdin (model, token usage, and cost) and renders it in the local terminal; it does not send data off-machine.
Prerequisites
  • Anthropic Admin API access for an organization with Claude Code Analytics enabled.
  • ANTHROPIC_ADMIN_API_KEY set in the statusline environment; prefer a narrowly scoped/read-only credential if Anthropic offers one for analytics access.
  • curl and jq available on the machine running the Claude Code statusline command.
  • Optional CLAUDE_CODE_ANALYTICS_EMAIL to limit the display to one user and CLAUDE_CODE_DAILY_BUDGET_USD to set the budget denominator.
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for arithmetic operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • bc calculator (bc 1.07+ optional for precise savings calculations, script falls back to integer math)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for arithmetic operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • bc calculator (bc 1.07+ required for floating point calculations - script will fail without bc)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for pattern matching, arithmetic operations, and string manipulation)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • awk command (for floating point cost calculation with printf - preferred method)
Install
Config
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/claude-code-analytics-burn-statusline.sh"
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/cache-efficiency-monitor.sh",
    "refreshInterval": 2000
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/burn-rate-monitor.sh",
    "refreshInterval": 500
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/real-time-cost-tracker.sh",
    "refreshInterval": 1000
  }
}
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.