z2zed2cli

Your Zed subscription, reachable from the terminal

v2.0.0

Use your Zed plan
from any CLI agent
without the editor

zed2cli bridges the AI models in your Zed account to OpenCode, pi, Hermes, and any tool that speaks the OpenAI API. It runs on your machine and talks to cloud.zed.dev for you.

$npm install -g zed2cli
See a SessionView GitHub Repo
npm: zed2cli@2.0.0MITnode 18 or newerupdated 2026-10live page6yte96.me
LIVE BRIDGEcloud.zed.dev/completions
In-Process Hook
AGENT:
01 CLIENTMemory IPC (no proxy)
> opencode run -m zed-ai/claude-sonnet-4-6 "optimize parser"
ctx.session.hook("http.request") ➔ rewrites envelope
OpenAI Spec ⇄ Zed Protocol
zed2cli engine Keyring Auth ~50m
JWT Auto-Mint SSE ⟷ NDJSON 0 Runtime Deps
Cloudflare Edge (cf-ray verified)
03 ZED CLOUDHTTP 200 STREAM
WIRE INSPECTOR (Claude Sonnet 4.6)1M tokens
01event: message_start (role: assistant)
█
16Zed Models
0Runtime Deps
50Min Token Refresh

How the bridge works

Zed speaks its own protocol. zed2cli translates both directions. These are the files a contributor would touch.

OpenCodeplugin, in processpiextension, HTTPAny OpenAI clientHermes, scripts, HTTPzed2clitranslation layercli.mjs dispatchersrc/index.mjs OpenCode 2src/index.v1.mjs OpenCode 1src/proxy.mjs OpenAI bridgesrc/models.mjs catalogsrc/pi/zed-ai.mjs pitoken resolverscripts/zed-token.shkeyring or saved fileprovider_request out, streamed events backcloud.zed.devPOST /completionsBearer JWT from your Zed account

OpenCode talks to the layer in process. pi, Hermes, and other clients talk to it over HTTP on 127.0.0.1:8787. Both leave through the same translation code.

PLUGIN

OpenCode plugin

src/index.mjs registers the zed-ai provider through the OpenCode 2 plugin API and rewrites requests in process. src/index.v1.mjs is the OpenCode 1 build, and the installer copies whichever one matches your version.

BRIDGE

Proxy and pi

src/proxy.mjs serves GET /v1/models and POST /v1/chat/completions, translates each request, and forwards it to cloud.zed.dev. src/pi/zed-ai.mjs points pi at that proxy through ZED_PROXY_URL.

CATALOG

Shared model catalog

src/models.mjs is the single source of truth for the 16 models, their provider keys, and their capability flags. The plugin and the proxy both import it.

TOKENS

Token resolution

scripts/zed-token.sh resolves a JWT from ZED_TOKEN, the system keyring, ~/.zed_access_token, or ~/.zed_jwt_token. The refresh daemon keeps the file current so long runs do not expire.

From install to a running agent

Real commands and real output. Each tab is a sample run on a machine with Zed signed in and the tool already installed.

opencode, plugin install
$ npm install -g zed2cli
$ zed2cli install-opencode
  detected OpenCode 2.0.29
  installed the plugin for the v2 API

$ opencode models | grep zed-ai
  zed-ai/claude-sonnet-4-6
  zed-ai/gpt-5.6-sol
  zed-ai/gemini-3.5-flash
  ... 13 more

$ opencode run -m zed-ai/claude-sonnet-4-6 "say hello in one word"
  hello

Capabilities

Everything zed2cli wires up between install and a working agent. Search by keyword, filter by scope.

grep$
scope
OPENCODEPLUGIN API V1 AND V2

Runs inside OpenCode

The installer detects your OpenCode major version and copies the matching plugin. On OpenCode 2 the zed-ai provider registers through the in process plugin API, so no extra process is needed.

PROXYOPENAI COMPATIBLE

Local OpenAI bridge

Point pi, Hermes, or any OpenAI compatible client at http://127.0.0.1:8787/v1. The proxy rewrites each request into the Zed envelope and streams the answer back as server sent events.

PIPI EXTENSION

pi provider in one command

zed2cli install-pi registers the zed-ai provider with pi and points it at the local proxy. The extension carries its own model list because pi loads extensions from a virtual URL.

TOKENSJWT AND KEYRING

Tokens stay fresh

A Zed JWT lasts about an hour. The refresh daemon keeps a live token in ~/.zed_jwt_token every 50 minutes, and every command, the plugin, and the proxy read it from there.

DIAGNOSTICSCLI

doctor tells the truth

One command lists every token source with its expiry, checks whether the plugin matches your OpenCode version, and reports whether the proxy is running.

CATALOGSHARED MODULE

One source of truth

src/models.mjs lists all 16 models with their provider key, context size, output size, and capability flags. The plugin and the proxy both import it, and a check fails the build when the pi copy drifts.

Models in the Zed Catalog

Every model below was read from GET https://cloud.zed.dev/models with a Zed Student plan token. Other plans may expose a different list.

ModelProviderContextMax OutputReasoning
Claude Sonnet 5Anthropic1,000,000128,000yes
Claude Sonnet 4.6DEFAULTAnthropic1,000,00064,000yes
Claude Sonnet 4.5Anthropic200,0008,192yes
Claude Haiku 4.5Anthropic200,00064,000yes
GPT-5.6 SolOpenAI400,000128,000yes
GPT-5.6 TerraOpenAI400,000128,000yes
GPT-5.6 LunaOpenAI400,000128,000yes
GPT-5.5OpenAI400,000128,000yes
GPT-5.4OpenAI400,000128,000yes
GPT-5.3-CodexOpenAI400,000128,000yes
GPT-5.2OpenAI400,000128,000no
GPT-5 miniOpenAI400,000128,000no
GPT-5 nanoOpenAI400,000128,000no
Gemini 3.1 ProGoogle200,00065,535yes
Gemini 3.5 FlashGoogle1,048,57665,535yes
Gemini 3 FlashGoogle1,048,57665,535yes
All 16 models support tools and images. Reasoning is the supportsReasoning flag from src/models.mjs. The default model is claude-sonnet-4-6.Catalog Verified
SUPPORT

Keep the bridge open

zed2cli is MIT licensed and built in the open. If it saved you from writing a proxy of your own, star the repo or pass it on to another engineer.