opencode
opencode copied to clipboard
feat: add custom provider support to GitHub Action
Summary
Ref: https://github.com/sst/opencode/issues/1489
This PR adds comprehensive custom provider support to the opencode GitHub Action, enabling users to configure custom providers such as LiteLLM with secure environment variable injection.
Key Features Added
-
Custom Config Files: Auto-discovery of
.github/opencode.json(primary),opencode.json, and.opencode/config.json -
Environment Variable Injection: Support for
config_envinput - Backward Compatibility: Existing workflows continue working unchanged
-
Provider Integration: Proper integration with opencode's
OPENCODE_CONFIGflag
New Action Inputs
| Input | Description | Required | Default |
|---|---|---|---|
model |
Model to use (overrides config file) | No | - |
opencode_config |
Path to opencode config file | No | Auto-discovery |
config_env |
Environment variables for config (multiline key=value format) | No | - |
share |
Share the opencode session | No | true for public repos |
Usage Examples
Basic custom provider:
- uses: sst/opencode/github@latest
env:
CUSTOM_API_KEY: ${{ secrets.CUSTOM_API_KEY }}
BASE_URL=https://api.example.com
# Automatically uses .github/opencode.json
{
"model": "custom-provider/my-model",
"provider": {
"custom-provider": {
"npm": "@ai-sdk/openai-compatible",
"models": {
"my-model": {
"name": "My Custom Model"
}
},
"options": {
"apiKey": "{env:CUSTOM_API_KEY}",
"baseURL": "{env:CUSTOM_BASE_URL}"
}
}
}
}
Technical Implementation
-
Environment Variable Parsing: Supports multiline key=value format for
config_env -
Config Discovery: Prioritizes
.github/opencode.jsonfor GitHub-specific configurations -
Integration: Uses
OPENCODE_CONFIGflag to properly integrate with opencode's config system
🤖 Generated with opencode