← Blog

November 13, 2026 · guides · coding agents · integrations

How to add an uncensored model provider to OpenCode

Add OpenUncensored to OpenCode as an OpenAI compatible provider in one opencode.json block, pick a model that works in agents, and avoid the daemon environment gotcha.

OpenCode can use any OpenAI compatible provider, so adding uncensored models takes one block of config. With OpenUncensored as the provider you get 61 uncensored, abliterated and heretic models behind one key, and you can switch between them per run.

Buy a prepaid key at openuncensored.com/credits: no account, no sign up, just a card and a key (ou-...). Or hand your agent openuncensored.com/agents.md and let it get one for you.

Add the provider

In opencode.json in your project, or ~/.config/opencode/opencode.json for every project (OpenCode 2):

{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "openuncensored": {
      "name": "OpenUncensored",
      "env": ["OPENUNCENSORED_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "https://api.openuncensored.com/v1" },
      "models": {
        "deepseek-v4.1-flash-1017-uncensored": { "name": "DeepSeek V4.1 Flash 1017 Uncensored" },
        "glm-5.3-flash-uncensored": { "name": "GLM 5.3 Flash Uncensored" },
        "qwen3.8-27b-uncensored-fast": { "name": "Qwen 3.8 27B Uncensored Fast by Heabsy" }
      }
    }
  }
}

Then:

export OPENUNCENSORED_API_KEY=ou-...
opencode run -m openuncensored/deepseek-v4.1-flash-1017-uncensored "Explain this repository"

Add any model id from the models page to the models block the same way. To see every id from the command line:

curl -s https://api.openuncensored.com/v1/models | jq -r '.data[].id'

Check the key before you start

curl https://api.openuncensored.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENUNCENSORED_API_KEY" -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-1017-uncensored", "messages": [{"role": "user", "content": "Say ok"}]}'

If this works and OpenCode does not, the problem is in the config or the environment OpenCode runs in.

Gotchas

  • The background daemon does not see your shell. opencode serve started as a service does not read variables you exported later. Put the key where the daemon reads it, or test with opencode run --standalone.
  • Older OpenCode versions use a provider block with npm: "@ai-sdk/openai-compatible" and options.baseURL. The base URL and model ids are the same.
  • Model names are prefixed with the provider key: openuncensored/<model id>.

Which model to pick

These are the strongest uncensored models on our tests right now, including five multi-step agent tasks:

Rank Model id Agent tasks Answers edgy requests $ per 1M in + out
#1 DeepSeek V4.1 Flash 1017 Uncensored deepseek-v4.1-flash-1017-uncensored 2/5 100% $1.65
#2 GLM 5.3 Flash Uncensored glm-5.3-flash-uncensored 3/5 94% $0.620
#3 Qwen 3.8 27B Uncensored Fast by Heabsy qwen3.8-27b-uncensored-fast 2/5 100% $3.45
#4 DeepSeek V4.1 Flash 0910 Uncensored deepseek-v4.1-flash-0910-uncensored 2/5 97% $1.65
#5 DeepSeek V4.1 Flash Uncensored deepseek-v4.1-flash-uncensored 1/5 100% $0.570

For long agent sessions, favour the agent column: a model that loops burns tokens without progress. The best agents right now:

Model id Agent tasks Loops $ per 1M in + out
Apex Flash 1 Abliterated glm-5.3-flash-apex-abliterated 3/5 0% $0.650
GLM 5.3 Flash Uncensored glm-5.3-flash-uncensored 3/5 40% $0.620
Gemma 4 31B Gembrain Uncensored Heretic gemma-4-31b-gembrain-uncensored-heretic 3/5 40% $0.612
DeepSeek V4.1 Flash 1017 Uncensored deepseek-v4.1-flash-1017-uncensored 2/5 0% $1.65

What it costs in an agent

OpenCode resends the conversation at every step, so cached input dominates the bill. Each model page lists every provider's cached price, and you can set your key to route by lowest cost on the credits page. A prepaid key cannot spend more than you loaded.

Errors you may see

Status Code What it means What to do
401 invalid_api_key Missing or wrong key Send Authorization: Bearer ou-...
402 insufficient_quota The key's credit is used up Top up the same key at /credits
404 model_not_found No model with that id Copy the id from /models or GET https://api.openuncensored.com/v1/models
400 invalid_routing_options only/ignore exclude every provider, or an unknown strategy Loosen the routing block
4xx upstream_rejected_request The provider rejected the request itself Read the message: usually a parameter that model does not support
429 rate_limit_exceeded Every provider for the model is rate limited Retry after the Retry-After header
502 all_providers_failed Every provider was tried and failed Retry, or pick another model

The full table is on the rankings page. The same setup works for Codex and Claude Code: guide.