dist/codex/plugins/dev-tools/skills/analyzing-usage/SKILL.md
Analyze Codex CLI session usage, token cost, and efficiency using ccusage-codex. Use when user says "usage", "cost", "tokens", "how much did I spend", "codex usage", "session cost", "ccusage-codex". NOT for cloud billing or non-codex usage analysis.
npx skillsauth add alexei-led/claude-code-config analyzing-usageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze OpenAI Codex CLI session usage via ccusage-codex.
Binary: ccusage-codex — reads ~/.codex/sessions/**/*.jsonl (override: CODEX_HOME env var)
npx @ccusage/codex@latest <subcommand> [flags]
Use npx, not bunx — bunx 1.2.x resolves local codex binary instead of the npm package.
daily — token/cost by datemonthly — token/cost by monthsession — token/cost per session fileNo blocks, weekly, or statusline subcommands.
All subcommands share:
-j / --json — JSON output (required for jq piping)-s / --since YYYYMMDD — start date (also YYYY-MM-DD)-u / --until YYYYMMDD — end date-z / --timezone TZ — IANA timezone-O / --offline — use cached LiteLLM pricing (no network)--compact — compact table output--color / --no-color — color outputNo --breakdown, --jq, --order, --instances, --project, or --mode flags.
Codex JSON uses different field names from ccusage — do not port claude jq expressions directly:
costUSD (not totalCost)cacheCreationTokens; has cachedInputTokens (= cached reads)reasoningOutputTokens (informational; already included in outputTokens billing — do not double-count)models is [{model, isFallback}] array of objects, not modelsUsed: [] of strings{ "daily": [], "totals": null } — totals is null, guard with // {}# macOS
SINCE=$(date -v-14d +%Y%m%d)
UNTIL=$(date +%Y%m%d)
TODAY=$(date +%Y%m%d)
# Linux
SINCE=$(date -d '14 days ago' +%Y%m%d)
UNTIL=$(date +%Y%m%d)
ccusage-codex output. Never invent totals.costUSD in all jq expressions, never totalCost.totals is null: "No Codex usage data for this period."2>/dev/null to suppress npm resolver stderr.uvx termgraph for visualization when available; fall back to plain jq output.npx @ccusage/codex@latest daily -s $SINCE -u $UNTIL -j 2>/dev/null \
| jq -r '.daily[] | "\(.date[5:]),\(.costUSD | . * 100 | round / 100)"' \
| uvx termgraph --title "Daily Cost (USD)" --color cyan --width 60 --suffix " $"
npx @ccusage/codex@latest monthly -j 2>/dev/null \
| jq -r '.monthly[] | "\(.month),\(.costUSD | . * 100 | round / 100)"' \
| uvx termgraph --title "Monthly Cost (USD)" --color green --width 60 --suffix " $"
npx @ccusage/codex@latest session -s $TODAY -u $TODAY -j 2>/dev/null \
| jq -r '.sessions[] | "\(.directory | split("/") | last),\(.costUSD | . * 100 | round / 100)"' \
| sort -t, -k2 -rn | head -10
npx @ccusage/codex@latest daily -s $SINCE -u $UNTIL -j 2>/dev/null \
| jq -r '.daily[] | select(.inputTokens > 0) |
"\(.date[5:]),\(.cachedInputTokens / .inputTokens * 100 | . * 10 | round / 10)"' \
| uvx termgraph --title "Cache Hit Rate %" --color blue --width 60 --suffix "%"
npx @ccusage/codex@latest daily -s $SINCE -u $UNTIL -j 2>/dev/null \
| jq -r '[.daily[].models[]] | group_by(.model)
| map({model: .[0].model, count: length})
| sort_by(-.count)[] | "\(.model),\(.count)"'
npx @ccusage/codex@latest daily -s $SINCE -u $UNTIL -j 2>/dev/null \
| jq -r '.daily[] | "\(.date[5:]),\(.totalTokens / 1000000 | . * 100 | round / 100)"' \
| uvx termgraph --title "Daily Tokens (M)" --color yellow --width 60 --suffix " M"
--today: session breakdown + model distributionmonthly: monthly cost charttools
Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`, `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, TypeScript, Go, web code, or infrastructure operations.
tools
Use when planning, executing, checkpointing, finishing, or inspecting lightweight spec-driven work. Runs one task at a time using `.spec/` markdown files and the bundled `specctl` helper. NOT for broad product discovery beyond a short requirement interview.
testing
Author, inspect, troubleshoot, and review infrastructure across IaC, Kubernetes, cloud resources, containers, CI/CD, and Linux hosts. Use when changing Terraform/OpenTofu, Kubernetes, Helm, Kustomize, Dockerfiles, GitHub Actions, AWS, GCP, Cloud Run, BigQuery, IAM, logs, instances, or service health. NOT for deploy/apply/rollback workflows (see deploying-infra). NOT for shell scripts or generic command pipelines (see writing-shell).
development
Configure safe git workflow hygiene: pre-commit/pre-push hooks, Gitleaks secret scanning, .gitignore rules, local git config, and guardrails. Use when setting up git hooks, gitleaks/git leaks, staged pre-commit checks, pre-push validation, core.hooksPath, .gitignore, or git config best practices. NOT for creating commits (use committing-code), cleaning branches/worktrees (use cleanup-git), or creating worktrees (use using-git-worktrees).