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

pi-ollama-keyring

v1.0.0

Published

Ollama cloud provider for pi-coding-agent with multi-key rotation, live model discovery, and persistent key-pool management

Readme

pi-ollama-keyring

Ollama cloud provider for pi-coding-agent with multi-key rotation, live model discovery, and persistent key-pool management.

What makes this different

The official @0xkobold/pi-ollama package supports a single API key and a stale hardcoded model list.

pi-ollama-keyring was built for people running multiple Ollama cloud API keys who need:

  • a live model inventory pulled directly from their account
  • automatic key rotation when a key hits quota or rate limits
  • manual key selection that survives restarts
  • full tool-calling and thinking support through Pi

Installation

pi install npm:pi-ollama-keyring

Or add to your global ~/.pi/agent/settings.json:

{
  "packages": ["pi-ollama-keyring"]
}

Configuration

Add your keys and settings to ~/.pi/agent/settings.json:

{
  "pi-ollama": {
    "cloudUrl": "https://ollama.com",
    "apiKeys": [
      "key-1",
      "key-2",
      "key-3"
    ],
    "activeKeyIndex": 0
  }
}

A single key also works:

{
  "pi-ollama": {
    "apiKey": "your-key-here"
  }
}

Environment variables

export OLLAMA_API_KEY="your-key"
export OLLAMA_API_KEYS="key-1,key-2,key-3"
export OLLAMA_HOST_CLOUD="https://ollama.com"
export OLLAMA_ACTIVE_KEY_INDEX="0"

Config precedence (highest to lowest)

  1. Environment variables
  2. pi.settings runtime API
  3. .pi/settings.json (project-local)
  4. ~/.pi/agent/settings.json (global)

Features

  • ☁️ Ollama Cloud — talks directly to api.ollama.com via the ollama npm client
  • 🔑 Multi-key pool — load as many API keys as you have
  • 🔁 Auto-rotation — on quota, rate-limit, or auth failure the key pool is walked until a working key is found
  • 💾 Persistent rotation — manual key changes write activeKeyIndex back to your settings file so the active key survives restarts
  • 🎯 Live model discovery — model list is fetched from your actual Ollama cloud account at startup, not a stale hardcoded list
  • 📊 Accurate context lengths — uses /api/show for real context window sizes
  • 👁️ Vision detection — detected from capabilities and model name
  • 🧠 Thinking/reasoning — native support for models that expose a thinking block
  • 🛠️ Tool calling — Pi tools work end-to-end through the native Ollama chat stream
  • 🔄 Manual refresh — re-fetch the cloud model list any time with /ollama-refresh

Commands

| Command | Description | |---------|-------------| | /ollama-status | Show cloud connection status and active key | | /ollama-models | List all discovered cloud models | | /ollama-refresh | Re-fetch the live model inventory | | /ollama-info MODEL | Show details for a specific model | | /ollama-keys | Show masked key-pool status | | /ollama-rotate | Rotate to the next key and persist the change | | /ollama-use-key N | Activate a specific key by 1-based index and persist |

How key rotation works

Keys are stored in an ordered pool. On startup, the active key starts at activeKeyIndex (default 0).

Automatic rotation happens during any cloud request when a response matches a quota or rate-limit pattern:

  • HTTP 429, 402, 401, 403, 5xx
  • Body containing quota, rate limit, unauthorized, payment required, etc.

The pool is walked from the current key through all remaining keys until a working one is found. If all keys are exhausted the error is surfaced to Pi.

Manual rotation via /ollama-rotate or /ollama-use-key N additionally writes activeKeyIndex back to ~/.pi/agent/settings.json so the choice persists across restarts.

Provider name

Models are registered under provider ollama-cloud:

ollama-cloud/minimax-m2.7
ollama-cloud/kimi-k2.5
ollama-cloud/gpt-oss:20b

Use them in Pi like any other provider:

pi --provider ollama-cloud --model gpt-oss:20b

Or add to enabledModels for Ctrl+P cycling:

{
  "enabledModels": [
    "ollama-cloud/minimax-m2.7",
    "ollama-cloud/kimi-k2.5",
    "ollama-cloud/gpt-oss:20b"
  ]
}

Model display

Each model shows source, vision, and reasoning badges plus context size:

☁️ 👁️ 🧠 kimi-k2.5 · 1.04T · 262K ctx
☁️ 🧠 minimax-m2.7 · 230B · 200K ctx
☁️ gpt-oss:20b · 13.8B · 128K ctx

License

MIT