This guide will help you install PAI OpenCode in under 5 minutes.
Before running the installer, ensure you have:
-
Git — For cloning the repository
- macOS:
brew install git - Linux:
sudo apt install git - Usually pre-installed on most systems
- macOS:
-
Bun (1.3.9+) — JavaScript/TypeScript runtime used by PAI-OpenCode's tooling
curl -fsSL https://bun.sh/install | bash[!NOTE] Bun 1.3.9+ is required only for PAI-OpenCode's own tooling (installer, plugins, skills, MCP servers). It is not used to compile OpenCode itself — since v3.0, PAI-OpenCode ships against vanilla OpenCode from
opencode.ai, which provides its own pre-built binary.Check your version with
bun --versionand upgrade withbun upgradeif needed.
# 1. Clone PAI-OpenCode
git clone https://github.com/Steffen025/pai-opencode.git
cd pai-opencode
# 2. Run the interactive installer wizard
bash PAI-Install/install.sh
# Optional: show bootstrap help
bash PAI-Install/install.sh --help
# Optional: headless install for scripts/CI
bash PAI-Install/install.sh --headless --preset zen --name "Your Name" --ai-name "Jeremy"
# 3. Start OpenCode
opencodeThe installer will:
- ✅ Check prerequisites (git, bun 1.3.9+)
- ✅ Install vanilla OpenCode from opencode.ai
- ✅ Uses OpenCode Zen free models by default — no API key required. To connect premium providers after install, run
/connectinside OpenCode. - ✅ Set up your identity (name, AI assistant name, timezone)
- ✅ Generate all configuration files
Takes ~2-3 minutes.
Already have OpenCode with ~/.opencode? PAI-OpenCode uses a symlink approach so your config lives in a git repo:
# 1. Clone PAI-OpenCode
git clone https://github.com/Steffen025/pai-opencode.git
cd pai-opencode
# 2. Back up your existing config
mv ~/.opencode ~/.opencode.backup
# 3. Symlink PAI-OpenCode to your home directory
ln -s $(pwd)/.opencode ~/.opencode
# 4. Run the installer (works in place)
bash PAI-Install/install.sh
# 5. Start OpenCode
opencodeWhy symlink? Your config lives in a repo you control. Upgrades are just git pull. Rollback is switching the symlink back.
Want to restore your old config?
rm ~/.opencode
mv ~/.opencode.backup ~/.opencodeNative Windows is not yet supported. Windows users can run PAI-OpenCode through WSL2 (Windows Subsystem for Linux).
PAI-OpenCode uses Unix-style paths and tools that don't work natively on Windows. WSL2 provides a full Linux environment where everything works out of the box.
Open PowerShell as Administrator:
wsl --installRestart your computer when prompted. On first boot, create your Linux username and password.
Open your WSL terminal (search "Ubuntu" in Start menu):
# Update packages
sudo apt update && sudo apt upgrade -y
# Install Git
sudo apt install git -y
# Install Bun (1.3.9+ required)
curl -fsSL https://bun.sh/install | bash
source ~/.bashrc
# Verify Bun version
bun --version # Should show 1.3.9 or higherImportant: Clone inside the WSL filesystem, NOT in /mnt/c/
# Navigate to your WSL home directory
cd ~
# Clone the repository
git clone https://github.com/Steffen025/pai-opencode.git
cd pai-opencode
# Run the installer
bash PAI-Install/install.sh
# Start OpenCode
opencodeYour WSL files are accessible from Windows Explorer at:
\\wsl$\Ubuntu\home\<your-username>\pai-opencode
Or open Explorer from WSL:
explorer.exe .- VS Code: Install the "WSL" extension to edit files directly in WSL
- Terminal: Windows Terminal provides a better WSL experience than the default
- Performance: Files in WSL filesystem (
~/) are faster than/mnt/c/
After installation, see ADVANCED-SETUP.md for:
- Custom provider configuration (beyond the 4 presets)
- Multi-provider research setup
- Voice server configuration
- Observability dashboard
- Custom agent creation
If you prefer to run the headless installer directly:
Step 1: Install vanilla OpenCode from opencode.ai
curl -fsSL https://opencode.ai/install | bashNote
Bun 1.3.9+ is required only for PAI-OpenCode's tooling (installer, plugins, skills, MCP servers) — not to compile OpenCode itself. PAI-OpenCode v3.0+ ships against the vanilla opencode.ai binary. Verify with bun --version and update with bun upgrade if needed.
Step 2: Clone the PAI-OpenCode repository
git clone https://github.com/Steffen025/pai-opencode.git
cd pai-opencodeStep 3: Install dependencies
bun installStep 4: Create symlink to connect OpenCode with PAI
# Remove the empty .opencode folder that OpenCode created (if any)
rm -rf ~/.opencode
# Create symlink from your home directory to your PAI-OpenCode installation
ln -s $(pwd)/.opencode ~/.opencodeStep 5: Launch OpenCode
opencodeIf you already have a PAI installation on Claude Code, see our Migration Guide for step-by-step instructions on transferring your skills, agents, and memory.
After installation, verify everything works:
-
Check Skills Loading
- On first message, PAI skill auto-loads (tier: always)
- Ask: "What skills do I have?"
-
Test an Agent
@Intern hello -
Verify Plugins
- Check:
tail -f /tmp/pai-opencode-debug.log - Should show: "PAI-OpenCode Plugin Loaded"
- Check:
The installer builds/installs OpenCode depending on your selected preset and platform.
Check where it was installed:
which opencode
ls -la ~/.local/bin/opencode
ls -la /usr/local/bin/opencodeIf ~/.local/bin is not in your PATH, add it:
export PATH="$HOME/.local/bin:$PATH"Make it permanent (add to your shell config):
# For bash users:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# For zsh users:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcAlternatively, use the full path:
~/.local/bin/opencodeRestart your terminal after installing Bun, or manually source:
source ~/.bashrc # or ~/.zshrcCheck .opencode/skills/ directory exists and contains SKILL.md files:
ls -la .opencode/skills/*/SKILL.mdCheck debug log for errors:
cat /tmp/pai-opencode-debug.logEdit .opencode/settings.json:
{
"env": {
"ENGINEER_NAME": "YourName",
"TIME_ZONE": "Europe/Berlin",
"DA": "YourAssistantName"
}
}PAI-OpenCode ships with OpenCode Zen free as the default provider. Big Pickle — Zen's free flagship model — works out of the box with no API key or account required. Just install and start.
Provider setup is a post-install step — PAI-OpenCode ships with Zen free so you can start immediately, then connect additional providers whenever you're ready.
Connecting a provider is a two-step process:
Run /connect inside a running OpenCode session and follow the prompts:
/connect
OpenCode stores credentials securely in ~/.opencode/. Supported providers:
| Provider | Best For | Cost |
|---|---|---|
| Zen paid | Budget-friendly paid models (GLM 4.7, Kimi K2.5, Gemini Flash) | ~$1-15/1M tokens |
| Anthropic (API key) | Best quality, Claude Opus 4.6 / Sonnet 4.5 | Pay-per-token |
| OpenRouter | Provider diversity, 100+ models | Varies by model |
| OpenAI | GPT-4o, GPT-4.1 | ~$10-30/1M tokens |
| Ollama | Local, private, offline | Free (your hardware) |
/connect stores your credentials, but the agent model strings in opencode.json still point to the Zen free defaults. Switch them to your newly connected provider:
# Switch all agents to Anthropic models
bun run .opencode/tools/switch-provider.ts anthropic
# Switch to paid Zen models
bun run .opencode/tools/switch-provider.ts zen-paid
# Switch to OpenAI models
bun run .opencode/tools/switch-provider.ts openai
# List all available profiles
bun run .opencode/tools/switch-provider.ts --listSee ADVANCED-SETUP.md for manual opencode.json editing and custom profiles.
Anthropic's Claude Max subscription (the one used at claude.ai) is designed for direct human use. Routing it through a third-party tool like OpenCode via OAuth is a grey area in Anthropic's Terms of Service and carries a risk of account suspension.
How the connection works technically:
OpenCode connects to Claude Max via a community plugin — cemalturkcan/opencode-anthropic-login-via-cli — that authenticates your Claude Max account and proxies requests through it.
Why PAI-OpenCode does not ship this plugin: We intentionally exclude it from the distribution. Installing and using it is your own decision and responsibility — we do not want to expose users to ToS risk without their explicit informed consent.
Alternatives that are clearly within Anthropic's ToS:
- Anthropic API key — Pay-per-token access via console.anthropic.com. Add
ANTHROPIC_API_KEY=sk-ant-...to~/.opencode/.envand run/connect→ Anthropic. - OpenCode Zen paid — High-quality models at competitive rates, no ToS concerns. Includes access to models equivalent in capability to Sonnet/Opus tiers.
# Re-run the installer in headless mode to reconfigure a specific preset
bash PAI-Install/install.sh --headless --preset openai --name "Your Name" --ai-name "Jeremy"For custom provider configuration, see ADVANCED-SETUP.md.
For richer research results from diverse AI perspectives:
bun run .opencode/tools/switch-provider.ts --add-researchersThis adds research agents to your configuration. Requires additional API keys in ~/.opencode/.env:
GOOGLE_API_KEY=your_key # GeminiResearcher
XAI_API_KEY=your_key # GrokResearcher
PERPLEXITY_API_KEY=your_key # PerplexityResearcher
OPENROUTER_API_KEY=your_key # CodexResearcherCheck which keys you have:
bun run .opencode/tools/switch-provider.ts --researchers| Provider | Where to Get Key | For |
|---|---|---|
| Anthropic | https://console.anthropic.com/ | Claude models |
| https://aistudio.google.com/apikey | GeminiResearcher | |
| xAI | https://console.x.ai/ | GrokResearcher |
| Perplexity | https://perplexity.ai/settings/api | PerplexityResearcher |
| OpenRouter | https://openrouter.ai/keys | CodexResearcher |
Enable spoken notifications for task completions and agent results:
# Start the voice server
cd .opencode/voice-server
bun run server.tsSupported TTS Providers:
- ElevenLabs (default) - High-quality voices, requires API key
- Google Cloud TTS - Alternative, requires API key
- macOS
say- Free fallback, built-in
Configure in .opencode/.env:
TTS_PROVIDER=elevenlabs
ELEVENLABS_API_KEY=your_key_hereSee .opencode/voice-server/README.md for details.
Monitor sessions, tools, and agents in real-time:
# Start the observability server
cd .opencode/observability-server
bun run server.tsDashboard available at http://localhost:8889
Features:
- Real-time event streaming via SSE
- Session lifecycle tracking
- Tool usage analytics
- Agent spawn monitoring
- Vue 3 dashboard with GitHub Dark theme
See .opencode/observability-server/README.md for details.
- Read docs/WHAT-IS-PAI.md for PAI fundamentals
- Explore docs/OPENCODE-FEATURES.md for OpenCode features
- See ADVANCED-SETUP.md for custom configuration
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Installed successfully? Give us a star on GitHub!
