docs: add OpenCode CLI integration guide (#169)

- Added OpenCode section to README.md CLI Integration with step-by-step instructions
- Uses @ai-sdk/openai-compatible adapter with custom opencode.json config
- Includes example models and baseURL configuration
- Closes #169
This commit is contained in:
diegosouzapw
2026-03-01 22:59:10 -03:00
parent b7a6c563ac
commit 7820145cbe

View File

@@ -1095,6 +1095,47 @@ Settings → API Configuration:
Model: if/kimi-k2-thinking
```
### OpenCode
**Step 1:** Add OmniRoute as a custom provider:
```bash
opencode
/connect
# Select "Other" → Enter ID: "omniroute" → Enter your OmniRoute API key
```
**Step 2:** Create/edit `opencode.json` in your project root:
```json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"omniroute": {
"npm": "@ai-sdk/openai-compatible",
"name": "OmniRoute",
"options": {
"baseURL": "http://localhost:20128/v1"
},
"models": {
"cc/claude-sonnet-4-20250514": { "name": "Claude Sonnet 4" },
"gg/gemini-2.5-pro": { "name": "Gemini 2.5 Pro" },
"if/kimi-k2-thinking": { "name": "Kimi K2 (Free)" }
}
}
}
}
```
**Step 3:** Select the model in OpenCode:
```bash
/models
# Select any OmniRoute model from the list
```
> **Tip:** Add any model available in your OmniRoute `/v1/models` endpoint to the `models` section. Use the format `provider/model-id` from your OmniRoute dashboard.
</details>
---