Skip to content
EN

Token usage

agent-presence usage reports token consumption per source, in the spirit of ccusage: it does not hook the agents, it scans their local transcripts after the fact.

agent-presence usage # today + last 7 days
agent-presence usage --days 7 # a single window
agent-presence usage --json # structured output

Windows are calendar-day aligned (since local midnight, inclusive of today). 今日 counts from 00:00 and resets at midnight — it never shrinks mid-day the way a rolling 24h window would.

Usage is a capability of the same source table that drives presence: a source that implements scanUsage is billable. All five built-ins are, and a third-party source plugin can be too.

SourceToken tracking
Claude Codeyes — priced from the table, deduped, <synthetic> excluded
Codexyes — diffs the cumulative session total
Piyes — uses the cost Pi records
opencodeyes — reads the local SQLite store; uses the cost opencode records
Gemini CLIyes — reads the local chat transcripts; priced from the table

Cost shows n/a for models with no pricing entry; token counts are always exact. Pi and opencode log a real cost, so those are used as-is. Other sources are priced from the bundled LiteLLM snapshot for supported models (for example gpt-5.5, claude-fable-5, deepseek-v4-pro, and gemini-3-flash-preview), with a small fallback table for older aliases. Override pricing per model in ~/.agent-presence/config.json when your deployment uses a private or unlisted model.

Compose your own label with template variables:

agent-presence config render --many "{total} 个 AI 牛马 | {details} | 今日 {usage_1d}"

{usage_1d} is today; {usage_7d} (or any {usage_Nd}) is N calendar days.