Use opencode with an uncensored LLM API
opencode is a terminal coding agent. It treats any OpenAI-compatible server as a custom provider that you declare in opencode.json, and it runs the request through the AI SDK's compatible package.
Set it up
- Sign in at wildwestapi.com/signup/ with the six-digit code sent to your email, open the dashboard and create an API key. It starts with sk-ww- and is shown in full once, so copy it somewhere safe.
- Start opencode and run /connect, scroll to Other, and enter a provider id such as wildwest.
- Paste your sk-ww- key when asked. opencode stores it in ~/.local/share/opencode/auth.json.
- Create opencode.json in your project root, or ~/.config/opencode/opencode.json for all projects.
- Add the provider block below, using the same id you gave /connect.
- Run /models and choose Outlaw 1, or set the model key to wildwest/outlaw-1.
opencode.json
For a /v1/chat/completions endpoint, the docs say to use the @ai-sdk/openai-compatible package. Models are declared in a map keyed by id.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"wildwest": {
"npm": "@ai-sdk/openai-compatible",
"name": "Wild West API",
"options": {
"baseURL": "https://wildwestapi.com/v1",
"apiKey": "{env:WILDWEST_API_KEY}"
},
"models": {
"outlaw-1": {
"name": "Outlaw 1",
"limit": { "context": 500000, "output": 8192 }
}
}
}
},
"model": "wildwest/outlaw-1"
}The {env:WILDWEST_API_KEY} form reads the variable at startup, so the key stays out of the file. Note that an unset variable becomes an empty string, not an error, so a 401 usually means the variable was not exported in the shell that launched opencode. Model keys have the form provider/model.
Choosing the npm package
The same docs say to use @ai-sdk/openai only for providers that serve /v1/responses. Wild West documents the Chat Completions and Messages paths, so keep @ai-sdk/openai-compatible.
Adding more models
Add one entry under models per id you want, for example glm-5.3-flash-outlaw as a cheaper choice for small edits. Set limit.context to the real window: 1M for most, 512K for qwen3.8-27b-outlaw. The output value is your own cap on reply length, not an API limit.
One limit to know
The provider id in /connect must match the key under provider in the config, or opencode will not find the credential. And the model picker shows only models you declared, so a new Wild West model will not appear until you add it.
FAQ
Do I have to run /connect?
Not if you put the key in options.apiKey, either directly or through the {env:} form. /connect stores it in an auth file instead.
Where do the global and project configs live?
Project: opencode.json at the repo root. Global: ~/.config/opencode/opencode.json. They merge, with later sources overriding conflicting keys.