2026-01-07 11:42:41 +01:00
---
summary: "Usage tracking surfaces and credential requirements"
read_when:
- You are wiring provider usage/quota surfaces
- You need to explain usage tracking behavior or auth requirements
2026-01-31 16:04:03 -05:00
title: "Usage Tracking"
2026-01-07 11:42:41 +01:00
---
2026-01-31 21:13:13 +09:00
2026-01-07 11:42:41 +01:00
# Usage tracking
## What it is
2026-01-31 21:13:13 +09:00
2026-01-07 11:42:41 +01:00
- Pulls provider usage/quota directly from their usage endpoints.
- No estimated costs; only the provider-reported windows.
2026-04-04 11:25:39 +01:00
- Human-readable status output is normalized to `X% left` , even when an
upstream API reports consumed quota, remaining quota, or only raw counts.
2026-04-04 12:42:42 +01:00
- Session-level `/status` and `session_status` can fall back to the latest
transcript usage entry when the live session snapshot is sparse. That
fallback fills missing token/cache counters, can recover the active runtime
model label, and prefers the larger prompt-oriented total when session
metadata is missing or smaller. Existing nonzero live values still win.
2026-01-07 11:42:41 +01:00
## Where it shows up
2026-01-31 21:13:13 +09:00
2026-04-04 11:25:39 +01:00
- `/status` in chats: emoji‑ rich status card with session tokens + estimated cost (API key only). Provider usage shows for the **current model provider ** when available as a normalized `X% left` window.
2026-01-18 05:35:22 +00:00
- `/usage off|tokens|full` in chats: per-response usage footer (OAuth shows tokens only).
2026-01-30 03:15:10 +01:00
- `/usage cost` in chats: local cost summary aggregated from OpenClaw session logs.
- CLI: `openclaw status --usage` prints a full per-provider breakdown.
- CLI: `openclaw channels list` prints the same usage snapshot alongside provider config (use `--no-usage` to skip).
2026-01-07 11:42:41 +01:00
- macOS menu bar: “Usage” section under Context (only if available).
## Providers + credentials
2026-01-31 21:13:13 +09:00
2026-01-07 11:42:41 +01:00
- **Anthropic (Claude)**: OAuth tokens in auth profiles.
- **GitHub Copilot**: OAuth tokens in auth profiles.
- **Gemini CLI**: OAuth tokens in auth profiles.
2026-04-04 12:30:48 +01:00
- JSON usage falls back to `stats` ; `stats.cached` is normalized into
`cacheRead` .
2026-01-07 11:42:41 +01:00
- **OpenAI Codex**: OAuth tokens in auth profiles (accountId used when present).
2026-04-04 12:43:44 +01:00
- **MiniMax**: API key or MiniMax OAuth auth profile. OpenClaw treats
`minimax` , `minimax-cn` , and `minimax-portal` as the same MiniMax quota
surface, prefers stored MiniMax OAuth when present, and otherwise falls back
to `MINIMAX_CODE_PLAN_KEY` , `MINIMAX_CODING_API_KEY` , or `MINIMAX_API_KEY` .
MiniMax's raw `usage_percent` / `usagePercent` fields mean **remaining **
quota, so OpenClaw inverts them before display; count-based fields win when
present.
- Coding-plan window labels come from provider hours/minutes fields when
present, then fall back to the `start_time` / `end_time` span.
- If the coding-plan endpoint returns `model_remains` , OpenClaw prefers the
chat-model entry, derives the window label from timestamps when explicit
`window_hours` / `window_minutes` fields are absent, and includes the model
name in the plan label.
2026-04-04 12:40:55 +01:00
- **Xiaomi MiMo**: API key via env/config/auth store (`XIAOMI_API_KEY` ).
2026-01-07 11:42:41 +01:00
- **z.ai**: API key via env/config/auth store.
2026-04-04 12:40:55 +01:00
Usage is hidden when no usable provider usage auth can be resolved. Providers
can supply plugin-specific usage auth logic; otherwise OpenClaw falls back to
matching OAuth/API-key credentials from auth profiles, environment variables,
or config.