| English | Tiếng Việt |
OpenCode Zen inside pi — no API keys. If you’re a workspace member (not the owner), this is how you get Zen models in pi.
pi install npm:opencode-zen-oauth
OpenCode’s v2 console hides API keys from workspace members, and raw OAuth tokens get rejected outside the official client. Three walls, one extension:
/login opencode-zen shows a device code, you
approve once in the browser, pi stores and refreshes the token itself./model only lists what that workspace allows.
On a second workspace? /opencode-zen switch-org — no re-login needed
(session-scoped; re-login to keep it after a restart).Flaky gateway responses (the odd 502/503) are retried with backoff before you ever see an error, and newer Claude models (Haiku 5.5, Sonnet/Opus 5.x, Fable 5) get the adaptive thinking form the gateway requires.
/login opencode-zen # device code + link appears in the TUI
Approve in the browser, come back to the terminal, pick a workspace, done.
Models appear under opencode-zen/ in /model. No opencode install needed —
everything runs over HTTPS against opencode.ai.
Fallback: set OPENCODE_API_KEY to use a Zen API key instead of OAuth.
Live example from a real workspace (your list depends on your workspace):
| id | input | output | cache read | inputs |
|---|---|---|---|---|
glm-5.3-flash |
$0.15 | $0.50 | $0.03 | text, image |
deepseek-v4.1-flash |
$0.30 | $1.20 | $0.006 | text, image |
big-pickle |
$0 | $0 | $0 | text |
mimo-v2.6-flash-free |
$0 | $0 | $0 | text |
Prices per million tokens, billed to the selected workspace. Zero-cost rows
are the Zen free tier: the extension sends the identity headers the gateway
expects (src/free-tier.ts) and the requests pass through untouched, so
tool calling works natively on those models.
/login opencode-zen again.index.ts — entry point pi loads; re-exports src/extension.tssrc/extension.ts — provider assembly and registrationsrc/auth.ts — device-flow login, workspace selection, token refreshsrc/models.ts — console-to-pi model mapping, per-route wire protocolssrc/retry.ts — bounded retries for transient failures and rejected optionssrc/commands.ts — /opencode-zen command (status, switch-org)src/free-tier.ts — free-tier identity headers per requesttest/ — bun test suite with mocked fetch (bun test)MIT
See CHANGELOG.md and GitHub releases.