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.
Your Zed subscription, reachable from the terminal
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.
Zed speaks its own protocol. zed2cli translates both directions. These are the files a contributor would touch.
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.
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.
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.
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.
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.
Real commands and real output. Each tab is a sample run on a machine with Zed signed in and the tool already installed.
$ 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"
helloEverything zed2cli wires up between install and a working agent. Search by keyword, filter by scope.
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.
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.
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.
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.
One command lists every token source with its expiry, checks whether the plugin matches your OpenCode version, and reports whether the proxy is running.
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.
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.
| Model | Provider | Context | Max Output | Reasoning |
|---|---|---|---|---|
| Claude Sonnet 5 | Anthropic | 1,000,000 | 128,000 | yes |
| Claude Sonnet 4.6DEFAULT | Anthropic | 1,000,000 | 64,000 | yes |
| Claude Sonnet 4.5 | Anthropic | 200,000 | 8,192 | yes |
| Claude Haiku 4.5 | Anthropic | 200,000 | 64,000 | yes |
| GPT-5.6 Sol | OpenAI | 400,000 | 128,000 | yes |
| GPT-5.6 Terra | OpenAI | 400,000 | 128,000 | yes |
| GPT-5.6 Luna | OpenAI | 400,000 | 128,000 | yes |
| GPT-5.5 | OpenAI | 400,000 | 128,000 | yes |
| GPT-5.4 | OpenAI | 400,000 | 128,000 | yes |
| GPT-5.3-Codex | OpenAI | 400,000 | 128,000 | yes |
| GPT-5.2 | OpenAI | 400,000 | 128,000 | no |
| GPT-5 mini | OpenAI | 400,000 | 128,000 | no |
| GPT-5 nano | OpenAI | 400,000 | 128,000 | no |
| Gemini 3.1 Pro | 200,000 | 65,535 | yes | |
| Gemini 3.5 Flash | 1,048,576 | 65,535 | yes | |
| Gemini 3 Flash | 1,048,576 | 65,535 | yes |
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.