2.5 KiB
name, description
| name | description |
|---|---|
| usage | Show Ollama Cloud credit/usage spent via the ollama.com usage API, and report continuously sampled usage history. Triggers on: "/usage", "ollama usage", "how much credit", "how much have I used up", "credits left", "quota", "usage report", "usage history". |
Usage
Shows Ollama Cloud credit usage for the current API key.
Run
uv run skills/usage/scripts/ollama_usage.py
The script reads OLLAMA_API_KEY from the workspace/.env file (created by
the user). If it is missing or the key fails (401/403), tell the user —
never scrape the website.
Output
Format (script prints it, present it to the user as-is — same lines, same order; translate the labels into the user's language, keep the numbers exact; no extra model info on the Session/Weekly lines):
Ollama Cloud usage
Session: <pct> %, resets in X hours
Weekly: <pct> %, resets in Y days
Models (request count, weekly window):
<model>: <count>
The per-model breakdown lives only in the "Models" section — never inline on the Session/Weekly lines.
Reset times — derived, not from the API
/api/usage contains no reset timestamps (they exist only in the HTML
UI). The script computes them: session = until the next full hour UTC (the
dashboard shows "Resets in 1 hour"), weekly = until the next Monday 00:00
UTC. Rationale: session usage climbed in real time during testing (rolling
window), weekly changes slowly — consistent with hourly/weekly windows.
If the window turns out not to be calendar-based, fix until_next_*.
Continuous sampling
A cron job runs scripts/ollama_usage_poll.py every minute and appends to
db/ollama_usage.sqlite whenever anything changed (table samples; table meta
records every poll, so a gap can be told apart from a failed poll).
For a delta report over that data:
uv run skills/usage/scripts/ollama_usage_report.py [--since ISO] [--until ISO]
Default window is the last 24 hours. Per-model request counts are the exact
figure there — limits.*.usage has a resolution of 0.1 %, so short-interval
percentage deltas are noise.
Notes
- Endpoint:
GET https://ollama.com/api/usage, headerAuthorization: Bearer <key>(verified 2026-09; issue #15132 is stale). limits.*.usageis a fraction of the plan limit (× 100 = % as on the dashboard).activity.costreturns $0.00000 on the Pro plan — broken, omitted from the output.- The
~/.ollama/id_ed25519key does not work — only an API key minted at ollama.com/settings/keys.