Files
nanobot-runtime/skills/usage/SKILL.md

1.8 KiB
Raw Blame History

name, description
name description
usage Show Ollama Cloud credit/usage spent via the ollama.com usage API. Triggers on: "/usage", "kolik kreditu", "kolik mam vycerpano", "ollama usage", "spotreba ollama", "credits".

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):

Ollama Cloud usage
Session: <pct> %, resets in X hours — <model> (<req count>), …
Weekly:  <pct> %, resets in Y days — <model> (<req count>), …
Models (request count, weekly window):
  <model>: <count>

Present the script output to the user in Czech (translate the labels, keep the numbers exact).

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_*.

Notes

  • Endpoint: GET https://ollama.com/api/usage, header Authorization: Bearer <key> (verified 2026-09; issue #15132 is stale).
  • limits.*.usage is a fraction of the plan limit (× 100 = % as on the dashboard).
  • activity.cost returns $0.00000 on the Pro plan — broken, omitted from the output.
  • The ~/.ollama/id_ed25519 key does not work — only an API key minted at ollama.com/settings/keys.