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

@magpie-community/opencode-zed-auth

v0.1.6

Published

Sign in to a Zed subscription (Zed Pro, trial, student, business) from OpenCode or magpie

Readme

@magpie-community/opencode-zed-auth

Signs in to a Zed subscription (Zed Pro, its trial, a student or business plan) and calls the models Zed hosts: Anthropic's, OpenAI's, Google's and xAI's, through cloud.zed.dev, the way the Zed editor calls them. Provider id: zed. Ported from magpie's built-in Zed account.

Sign-in

Sign in with Zed (browser) is Zed's own sign-in:

  1. The plugin makes an RSA-2048 key and listens on a port of 127.0.0.1.
  2. The browser opens zed.dev/native_app_signin with that port and the key's public half.
  3. Once you sign in, zed.dev sends the browser back to the port with your user id and an access token encrypted to the key. The browser is then sent on to zed.dev's "signed in" page.
  4. The plugin asks Zed who the account is (/client/users/me). That gives the organization the models are called under: the default one, else the first. It also gives the plan. An organization with Zed's hosted models turned off is refused.

The sign-in is kept as an oauth entry: access is the access token and refresh is JSON holding the user id, machine id, organization and plan. Zed has no refresh token, so the token lasts until Zed refuses it. When Zed refuses it, you are asked to sign in again. accountId is the account's GitHub login.

Requests

  • Model token: each request uses a short-lived model token, minted from the sign-in with POST /client/llm_tokens and kept in memory. If Zed calls the token stale (a 401, x-zed-expired-token or x-zed-outdated-token), it is minted again once.

  • API per model: each model is declared on the AI SDK package of its own provider, so the request the SDK writes is already what Zed wants. The plugin's fetch wraps it as {provider, model, provider_request} and sends it to POST /completions with Zed's headers:

    | Zed provider | AI SDK package | API | |---|---|---| | anthropic | @ai-sdk/anthropic | Messages | | open_ai | @ai-sdk/openai | Responses | | x_ai | @ai-sdk/openai-compatible | chat completions | | google | @ai-sdk/google | generateContent |

  • Request changes, as magpie makes them:

    • Anthropic: the request loses stream, since the cloud always streams. Every tool_result gets is_error (Zed's cloud refuses one without it).
    • xAI: max_tokens becomes max_completion_tokens.
    • Gemini: the model is named in the request as models/<id>.
  • Replies:

    • Zed's newline-delimited lines are sent back as each API's own server-sent events.
    • A caller that didn't ask for a stream gets one whole reply.
    • A failure Zed reports mid-stream keeps its status (429, 402, 529 …). So does a reply without Zed's stream_ended, which comes back as an error rather than a shorter answer.
    • A 402 means the plan doesn't include Zed's hosted models, or its allowance is used up.

Models

  • After sign-in: the account's own list comes from Zed's GET /models, read when you sign in and every 10 minutes after. Disabled models are left out. Each model's effort levels become its variants.
  • Before sign-in: the config hook declares one model of each family (Claude Sonnet 5, Opus 5.5, Haiku 4.5, GPT-5.5, Gemini 3.5 Flash, Grok 4.7), which the account's list replaces.

Not included

  • magpie's plan display: plan name, billing period, overdue invoices. Zed doesn't report how much of the allowance is spent.
  • Several Zed accounts at once. OpenCode keeps one sign-in per provider.
  • magpie's web-search stand-in.