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-zed-provider

v0.2.0

Published

Use a Zed subscription as a native model provider in PI and OMP

Readme

pi-zed-provider

Use a Zed subscription as a native model provider in PI and OMP.

The extension registers a zed provider whose model catalog comes from the connected Zed account. Account storage, sign-in, token refresh, model catalog, request conversion, streaming, tool calls, and usage accounting all run inside the extension; no gateway process is involved.

Requires a Zed account with hosted-model access (Pro, Student, or Business). Not affiliated with Zed Industries.

Install

From npm, one command per host:

omp plugin install pi-zed-provider
pi install npm:pi-zed-provider

From a source checkout:

git clone https://github.com/trefeon/Zed2Api.git
cd Zed2Api
omp plugin install .
pi install .

For a single run without changing host configuration:

omp --extension .
pi --extension .

Both hosts read the entry point from package.json (pi.extensions and omp.extensions). A .tgz is not an installable source on either host; install the package or the directory instead.

Sign in

pi  # then run /login, choose Zed, and name the account
omp login zed

/zed login [name] is also available for adding or naming extra accounts. The browser completes Zed's native-app sign-in and the callback writes the account to ~/.zed2api/accounts.json with owner-only permissions.

Commands

| Command | Effect | | --- | --- | | /zed or /zed status | Accounts, active account, cooldowns, last HTTP status | | /zed login [name] | Add an account through the browser flow | | /zed accounts | List stored accounts | | /zed switch <name> | Make an account active | | /zed forget <name> | Remove an account | | /zed models / /zed refresh | Print or refresh the live model catalog | | /zed probe [name] | Send a 32-token completion per account and report state | | /zed usage [--json] [--all] | Local token spend; exact plan usage when a dashboard cookie is configured | | /zed update | Check npm now and upgrade this install |

Updating

Installs made from npm upgrade themselves. At session start, when the host has an interactive UI, the extension checks the npm registry (once per six hours) and runs the host's own upgrade command:

  • OMP install under ~/.omp/plugins/: omp plugin upgrade pi-zed-provider
  • PI install under ~/.pi/agent/: pi update npm:pi-zed-provider

Only an applied upgrade or a failure is reported. /zed update checks immediately and prints the result, and /zed status shows a cached "available" line without a network call. Restart the host afterwards: neither PI nor OMP reloads provider code in a running session.

A source checkout is never pulled. The updater reports it as unmanaged, so git pull and a reinstall are yours to run.

ZED2API_SKIP_UPDATE_CHECK=1 turns the updater off, including /zed update.

Models

The provider advertises every model the account can serve. The request dialect is selected from the model id:

| Family | Id prefix | Wire dialect | Reasoning | | --- | --- | --- | --- | | Anthropic | claude* and unknown ids | Messages | low … max via output_config.effort | | OpenAI | gpt* | Responses | low, medium, high, xhigh | | Google | gemini* | Gemini contents / systemInstruction / functionDeclarations | forwarded as supported | | xAI | grok* | Chat Completions | forwarded as supported |

The model list is live: a successful sign-in, /zed refresh, or a host-side refresh updates the cache in ~/.zed2api/model-catalog.json. OMP merges discovered models into its catalog; PI seeds its startup registration from the cache so later processes see the full list.

Window and output limits come from the highest specification declared for the same model in the built-in provider catalog, not from a family-wide ceiling. Current examples: GPT-5.6 and GPT-6 advertise 1,050,000 context and 128,000 output tokens; Claude Sonnet 5 and Haiku 5 advertise 1,000,000 and 128,000; Gemini advertises 1,048,576 and 65,536. New ids that are not in the static map fall back to the family's highest specification. ZED2API_CONTEXT_WINDOW and the per-family output overrides still win.

Usage

/zed usage reports the turns this provider served, using Zed's published hosted-model rates. Models that are not yet on Zed's price page use the provider list price +10%, the same markup. Long-context and date-based price tiers are not modeled; the base tier is used. A dashboard cookie adds the account-wide figures from dashboard.zed.dev, including the editor and other clients.

/zed usage
/zed usage --json
/zed usage --all

The local ledger is ~/.zed2api/usage.jsonl; no prompt or response text is stored. The dashboard is authoritative for billing. See docs/usage.md for cache accounting, plan credit, and how to supply the dashboard cookie.

Configuration

All settings are optional. Credentials live outside the repository.

| Variable | Purpose | | --- | --- | | ZED_ACCOUNTS_FILE | Account-store path (default ~/.zed2api/accounts.json) | | ZED_USAGE_FILE | Local usage ledger path | | ZED_PLAN | pro, student, business, or free when no dashboard cookie is set | | ZED_DASHBOARD_COOKIE | Cookie header for dashboard.zed.dev usage | | ZED_API_BASE | Upstream base URL; used by the mock upstream in tests | | ZED2API_CONTEXT_WINDOW | Override the advertised context window | | ZED2API_CLAUDE_MAX_TOKENS | Override the Anthropic output cap | | ZED2API_GPT_MAX_TOKENS | Override the OpenAI output cap | | ZED2API_CLIENT_VERSION | Override the Zed client version sent upstream | | ZED2API_HTTP1 | 1 forces HTTP/1.1 for the HTTPS edge (debugging only) | | ZED2API_SYSTEM_ID | Override the per-install system id | | ZED2API_SKIP_UPDATE_CHECK | Any value disables the npm self-update check |

Development

npm ci
npm run typecheck
bun run test
npm run pack:check

The tests use a mock upstream and stub transport; no Zed account or network is required. See docs/testing.md for the test harness.

Host-specific install and login details: docs/install-pi.md, docs/install-omp.md, and docs/host-login.md.

Security

Account credentials and usage data stay on the local machine. The provider does not log prompts, responses, or tokens. Do not paste accounts.json, dashboard cookies, or full request dumps into an issue. Report vulnerabilities through GitHub Security Advisories as described in SECURITY.md.

License

MIT. See LICENSE.