pi-opencode
v1.0.0
Published
OpenCode provider extension for pi coding agent — Zen and Go models
Maintainers
Readme
pi-opencode
OpenCode provider extension for pi coding agent.
Access OpenCode Zen (cash balance) and OpenCode Go (subscription credits) models.
Features
- opencode-zen / opencode-zen-anthropic: Pay-as-you-go (https://opencode.ai/zen)
- opencode-go / opencode-go-anthropic: Subscription credits (https://opencode.ai/zen/go)
- 40+ models: GPT, Claude, Gemini, GLM, Kimi, Qwen, MiniMax, and more
Prerequisites
- pi installed
- OpenCode account at https://opencode.ai/auth
Installation
Option 1: Git URL (Recommended)
Add to your pi settings.json (~/.pi/agent/settings.json):
{
"packages": [
"git:https://github.com/awtotty/pi-opencode.git"
]
}Option 2: Clone locally
git clone https://github.com/awtotty/pi-opencode.git ~/.pi/agent/extensions/pi-opencodeConfiguration
1. Get your API key
- Sign up at https://opencode.ai/auth
- Add billing for Zen or subscribe to Go
- Copy your API key
2. Set the environment variable
export OPENCODE_API_KEY="your-api-key-here"Add to shell profile (~/.bashrc, ~/.zshrc, etc.) to persist.
3. Reload pi
/reloadUsage
Select a provider and model
/model opencode-zen/gpt-5.1
/model opencode-go-anthropic/minimax-m2.7Or use /model to browse all available options.
Available Providers
| Provider | API | Endpoint | |----------|-----|----------| | opencode-zen | OpenAI Chat Completions | https://opencode.ai/zen/v1/chat/completions | | opencode-zen-anthropic | Anthropic Messages | https://opencode.ai/zen/v1/messages | | opencode-go | OpenAI Chat Completions | https://opencode.ai/zen/go/v1/chat/completions | | opencode-go-anthropic | Anthropic Messages | https://opencode.ai/zen/go/v1/messages |
MiniMax M2.7 and M2.5 use the Anthropic Messages API. All other models use OpenAI Chat Completions.
Troubleshooting
"No API key" error
echo $OPENCODE_API_KEYIf empty, set it and reload pi:
export OPENCODE_API_KEY="your-key"
/reloadExtension not loading
Run /reload after changes.
Model not found
Verify the model name is correct. Model IDs are case-sensitive.
Development
# Clone the repository
git clone https://github.com/awtotty/pi-opencode.git
cd pi-opencode
# Test locally
pi -e ./src/index.tsLicense
MIT
