OpenCode Integration Guide
Integrate WOX models with OpenCode
OpenCode Integration Guide
Integrate WOX models with OpenCode
Overview
This guide explains how to use the models currently available through WOX in OpenCode.
Once configured, you can use WOX models directly in OpenCode for code generation, project analysis, code changes, and multi-turn conversations.
This guide is based on OpenCode 1.15.13.
Prerequisites
Before configuring OpenCode, make sure you have:
- Registered for a WOX account
- Opened the WOX dashboard
- Created and copied an API Key
- A network connection that can reach the WOX API Gateway
| Setting | Value |
|---|---|
| Provider | WOX |
| Base URL | https://api.wox.lol/v1 |
| Model | YOUR_MODEL_ID |
| API Key | The API Key created in the WOX dashboard |
Enter only the API Key itself. Do not include Bearer.
Configure OpenCode CLI
When to use this method
Use this method if you run OpenCode CLI from a terminal.
If you already have an OpenCode configuration file, add the wox provider to the existing configuration and set the default model to:
"model": "wox/YOUR_MODEL_ID"Configuration File Example
Open the OpenCode configuration file and add the following configuration:
{
"$schema": "https://opencode.ai/config.json",
"model": "wox/YOUR_MODEL_ID",
"provider": {
"wox": {
"npm": "@ai-sdk/openai-compatible",
"name": "WOX",
"options": {
"baseURL": "https://api.wox.lol/v1",
"apiKey": "{env:WOX_API_KEY}"
},
"models": {
"YOUR_MODEL_ID": {
"name": "YOUR_MODEL_ID"
}
}
}
}
}If the file already contains other providers, do not replace the entire configuration. Add wox under provider and change model to wox/YOUR_MODEL_ID.
Configure the Environment Variable
Set the WOX API Key in your terminal:
export WOX_API_KEY="YOUR_WOX_API_KEY"To keep the variable across terminal sessions, add it to your shell configuration file:
echo 'export WOX_API_KEY="YOUR_WOX_API_KEY"' >> ~/.bashrc
source ~/.bashrcOn macOS or when using zsh, add it to:
echo 'export WOX_API_KEY="YOUR_WOX_API_KEY"' >> ~/.zshrc
source ~/.zshrcVerify the CLI Configuration
After starting OpenCode, enter:
/modelsIf the configuration is successful, you should see:
WOX
YOUR_MODEL_IDSelect WOX / YOUR_MODEL_ID to start using the WOX model.
Configure OpenCode Desktop
When to use this method
Use this method if you work in the OpenCode Desktop graphical interface.
Configuration Steps
Start OpenCode Desktop and click the settings button in the lower-left corner.
Find Custom Provider in the provider list and click Connect on the right.
Enter the WOX provider configuration shown below.
Provider Configuration
| Field | Value |
|---|---|
| Provider ID | wox |
| Display name | WOX |
| Base URL | https://api.wox.lol/v1 |
| API Key | Your WOX API Key |
| Model ID | YOUR_MODEL_ID |
| Model display name | YOUR_MODEL_ID |
Example configuration:
Provider ID: wox
Display name: WOX
Base URL: https://api.wox.lol/v1
API Key: sk-xxxxxxxx
Model ID: YOUR_MODEL_ID
Model display name: YOUR_MODEL_IDAfter entering the details, click Submit.
Verify the Desktop Configuration
After completing the configuration, return to the main OpenCode Desktop window.
From the model list, select:
WOX / YOUR_MODEL_IDSend a test message:
Hello, which model are you?If the model responds normally, the configuration is complete.
Troubleshooting
The WOX model does not appear
Check the following settings:
- Provider ID is
wox - Base URL is
https://api.wox.lol/v1 - Model ID is
YOUR_MODEL_ID - The API Key is correct
- The API Key does not include the
Bearerprefix
API Key error
Confirm that the API Key came from the WOX dashboard and does not contain extra spaces.
Correct example:
sk-xxxxxxxxxxxxxxxxIncorrect example:
Bearer sk-xxxxxxxxxxxxxxxxThe request fails or cannot connect
Check that:
- Your network can reach the WOX API Gateway
- The Base URL ends at
/v1 - You did not enter
/v1/chat/completions - The API Key is still valid
Correct Base URL:
https://api.wox.lol/v1Recommended Configuration
YOUR_MODEL_ID
https://api.wox.lol/v1
https://api.wox.lol/v1/chat/completions
| Use case | Recommended model |
|---|---|
| Everyday code generation | YOUR_MODEL_ID |
| Project analysis | YOUR_MODEL_ID |
| Code changes | YOUR_MODEL_ID |
| Multi-turn development conversations | YOUR_MODEL_ID |
Complete Configuration Reference
| Parameter | Value |
|---|---|
| Provider Name | WOX |
| Provider ID | wox |
| NPM Provider | @ai-sdk/openai-compatible |
| Base URL | https://api.wox.lol/v1 |
| API Key Env | WOX_API_KEY |
| Model ID | YOUR_MODEL_ID |
| OpenCode Model Path | wox/YOUR_MODEL_ID |