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-nano-gpt-provider

v0.2.1

Published

nanoGPT custom provider extension for the Pi coding agent — lazy discovery of the detailed model catalog (context windows, vision/reasoning, at-cost pricing), cached offline, no startup blocking.

Downloads

574

Readme

pi-nano-gpt-provider

A custom nanoGPT provider for the Pi coding agent. Registers the nano-gpt provider against nano-gpt.com's OpenAI-compatible endpoint (https://api.nano-gpt.com/api/v1) with lazy, detailed model discovery — no blocking network call at startup.

Why this shape

  • Never blocks startup. Models are discovered via refreshModels, which Pi calls lazily with an abort signal. The old approach (a manual fetch in the factory) could hang Pi's launch when nano-gpt.com was slow or unreachable.
  • Detailed catalog, no hardcoded tables. Discovery uses GET /api/v1/models?detailed=true, so every model carries real metadata straight from the API: context window (context_length), output cap (max_output_tokens), vision/reasoning/tool capabilities, and at-cost USD pricing (pricing.prompt / pricing.completion, plus cache rates when published).
  • Cached and resilient. Successful snapshots are persisted through Pi's models store and restored on offline init; a fresh snapshot (< 5 min) is reused without a request; a failed refresh keeps the last-known list instead of wiping the catalog.
  • Honest "not configured" state. With no API key, Pi never treats the provider as usable and no models appear — no phantom "auto-model" that fails on every call.
  • Auth handled by Pi. The key comes from ~/.pi/agent/auth.json under provider id nano-gpt (via /login nano-gpt) with NANOGPT_API_KEY as the fallback ($NANOGPT_API_KEY is Pi's own env interpolation).

Install

# install from npm
pi install npm:pi-nano-gpt-provider

# or copy the single file into your global extensions dir
cp src/nano-gpt-provider.ts ~/.pi/agent/extensions/

Then /reload (or restart) and authenticate:

pi
/login nano-gpt          # store your API key
# or set the env var once:
export NANOGPT_API_KEY=...

Usage

Once installed, nano-gpt appears alongside your other providers:

  • /provider nano-gpt — switch to the provider (its first model)
  • /models nano-gpt — list and pick from the discovered models
  • Ctrl+L / /model — normal Pi model switching

Behavior notes

  • Model catalog: fetched from GET https://api.nano-gpt.com/api/v1/models?detailed=true on demand. api.nano-gpt.com is nanoGPT's canonical API host for key-based integrations (the website lives on nano-gpt.com). The detailed shape is what the models endpoint docs recommend for capabilities and pricing.
  • Ordering: the request asks for sort=favorites, so the account's most-used models come first (the API falls back to normal ordering when the key cannot be personalized). Set NANOGPT_MODEL_SORT=mostused for globally popular models, or NANOGPT_MODEL_SORT=none to leave the catalog order untouched.
  • Capabilities: vision (or architecture.input_modalities) adds image input support; capabilities.reasoning and id suffixes ending in :thinking mark reasoning models.
  • Costs: at-cost USD per-million-token rates from the API. Cache reads/writes use pricing.cacheReadInputPer1kTokens / cacheWriteInputPer1kTokens (converted from per-1k) when present; otherwise they fall back to the input rate rather than under-reporting spend.
  • Persistence: a successful snapshot is written to Pi's models store (models-store.json in the agent directory) with a checkedAt timestamp. Offline/cache-only init restores it, and snapshots younger than five minutes (matching the API's cache-control: s-maxage=300) are reused without another request. context.force bypasses the freshness check.
  • Failures never wipe the catalog: non-OK responses, network errors, unparsable payloads, and empty catalogs all keep the last-known model list.

Options

| Variable | Default | Effect | | --- | --- | --- | | NANOGPT_API_KEY | — | Fallback API key when no nano-gpt credential is stored via /login. | | NANOGPT_MODEL_SORT | favorites | Catalog ordering: favorites, mostused, or none/off. Unknown values use favorites. |

Development / tests

The catalog mapping, snapshot restore, sort selection, persistence, and every refresh failure path run against a stubbed fetch — no network. Install the pinned development dependencies, then run:

npm ci
npm test
npm run typecheck

Requirements

  • Pi coding agent (extension API)
  • An API key for nano-gpt.com

License

MIT — see LICENSE.