pi-opencode-zen is a pi extension package extracted from pi-mono and adapted into a standalone extension.
It registers the opencode-zen provider for pi and exposes OpenCode Zen models through pi's provider system.
Install it as a local/private pi package:
pi install git:github.com/ravshansbox/pi-opencode-zenAfter installation, reload pi if needed.
This extension:
- is extracted from
pi-mono - registers the
opencode-zenprovider from a standalone package - supports anonymous mode by using the API key value
public - adds OpenCode request headers on every
opencode-zenprovider request:x-opencode-clientx-opencode-sessionx-opencode-projectx-opencode-request
- sets the OpenCode CLI-style
User-Agent
Get an API key from OpenCode Zen, then configure pi in one of these ways.
Set:
export OPENCODE_API_KEY=your-real-keyTo use anonymous mode for OpenCode Zen free/public models, set:
export OPENCODE_API_KEY=publicYou can also store the key in pi's auth file under the opencode-zen provider name:
~/.pi/agent/auth.json
Example:
{
"opencode-zen": {
"type": "api_key",
"key": "your-real-key"
}
}Anonymous mode in auth storage:
{
"opencode-zen": {
"type": "api_key",
"key": "public"
}
}This package stays private: true and is intended for local/private use. The extension entry point is declared in package.json:
{
"pi": {
"extensions": ["./index.ts"]
}
}This extension mirrors OpenCode CLI behavior as closely as possible:
- it fetches the live visible model IDs from the OpenCode Zen API
- it fetches OpenCode provider metadata from
models.dev - it filters out models with
status === "deprecated" - in anonymous/public mode (
key = "public"), it keeps only models wheremodels.devreportscost.input === 0
Live model visibility source:
curl -H 'Authorization: Bearer public' https://opencode.ai/zen/v1/modelsOpenCode metadata source:
curl https://models.dev/api.jsonNote: the Zen /models endpoint does not include pricing or deprecation metadata, so the extension combines both sources.
index.ts— extension entry pointpackage.json— pi package metadata