WOX AI

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:

  1. Registered for a WOX account
  2. Opened the WOX dashboard
  3. Created and copied an API Key
  4. A network connection that can reach the WOX API Gateway
SettingValue
ProviderWOX
Base URLhttps://api.wox.lol/v1
ModelYOUR_MODEL_ID
API KeyThe 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 ~/.bashrc

On macOS or when using zsh, add it to:

echo 'export WOX_API_KEY="YOUR_WOX_API_KEY"' >> ~/.zshrc
source ~/.zshrc

Verify the CLI Configuration

After starting OpenCode, enter:

/models

If the configuration is successful, you should see:

WOX
YOUR_MODEL_ID

Select 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

FieldValue
Provider IDwox
Display nameWOX
Base URLhttps://api.wox.lol/v1
API KeyYour WOX API Key
Model IDYOUR_MODEL_ID
Model display nameYOUR_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_ID

After 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_ID

Send 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:

  1. Provider ID is wox
  2. Base URL is https://api.wox.lol/v1
  3. Model ID is YOUR_MODEL_ID
  4. The API Key is correct
  5. The API Key does not include the Bearer prefix

API Key error

Confirm that the API Key came from the WOX dashboard and does not contain extra spaces.

Correct example:

sk-xxxxxxxxxxxxxxxx

Incorrect example:

Bearer sk-xxxxxxxxxxxxxxxx

The request fails or cannot connect

Check that:

  1. Your network can reach the WOX API Gateway
  2. The Base URL ends at /v1
  3. You did not enter /v1/chat/completions
  4. The API Key is still valid

Correct Base URL:

https://api.wox.lol/v1

YOUR_MODEL_ID https://api.wox.lol/v1 https://api.wox.lol/v1/chat/completions
Use caseRecommended model
Everyday code generationYOUR_MODEL_ID
Project analysisYOUR_MODEL_ID
Code changesYOUR_MODEL_ID
Multi-turn development conversationsYOUR_MODEL_ID

Complete Configuration Reference

ParameterValue
Provider NameWOX
Provider IDwox
NPM Provider@ai-sdk/openai-compatible
Base URLhttps://api.wox.lol/v1
API Key EnvWOX_API_KEY
Model IDYOUR_MODEL_ID
OpenCode Model Pathwox/YOUR_MODEL_ID