Configuring OpenCode
OpenCode is an open-source terminal-UI (TUI) coding agent that works with any OpenAI-compatible model backend. The recommended way to connect wylon is via a custom provider.
1. Install / upgrade
# Install (if not already installed)
curl -fsSL https://opencode.ai/install | bash
# Or upgrade an existing install to the latest version
opencode upgrade
2. Configure a custom provider
Edit the OpenCode config file ~/.config/opencode/opencode.json (create it if it doesn't exist) and add an OpenAI-compatible provider pointing at wylon:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"wylon": {
"npm": "@ai-sdk/openai-compatible",
"name": "wylon",
"options": {
"baseURL": "https://api.wylon.cn/v1"
},
"models": {
"moonshotai/Kimi-K2.6": { "name": "Kimi-K2.6" },
"deepseek-ai/DeepSeek-V4-Flash": { "name": "DeepSeek-V4-Flash" }
}
}
}
}
3. Provide the API Key
Set your wylon API Key as an environment variable (recommended); OpenCode reads it when calling the custom provider:
export WYLON_API_KEY=<your_wylon_API_Key>
Alternatively, after launching OpenCode you can run the /connect command, select the wylon provider, and paste your key.
4. Launch and select a model
opencode
In the UI, switch models (e.g. type /models) and pick a model under wylon, such as Kimi-K2.6, to get started.