Mastodon Skip to content
ai.rud.is
Go back

ollama-usage, enhanced

hrbrmstr MD

Back in April I wrote about a tiny Go CLI, ollama-usage, that scrapes Ollama Cloud usage data from the terminal so I don’t have to squint at their light-mode-only settings page at 0-dark-30.

Since then Ollama changed their HTML structure (of course they did), which meant the old scraping logic broke. Rather than just duct-tape it, I took the opportunity to make the tool a bit more useful.

What’s new

Per-model breakdowns

Pass -verbose (or -v) and you now get request counts and percentages broken out by model, for both the session and weekly windows:

ollama-usage -verbose
Ollama Cloud Usage (pro plan)

  Session:   24.6% used  (resets in 3 hours)
  Weekly:     6.6% used  (resets in 4 days)

  Session █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  24.6%
  Weekly  ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░   6.6%

Session models:
  deepseek-v4-pro                   53 requests  ( 18.6%)
  glm-5.1                           45 requests  (  5.6%)
  glm-5                              6 requests  (  0.2%)
  ...

Weekly models:
  deepseek-v4-pro                   86 requests  (  5.0%)
  glm-5.1                           58 requests  (  1.5%)
  ...

This is a feature I kind of wanted from the start — it’s one thing to know you’re at 25% of your session quota, but it’s another to know which model is eating it.

Richer JSON

The -json output now mirrors the same nested structure:

{
  "plan": "pro",
  "session": {
    "percent": 24.6,
    "resets_at": "2026-05-27T15:00:00Z",
    "models": [
      {
        "model": "deepseek-v4-pro",
        "requests": 53,
        "percent": 18.6,
        "color": "#af52de"
      }
    ]
  },
  "weekly": {
    "percent": 6.6,
    "resets_at": "2026-06-01T00:00:00Z",
    "models": [
      {
        "model": "deepseek-v4-pro",
        "requests": 86,
        "percent": 5.0,
        "color": "#af52de"
      }
    ]
  },
  "fetched_at": "2026-05-27T10:15:00Z"
}

The color field is whatever Ollama uses in their own UI for that model’s bar — useful if you’re piping this into a dashboard.

More ways to authenticate

In addition to auto-extracting the Firefox cookie on macOS, you can now:

All three are handy for CI, remote machines, or just not wanting to hunt through ~/Library.

Still no API

Ollama still hasn’t shipped an official usage endpoint (the feature request is still open), so we’re still scraping. The good news is the new parser is more robust — it walks the DOM rather than regexing raw HTML, so the next time they move a div around it should be a one-line fix instead of a rewrite.

If you’re already using ollama-usage, git pull and go build should get you the new bits. If not, the repo is at git.sr.ht/~hrbrmstr/ollama-usage.

Kick the tyres, shoot me a PR, and maybe bug the Ollama folks about that API.



Previous Post
Starlog And The Case Of The Missing Feed
Next Post
Making ai.rud.is Legible To Machines