@openpets/opencode-zen
v1.0.0
Published
Access OpenCode Zen's curated AI models through multiple API endpoints including chat completions, messages, responses, and model discovery
Maintainers
Readme
OpenCode Zen Pet Plugin
Comprehensive OpenCode Zen API integration for OpenCode. Access 24+ curated AI models through multiple API endpoints including chat completions, messages, responses, and model discovery.
Features
- Model Discovery: List all available OpenCode Zen models with metadata
- Multiple API Endpoints: Support for chat completions, messages, responses, and Gemini-specific endpoints
- Free Model Filtering: Easily identify and use free models
- Model Information: Get detailed information about specific models
- Read-Only Mode: Safe operation when write restrictions are needed
- Connection Testing: Verify API connectivity and configuration
Quick Start
1. Get Your API Token
- Go to OpenCode Zen Auth
- Sign in and add your billing details
- Copy your API key
2. Configure Environment
Create .env file in the plugin directory:
OPENCODE_ZEN_TOKEN=your_api_token_hereOr set the environment variable:
export OPENCODE_ZEN_TOKEN=your_api_token_here3. Test Connection
cd pets/opencode-zen
opencode run "test OpenCode Zen connection" --format json --print-logsAvailable Tools
Connection & Discovery
opencode-zen-test-connection- Test API connectivityopencode-zen-list-models- List available models (supports free-only filtering)opencode-zen-get-model-info- Get detailed information about a specific model
Content Generation
opencode-zen-chat-completion- OpenAI-compatible chat completionsopencode-zen-create-response- GPT-specific responses APIopencode-zen-create-message- Claude-compatible messages APIopencode-zen-generate-gemini- Google Gemini content generation
Model Categories
OpenAI Models (Responses API)
gpt-5.2,gpt-5.1,gpt-5.1-codex,gpt-5.1-codex-max,gpt-5.1-codex-mini,gpt-5,gpt-5-codex,gpt-5-nano
Anthropic Models (Messages API)
claude-sonnet-4.5,claude-sonnet-4,claude-haiku-4.5,claude-3-5-haiku,claude-opus-4.5,claude-opus-4.1
Google Models (Gemini API)
gemini-3-pro,gemini-3-flash
OpenAI-Compatible Models (Chat Completions)
glm-4.6,glm-4.7-free,kimi-k2,kimi-k2-thinking,qwen3-coder,grok-code,big-pickle
Free Models (Limited Time)
big-pickle,grok-code,glm-4.7,minimax-m2.1,gpt-5-nano
Usage Examples
List All Models
opencode run "list available OpenCode Zen models"List Only Free Models
opencode run "list only free models"Create Chat Completion
opencode run "create a chat completion using glm-4.7 model with messages: [role: user, content: Hello, how are you?]"Generate with Claude
opencode run "create a message using claude-sonnet-4-5 model with system: You are a helpful assistant and messages: [role: user, content: Explain quantum computing]"Use GPT Responses API
opencode run "create a response using gpt-5.1-codex model with input: Write a Python function to calculate factorial"Generate with Gemini
opencode run "generate content with gemini-3-pro with contents: [parts: [text: What is machine learning?]]"Get Model Information
opencode run "get details about claude-sonnet-4-5"Configuration Options
The plugin supports various parameters for content generation:
- temperature: Control randomness (0.0-2.0)
- maxTokens: Limit response length
- stream: Enable streaming responses
- topP: Nucleus sampling parameter
- system: System prompts (for compatible models)
- tools: Function calling (for supported models)
Read-Only Mode
The plugin respects OpenPets read-only mode settings:
# Enable read-only mode
pets read-only opencode-zen on
# Disable read-only mode
pets read-only opencode-zen off
# Check status
pets read-only --statusPricing
OpenCode Zen uses pay-as-you-go pricing. Rates per 1M tokens:
- Free Models: Big Pickle, Grok Code, GLM 4.7, MiniMax M2.1, GPT 5 Nano
- Budget Models: GLM 4.6 ($0.60 input), Kimi K2 ($0.40 input), Qwen3 Coder ($0.45 input)
- Premium Models: Claude Sonnet 4.5 ($3.00 input), GPT 5.2 ($1.75 input), Gemini 3 Pro ($2.00 input)
See the OpenCode Zen documentation for complete pricing details.
Development Scripts
# Build the plugin
npm run build
# Test connection
npm run test:connection
# List models
npm run test:models
# Test free models
npm run test:free
# Quick start demo
npm run quickstartTroubleshooting
Connection Issues
- Verify your
OPENCODE_ZEN_TOKENis set correctly - Check that you have added billing details to your OpenCode Zen account
- Ensure your token has sufficient credits
Model Not Found
- Use the
list-modelstool to see available model IDs - Check that you're using the correct model ID format
- Some models may be temporarily unavailable
Rate Limiting
- Free models may have rate limits during beta
- Premium models provide better performance and higher limits
- Consider upgrading your account for increased usage
Support
- Documentation: OpenCode Zen Docs
- Community: OpenCode Discord
- Issues: GitHub Issues
Privacy
All models are hosted in the US with zero-retention policies (except OpenAI and Anthropic APIs which retain requests for 30 days). Some free models may use data for improvement during their beta period.
Built with ❤️ for the OpenCode ecosystem
