Loading...
Loading...
Query AI coding agent usage, costs, and token consumption. Supports Claude Code, Codex CLI, OpenClaw, and OpenCode. Ask about spending, token usage, model costs, session history, API call counts. Actions: check usage, show cost, compare models, list sessions, analyze spending, token breakdown. Time ranges: today, this week, this month, this year, last N days, custom dates.
npx skill4agent add hongshuo-wang/agent-usage-desktop agent-usage-desktopbash SKILL_DIR/scripts/detect.shAPILOCALSKILL_DIRquery-api.shbash SKILL_DIR/scripts/query-api.sh <command> [options]| Command | Description | Key Options |
|---|---|---|
| Summary: total cost, tokens, sessions, prompts, API calls | |
| Cost breakdown per model | |
| Cost trend over time | |
| Token usage trend | |
| List all sessions with cost/tokens | |
| Per-model breakdown for one session | |
--from YYYY-MM-DD--to YYYY-MM-DD--source claude|codex|openclaw|opencode--granularity 1m|30m|1h|6h|12h|1d|1w|1M--session-id IDusage.pypython3 SKILL_DIR/scripts/usage.py <command> [options]| Command | Description |
|---|---|
| Summary totals |
| Cost per model |
| Session list |
| Top N models by cost |
--from--to--source-n N$X.XXX.XKX.XM| User says | --from | --to |
|---|---|---|
| today | today's date | today's date |
| yesterday | yesterday | yesterday |
| this week | Monday of this week | today |
| this month | 1st of this month | today |
| this year | Jan 1 of this year | today |
| last 7 days | 7 days ago | today |
| last 30 days | 30 days ago | today |
| last N days | N days ago | today |
| User says | --source value |
|---|---|
| claude / claude code | claude |
| codex / openai codex | codex |
| openclaw | openclaw |
| opencode | opencode |
| all / everything / total | (omit --source) |
bash scripts/query-api.sh stats --from 2026-04-01 --to 2026-04-07bash scripts/query-api.sh cost-by-model --from 2026-01-01 --to 2026-04-07bash scripts/query-api.sh sessions --from 2026-04-07 --to 2026-04-07 --source claudebash scripts/query-api.sh tokens-over-time --from 2026-04-01 --to 2026-04-07 --granularity 1h~/.claude/projects~/.codex/sessions~/.openclaw/agents~/.local/share/opencode/opencode.db