OpenCode provider
This page is the Orbi integration note for Pi’s native OpenCode provider. It is part of the provider series. The facts below were checked on 2026-09-08 with Pi 0.85.1 (pi --version). OpenCode’s catalog and plans are service-controlled and can change;
repeat the catalog command before a new deployment.
What is authenticated
Pi 0.85.1 treatsopencode as an API-key provider, not an OAuth provider. Its
provider documentation maps it to OPENCODE_API_KEY and to the opencode key
in Pi’s auth.json. The key is an OpenCode Zen/OpenCode account key; it is not
an Orbi token and not OPENAI_API_KEY.
Choose one of these equivalent setup paths:
- Create/copy the key in the OpenCode account, following the official OpenCode Zen documentation.
-
In an interactive Pi session run
/login, choose OpenCode Zen, and paste the API key. Pi stores it in its user auth file (mode0600). This is an API-key login, not an OAuth browser flow. -
Or provide the key to the Orbi service through its gitignored environment
file:
The installed Orbi systemd unit loads
.orbi/env. For a manual check, export it in the shell first:
credentials_not_configured when no key was present. A
successful check is evidence that credentials are configured, not evidence
that the account has quota. Do not use --credentials in a transcript.
Catalog and Orbi configuration
opencode is built into Pi’s catalog. The catalog check used for this page was:
opencode model IDs (context/output
limits are also shown by the command and are intentionally not copied here as
quota promises):
opencode-go provider. Do not
change pi_provider to it unless the account is an OpenCode Go account; its
model IDs and plan are separate. The catalog can be filtered again with
pi --list-models opencode after authentication/catalog refresh.
For the smallest Orbi setup, select a model ID exactly as Pi printed it:
.orbi/pi-providers.json for this setup. Pi already owns the
provider, endpoint, API type, model metadata, and API-key mapping. Defining a
second opencode entry can shadow or stale the native catalog. Use a
pi_providers file only for providers that Pi does not natively supply, such
as Orbi’s local-qwen or z-ai templates.
Before dispatching an Issue, run a real, non-secret smoke request with the
selected account and model:
Quota, limits, and observed boundary
OpenCode’s Zen page and OpenCode Go page are the authority for current pricing, free models, account plans, rate limits, and reset behavior. These values are not Pi catalog metadata and must not be inferred fromcontextWindow,
maxTokens, or a model name.
As of the dated check above, this worktree had no usable OpenCode account:
- real OpenCode inference request: not tested;
- quota consumption or remaining allowance: not measured;
- rate-limit/429 response and reset time: not tested;
- real Orbi Issue delivery and PR: not tested.
Minimal fallback
To switch after an auth, quota, or limit failure, change only the provider selection and use that provider’s existing setup:templates/pi-providers/, put its key in
.orbi/env (local Qwen uses its documented dummy key), and run the provider
validation plus one real pi --print request. Switching is manual; it does
not repair an invalid OpenCode key or create an automatic fallback.