pi-opencode-bridge
OpenCode provider for Pi Agent. Auto-discovers models from OpenCode registry and uses Pi's native OpenAI-compatible handler.
Package details
Install pi-opencode-bridge from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-opencode-bridge- Package
pi-opencode-bridge- Version
0.2.0- Published
- May 9, 2026
- Downloads
- 213/mo · 213/wk
- Author
- wahyudichrisdianto
- License
- MIT
- Types
- extension
- Size
- 12.1 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-opencode-bridge
OpenCode provider for Pi Agent. Auto-discovers models from OpenCode registry and uses Pi's native OpenAI-compatible handler.
Install
pi install /path/to/pi-opencode-bridge
Then restart Pi.
Authentication
Quick setup (recommended)
/opencode-go-key <your-api-key> # Set OpenCode Go API key directly
/opencode-go-key # Interactive prompt if no key provided
/opencode-status # Check authentication status
Manual setup
Keys are saved to two locations:
~/.local/share/opencode/auth.json— shared with OpenCode CLI~/.pi/agent/auth.json— Pi's AuthStorage format
Available Models
After setup, select a model via /model. Models are split into two providers:
Go plan (oc-sdk-go/):
oc-sdk-go/deepseek-v4-prooc-sdk-go/deepseek-v4-flashoc-sdk-go/kimi-k2.6oc-sdk-go/mimo-v2.5-prooc-sdk-go/glm-5.1oc-sdk-go/qwen3.6-plus
Zen plan (oc-sdk-zen/):
oc-sdk-zen/claude-opus-4.7oc-sdk-zen/gpt-5.2
How It Works
- At startup, reads
~/.cache/opencode/models.json(OpenCode's model registry) - Models registered in Pi with context windows, costs, and capabilities
- Pi's native
openai-completionshandler bridges requests to OpenCode's API - Message conversion, tool calls, thinking/reasoning, and SSE streaming handled by Pi
Architecture
Pi Agent
├─ oc-sdk-go → https://opencode.ai/zen/go/v1 (OpenAI-compatible)
└─ oc-sdk-zen → https://opencode.ai/zen/v1 (OpenAI-compatible)
Commands
| Command | Description |
|---|---|
/opencode-go-key [key] |
Set OpenCode Go API key (direct or interactive) |
/opencode-status |
Check auth status for Go and Zen plans |
Upcoming (v0.3.0)
/opencode-connect— CLI-based login viaopencode auth login/opencode-zen-key— Set Zen plan API key directly