Skip to content

Add Ollama Cloud usage collector to the agents panel - #10172

Closed
DanteCpp wants to merge 1 commit into
omacom:quattrofrom
DanteCpp:feat/ollama-cloud-usage-collector
Closed

DanteCpp wants to merge 1 commit into
omacom:quattrofrom
DanteCpp:feat/ollama-cloud-usage-collector

Conversation

@DanteCpp

@DanteCpp DanteCpp commented Sep 4, 2026

Copy link
Copy Markdown

What

Adds an ollama collector to the agents panel, alongside claude, codex, and fireworks. The panel gains an Ollama Cloud tab with no plugin changes — the collector prints the same display-ready record contract the other collectors do.

  • Limits: GET https://ollama.com/api/usage (Bearer API key) reports the account's 5-hour session and 7-day weekly usage as 0..1 fractions. The endpoint does not return reset times, and the resets are the same for every account, so the collector computes them: epoch-aligned 5-hour session windows, weekly windows ending Monday 00:00 UTC.
  • Plan: POST https://ollama.com/api/me supplies the tier label ("Pro").
  • Local stats: pi and omp session files whose assistant messages ran on the ollama-cloud provider, with model version tags merged (deepseek-v4-pro:0813 → deepseek-v4-pro).
  • Key lookup: OLLAMA_API_KEY first, then the key pi/omp signed in with (~/.pi/agent/auth.json, ~/.omp/agent/auth.json), then an optional apiKey in ~/.config/omarchy/agents/ollama.json.
  • Model filter: modelPrefix in ~/.config/omarchy/agents/ollama.json restricts local stats to matching models (e.g. "claude" for the Claude models Ollama Cloud serves). The account limits always cover the whole account.

Also ships ollama.svg / ollama-light.svg marks for the bar icon and panel hero, adds ollama to the manifest provider defaults, and documents the collector in the plugin README.

Testing

  • New test/shell.d/agent-usage-ollama-scanner-test.sh (12 tests): session scan across pi and omp roots, provider filtering, tag merging, model prefix, limits parsing, reset computation, cache reuse/fallback, transport retry advice, rejected-key reporting, --force re-probe.
  • ./test/cli passes (116/116).
  • ./test/shell shows only the pre-existing baseline failures (verified identical on a clean checkout).
  • Verified end-to-end against a live Ollama Cloud account: session/weekly fractions, plan label, and local token stats all land in the record.

Ship omarchy-agent-usage-ollama, which reads the account's 5-hour
session and 7-day weekly limits from Ollama's usage endpoint and local
token stats from pi and omp sessions on the ollama-cloud provider. The
panel gains an Ollama Cloud tab with no plugin changes, matching the
existing claude, codex, and fireworks collectors.
@dhh

dhh commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thank you! Brought in with your authorship in #14039. The computed reset times were dropped, since the endpoint doesn't return them and the window alignment couldn't be confirmed, and kept limits are marked stale after a failed check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants