npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ymchun/opencode-ollama-usage

v1.1.2

Published

An opencode TUI plugin for Ollama usage information.

Readme

@ymchun/opencode-ollama-usage

npm npm

An opencode TUI plugin for Ollama usage information.

home

session

Why This Plugin

A quick shortcut to check my quota usage would be fantastic, rather than navigating to the settings page every time.

Quick Start

Add the plugin to your ~/.config/opencode/tui.json & start opencode:

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": ["@ymchun/opencode-ollama-usage@latest"]
}

Environment Variables

OLLAMA_SESSION_COOKIE (required)

Your Ollama session cookie, used to authenticate requests to the Ollama settings page. Without it the plugin shows No Cookie in the sidebar.

How to get it:

  1. Sign in at ollama.com in your browser
  2. Open DevToolsApplicationCookieshttps://ollama.com
  3. Copy the value of the cookie named __Secure-session
  4. Set it as the environment variable:
# In your shell profile (~/.zshrc, ~/.bashrc, etc.)
export OLLAMA_SESSION_COOKIE="<your-session-cookie-value>"

Or set it in your opencode.json:

{
  "env": {
    "OLLAMA_SESSION_COOKIE": "<your-session-cookie-value>"
  }
}

Note: The session cookie expires periodically. When it does, the plugin will show Signed Out — repeat the steps above to update the value.

OLLAMA_QUOTA_REFRESH_INTERVAL (optional)

How often (in milliseconds) the plugin refreshes quota data. Defaults to 300000 (5 minutes).

export OLLAMA_QUOTA_REFRESH_INTERVAL=60000  # refresh every minute

Troubleshooting

Error Codes

The plugin shows different status messages in the sidebar depending on the state of your connection and quota data. Here's what each message means:

| Message | Meaning | | ------------------ | ------------------------------------------------------------------------------------------------ | | Connect Ollama | No quota data has been fetched yet (initial state). | | No Cookie | OLLAMA_SESSION_COOKIE is not set. | | Signed Out | The session cookie has expired or is invalid. | | Missing Data | The Ollama settings page loaded, but no quota fields (session, weekly, plan) could be extracted. | | Parse Error | The HTML from the Ollama settings page could not be parsed. | | Network Error | The fetch to ollama.com/settings failed (timeout, DNS failure, or non-OK HTTP response). | | Unknown Error | An unrecognized error occurred. |

Tip: You can force an immediate refresh by restarting opencode or by setting OLLAMA_QUOTA_REFRESH_INTERVAL to a shorter interval (e.g. 60000 for 1 minute) to see if the issue resolves on the next cycle.

Using with agent-safehouse

Prepare an env file, place it somewhere (/path/to/agent-safehouse.env)

OLLAMA_QUOTA_REFRESH_INTERVAL=6000
OLLAMA_SESSION_COOKIE='__Secure-session=...'

Start the agent-safehouse as follows

$ safehouse --env=/path/to/agent-safehouse.env -- opencode --opencode-options

Development

bun install
bun run build
bun test

License

MIT