Ollama Cloud Meter
No longer maintained: I have stopped using Ollama, so I will probably not update
this extension again. It depends on an undocumented Ollama endpoint, so if it stops
working one day, that is most likely why. Feel free to fork it: the code is public domain.
Unofficial: This is a community project. It is not affiliated with, endorsed by or
supported by Ollama. "Ollama" is a trademark of its owner and is used here only to say
which service the extension works with.
Disclaimer: I did not write any of the code in this project. It was all
generated by AI, which I only directed by describing what I wanted
and asking for changes. I tested it and reviewed the results.
License: The Unlicense. Public domain, so copy, change and reuse it freely.
A small status bar meter for Ollama Cloud usage limits:
🤖 43% 1h50m · 88% 3d4h
One status bar item showing session and weekly usage, tinted by a colour ramp driven by the
higher of the two, with the time until each window resets. Hover it for a table with usage bars and reset times, with buttons on top to refresh and change the settings. No telemetry, no dependencies, one network request.
Files
Three main files:
- src/request.js: the network request, and nothing else.
- src/ui.js: the status bar text, colours, tooltip and refresh behaviour.
- src/config.js: the numbers and switches you might change.
The request:
GET https://ollama.com/api/balance
Authorization: Bearer <your Ollama API key>
- Redirects are refused, so the key cannot be forwarded to another host.
- Nothing is logged.
- The key is stored in VS Code Secret Storage (OS keychain), or read from the
OLLAMA_API_KEY environment variable.
The balance endpoint is undocumented, so it may change or behave differently from what is assumed here.
Install
Pick one:
- Marketplace: search for "Ollama Cloud Meter" in the Extensions view. VS Code
updates it automatically unless you turn that off.
- No auto-update: download
ollama-cloud-meter.vsix from the
GitHub Releases page and run
Extensions: Install from VSIX... from the Command Palette. Nothing changes until
you install a newer file yourself.
- Build it yourself: see below.
A .vsix is just a zip file, so you can rename a copy to .zip and look inside: the source ships readable and unminified, next to package.json, the LICENSE, the README and the icon. No bundled dependencies, nothing obfuscated.
Build from source
You need Node.js 18 or newer. If the version is too old the
build stops with a clear message instead of a stack trace. With
nvm (or nvm-windows) run nvm install first to
pick up the version in .nvmrc.
git clone https://github.com/DiogoLogrado/ollama-cloud-meter
cd ollama-cloud-meter
npm run package # checks Node, then creates dist/ollama-cloud-meter.vsix
Then in VS Code:
- Press
Ctrl+Shift+P (Cmd+Shift+P on macOS) to open the Command Palette.
- Run Extensions: Install from VSIX...
- Pick
dist/ollama-cloud-meter.vsix.
- Reload the window if asked.
Command line alternative: code --install-extension dist/ollama-cloud-meter.vsix.
To update, rebuild the .vsix and install it again.
To remove it, uninstall "Ollama Cloud Meter" from the Extensions view.
Use
- Get an API key: sign in at ollama.com, open
Settings → Keys, click Add API Key, give it a
name and copy the key. It is shown only once.
- Click the red Set Ollama API key item in the status bar (or run
Ollama Cloud Meter: Set API Key from the Command Palette) and paste the key.
- The meter appears in the status bar. Hover it for the details.
The buttons at the top of the tooltip refresh, set the thresholds, set the refresh interval
and replace the API key. They are also in the Command Palette:
Ollama Cloud Meter: Set Refresh Interval changes how often usage is checked (0 turns the timer off).
Ollama Cloud Meter: Set Threshold Percentages changes the two thresholds.
Everything else lives in src/config.js.
Change how it looks
Edit src/config.js for the gradient colours and the focus refresh, or src/ui.js for the status bar text and tooltip. Build from source and reinstall afterwards.