Skip to content

OpenCode setup

Install from the official documentation. Set WUDI_API_KEY in the launching terminal and confirm your target model appears in the available-model list.

User configuration commonly lives at ~/.config/opencode/opencode.json; supported project configuration can also apply. Merge the provider without overwriting existing entries:

{
"$schema":"https://opencode.ai/config.json",
"provider":{
"wudi":{
"npm":"@ai-sdk/openai-compatible",
"name":"WuDi API",
"options":{
"baseURL":"https://wudiapi.com/v1",
"apiKey":"{env:WUDI_API_KEY}"
},
"models":{"gpt-5.6-sol":{"name":"GPT · WuDi API"}}
}
},
"model":"wudi/gpt-5.6-sol"
}

The wudi/ part of OpenCode’s model selection is a local provider prefix. The actual API model ID in this example is gpt-5.6-sol. Do not add the local prefix to the remote model ID.

Run opencode, use its model selector or /models, and open a new conversation. Verify plain text before testing tools. Restart the client if necessary after editing configuration.

Add more entries under models using exact available IDs. Declare image support, thinking options and context limits only after confirming them. A larger number in a config file does not increase a model’s actual limit.

For an unread key, check the launching process’s environment. For a missing model, check JSON syntax, file location and provider naming. When tools fail, compare a minimal request with the adapter’s actual format.

Switch back to the previous model or remove the added wudi entry to restore the original connection. Keep unrelated providers.

Reference: OpenCode providers.