1.0.6 • Published yesterday
@monotykamary/pi-opencode-provider
Licence
MIT
Version
1.0.6
Deps
0
Size
61 kB
Vulns
0
Weekly
0
pi-opencode-provider
46+ models via opencode
GPT, Claude, Gemini, GLM, MiniMax, Kimi, DeepSeek — unified API for pi.
Features
- 60+ AI Models including GPT-5.x Codex, Claude Opus/Sonnet/Haiku, Gemini 3.x, GLM, MiniMax, Kimi K2.5, and more
- Multi-API Support — uses the correct API protocol per model (Anthropic, OpenAI Responses, OpenAI Completions, Gemini)
- Cost Tracking with per-model pricing for budget management
- Reasoning Models with thinking level maps for proper effort control
- Vision Support for image-capable models
Installation
Option 1: Using pi install (Recommended)
Install from npm:
pi install @monotykamary/pi-opencode-provider
Or directly from GitHub:
pi install https://github.com/monotykamary/pi-opencode-provider
Then set your API key and run pi:
# Recommended: add to auth.json
# See Authentication section below
# Or set as environment variable
export OPENCODE_API_KEY=your-api-key-here
pi
Option 2: Manual Clone
Clone this repository:
git clone https://github.com/monotykamary/pi-opencode-provider.git cd pi-opencode-providerSet your opencode API key:
# Recommended: add to auth.json # See Authentication section below # Or set as environment variable export OPENCODE_API_KEY=your-api-key-hereRun pi with the extension:
pi -e /path/to/pi-opencode-provider
Available Models
| Model | API | Type | Context | Max Tokens | Input Cost | Output Cost |
|---|---|---|---|---|---|---|
| Big Pickle | Completions | Text | 200K | 32K | Free | Free |
| Claude Fable 5 | Anthropic | Text + Image | 1.0M | 128K | $10.00 | $50.00 |
| Claude Haiku 4.5 | Anthropic | Text + Image | 200K | 64K | $1.00 | $5.00 |
| Claude Opus 4.1 | Anthropic | Text + Image | 200K | 32K | $15.00 | $75.00 |
| Claude Opus 4.5 | Anthropic | Text + Image | 200K | 64K | $5.00 | $25.00 |
| Claude Opus 4.6 | Anthropic | Text + Image | 1.0M | 128K | $5.00 | $25.00 |
| Claude Opus 4.7 | Anthropic | Text + Image | 1.0M | 128K | $5.00 | $25.00 |
| Claude Opus 4.8 | Anthropic | Text + Image | 1.0M | 128K | $5.00 | $25.00 |
| Claude Opus 5 | Anthropic | Text + Image | 1.0M | 128K | $5.00 | $25.00 |
| Claude Sonnet 4 | Anthropic | Text + Image | 1.0M | 64K | $3.00 | $15.00 |
| Claude Sonnet 4.5 | Anthropic | Text + Image | 1.0M | 64K | $3.00 | $15.00 |
| Claude Sonnet 4.6 | Anthropic | Text + Image | 1.0M | 64K | $3.00 | $15.00 |
| Claude Sonnet 5 | Anthropic | Text + Image | 1.0M | 128K | $2.00 | $10.00 |
| DeepSeek V4 Flash | Completions | Text | 1.0M | 384K | $0.14 | $0.28 |
| DeepSeek V4 Flash Free | Completions | Text | 200K | 128K | Free | Free |
| DeepSeek V4 Pro | Completions | Text | 1.0M | 384K | $1.74 | $3.84 |
| Gemini 3 Flash | Gemini | Text + Image | 1.0M | 66K | $0.50 | $3.00 |
| Gemini 3.1 Pro Preview | Gemini | Text + Image | 1.0M | 66K | $2.00 | $12.00 |
| Gemini 3.5 Flash | Gemini | Text + Image | 1.0M | 66K | $1.50 | $9.00 |
| Gemini 3.5 Flash Lite | Gemini | Text + Image | 1.0M | 66K | $0.30 | $2.50 |
| Gemini 3.6 Flash | Gemini | Text + Image | 1.0M | 66K | $1.50 | $7.50 |
| GLM-5 | Completions | Text | 205K | 131K | $1.00 | $3.20 |
| GLM-5.1 | Completions | Text | 205K | 131K | $1.40 | $4.40 |
| GLM-5.2 | Completions | Text | 1.0M | 131K | $1.40 | $4.40 |
| GPT-5 | Responses | Text + Image | 400K | 128K | $1.07 | $8.50 |
| GPT-5 Codex | Responses | Text + Image | 400K | 128K | $1.07 | $8.50 |
| GPT-5 Nano | Responses | Text + Image | 400K | 128K | $0.05 | $0.40 |
| GPT-5.1 | Responses | Text + Image | 400K | 128K | $1.07 | $8.50 |
| GPT-5.1 Codex | Responses | Text + Image | 400K | 128K | $1.07 | $8.50 |
| GPT-5.1 Codex Max | Responses | Text + Image | 400K | 128K | $1.25 | $10.00 |
| GPT-5.1 Codex Mini | Responses | Text + Image | 400K | 128K | $0.25 | $2.00 |
| GPT-5.2 | Responses | Text + Image | 400K | 128K | $1.75 | $14.00 |
| GPT-5.2 Codex | Responses | Text + Image | 400K | 128K | $1.75 | $14.00 |
| GPT-5.3 Codex | Responses | Text + Image | 400K | 128K | $1.75 | $14.00 |
| GPT-5.3 Codex Spark | Responses | Text | 128K | 128K | $1.75 | $14.00 |
| GPT-5.4 | Responses | Text + Image | 1.1M | 128K | $2.50 | $15.00 |
| GPT-5.4 Mini | Responses | Text + Image | 400K | 128K | $0.75 | $4.50 |
| GPT-5.4 Nano | Responses | Text + Image | 400K | 128K | $0.20 | $1.25 |
| GPT-5.4 Pro | Responses | Text + Image | 1.1M | 128K | $30.00 | $180.00 |
| GPT-5.5 | Responses | Text + Image | 1.1M | 128K | $5.00 | $30.00 |
| GPT-5.5 Pro | Responses | Text + Image | 1.1M | 128K | $30.00 | $180.00 |
| GPT-5.6 Luna | Responses | Text + Image | 1.1M | 128K | $1.00 | $6.00 |
| GPT-5.6 Sol | Responses | Text + Image | 1.1M | 128K | $5.00 | $30.00 |
| GPT-5.6 Terra | Responses | Text + Image | 1.1M | 128K | $2.50 | $15.00 |
| Grok 4.5 | Responses | Text + Image | 500K | 500K | $2.00 | $6.00 |
| Grok Build 0.1 | Completions | Text + Image | 256K | 256K | $1.00 | $2.00 |
| Kimi K2.5 | Completions | Text + Image | 262K | 66K | $0.60 | $3.00 |
| Kimi K2.6 | Completions | Text + Image | 262K | 66K | $0.95 | $4.00 |
| Kimi K2.7 Code | Completions | Text + Image | 262K | 262K | $0.95 | $4.00 |
| Kimi K3 | Completions | Text + Image | 1.0M | 131K | $3.00 | $15.00 |
| Laguna S 2.1 Free | Completions | Text | 256K | 32K | Free | Free |
| Ling-3.0-flash Free | Completions | Text | 262K | 33K | Free | Free |
| MiMo V2.5 Free | Completions | Text + Image | 200K | 32K | Free | Free |
| MiniMax-M2.5 | Completions | Text | 205K | 131K | $0.30 | $1.20 |
| MiniMax-M2.7 | Completions | Text | 205K | 131K | $0.30 | $1.20 |
| MiniMax-M3 | Completions | Text + Image | 512K | 128K | $0.30 | $1.20 |
| Nemotron 3 Ultra Free | Completions | Text | 1.0M | 128K | Free | Free |
| North Mini Code Free | Completions | Text | 256K | 64K | Free | Free |
| Qwen3.5 Plus | Anthropic | Text + Image | 262K | 66K | $0.20 | $1.20 |
| Qwen3.6 Plus | Anthropic | Text + Image | 262K | 66K | $0.50 | $3.00 |
| Costs are per million tokens. Prices subject to change - check opencode.ai for current pricing. |
Usage
After loading the extension, use the /model command in pi to select your preferred model:
/model
Then select "opencode" as the provider and choose from the available models.
The default model for this provider is kimi-k2.6 (matching pi core's built-in default); use /model to pick another.
Authentication
The opencode API key can be configured in multiple ways. Credentials are resolved in this order:
- CLI flag —
--api-key(highest priority, runtime override) auth.json(recommended) — Add to~/.pi/agent/auth.json:The{ "opencode": { "type": "api_key", "key": "your-api-key" } }keyfield supports literals,$ENV_VAR/${ENV_VAR}interpolation, and!commandexecution. See pi's providers docs for details.- Environment variable —
OPENCODE_API_KEY
Environment Variables
| Variable | Required | Description |
|---|---|---|
OPENCODE_API_KEY |
No | Your opencode.ai API key (fallback if not in auth.json) |
Configuration
Add to your pi configuration for automatic loading:
{
"extensions": [
"/path/to/pi-opencode-provider"
]
}
License
MIT