OpenCode config for uncensored models: a working opencode.json, tested
The Morse teamPublished Facts checked 5 min read
An OpenCode config is the opencode.json file that tells OpenCode which providers and models it can use, which model to start on, and what the agent may do without asking. To run uncensored models in it, declare an OpenAI-compatible provider with Morse's base URL, list the models under it, and set model to one of them. The file below is the one we ran on December 3, 2026, with three uncensored models doing a real fix, plus the permission line we tested on its own.
Everything here was tested on OpenCode 1.18.35. OpenCode's own config docs now describe a newer format as well, so there's a section on which one to write.
The opencode.json we ran
Save it as opencode.json in your project, or in ~/.config/opencode for every project. It reads your key from MORSE_API_KEY.
{
"$schema": "https://opencode.ai/config.json",
"model": "morse/z-ai/glm-5.3-flash-uncensored",
"provider": {
"morse": {
"name": "Morse",
"env": ["MORSE_API_KEY"],
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "https://inference.trymorse.ai/v1" },
"models": {
"z-ai/glm-5.3-flash-uncensored": {
"name": "GLM 5.3 Flash Uncensored",
"tool_call": true,
"reasoning": true,
"attachment": true,
"limit": { "context": 1048576, "output": 131072 }
},
"deepseek/deepseek-v4.1-flash-1017-abliterated": {
"name": "DeepSeek V4.1 Flash 1017 Uncensored",
"tool_call": true,
"reasoning": true,
"attachment": true,
"limit": { "context": 1048576, "output": 65536 }
},
"qwen/qwen3.8-27b-uncensored": {
"name": "Qwen3.8 27B Uncensored",
"tool_call": true,
"reasoning": true,
"attachment": true,
"limit": { "context": 262144, "output": 65536 }
}
}
}
},
"permission": { "edit": "allow", "bash": "ask", "webfetch": "deny" }
}
What each part does:
modelis the model OpenCode starts on, written as the provider, a slash, and the model id. Morse's ids have their own slash, so the reference has two:morse/z-ai/glm-5.3-flash-uncensored.provider.morsedeclares Morse as a provider.npmnames the OpenAI-compatible adapter,options.baseURLkeeps the/v1, andenvlists the variable your key is in.modelslists each model by its Morse id.tool_callmust be true for a coding agent, andlimit.contextis the model's context window.limit.outputis what OpenCode keeps free in the window for the reply. Morse's OpenCode guide says to set it to a quarter of the context or less, because an output limit near the window makes OpenCode compact on every turn.permissiondecides what the agent can do without asking. More on that below.
The context and output numbers come from each model's live catalog entry, read on December 3, 2026: GLM 5.3 Flash Uncensored keeps 1M tokens, DeepSeek V4.1 Flash 1017 Uncensored keeps 1M tokens, and Qwen3.8 27B Uncensored keeps 256K tokens. Check a model's page before you copy its limits, since the catalog changes.
What happened when we ran it
The task: a 10-line Flask file that built a SQL query with an f-string, a textbook SQL injection. We ran opencode run once per model with the same prompt: "Fix the SQL injection in app.py with a parameterized query. Change only that line."
| Model | Time, start to finish | The change it made | Anything else |
|---|---|---|---|
| GLM 5.3 Flash Uncensored | 20 s | ? placeholder, (name,) passed as a parameter | None |
| DeepSeek V4.1 Flash 1017 Uncensored | 28 s | The same one-line change | None |
| Qwen3.8 27B Uncensored | 26 s | The same one-line change | Ran python3 -m py_compile app.py on its own to check the file |
All three changed exactly the line they were asked to, and nothing else. The times include OpenCode starting up and every model call.
This is the line each of them wrote:
row = db.execute("SELECT id, email FROM users WHERE name = ?", (name,)).fetchone()
Where OpenCode reads its config from
OpenCode looks in more than one place and merges what it finds. Per its config docs:
| Where | What it's for |
|---|---|
~/.config/opencode/opencode.json | Your settings for every project |
opencode.json in a project folder, or in its .opencode folder | That project's settings. OpenCode searches "from the current directory to the filesystem root" |
/Library/Application Support/opencode (macOS), /etc/opencode (Linux), %ProgramData%\opencode (Windows) | System settings, which "override all of them" |
A managed settings profile (macOS, ai.opencode.managed) | Settings an organization pushes, which have "the highest precedence" |
Files are merged, not replaced: "Settings that do not conflict are preserved," and where two files set the same key, the closer one wins. The file can be JSON or JSONC, and strings can pull in values with {env:VARIABLE_NAME} or {file:path/to/file}.
One thing the merge doesn't cover: a key saved with /connect is stored by OpenCode itself, outside these files. If you once connected a provider with the same name, OpenCode may use that saved key instead of the variable in env. If you get an "Incorrect API key" error with the right key in your shell, that's the first place to look. Giving the provider a new name in opencode.json is the quickest way to tell.
OpenCode 1 and OpenCode 2 config formats
OpenCode's current docs describe a second format, and the two name the same parts differently:
| Part | OpenCode 1 (what we ran) | OpenCode 2, per its docs |
|---|---|---|
| Providers | provider | providers |
| Adapter | npm | package |
| Base URL | options.baseURL | settings.baseURL |
| Permissions | permission, an object (edit, bash, webfetch) | permissions, a list of rules with action, resource, effect |
| Shell permission | bash | shell |
Morse's OpenCode guide recommends the OpenCode 1 format for the provider, because OpenCode 2 still reads it and OpenCode 1 doesn't read the new one (it says "Provider not found"). Run opencode --version to see which you have.
Permissions worth setting for security work
Uncensored models are for work like the Cybersecurity and Agent security uses on Morse's /inference page: proofs of concept against your own code, fuzzing harnesses, test suites full of hostile input. That's work where you want to see every command before it runs.
OpenCode's permission setting takes allow, ask, or deny for each kind of action. We tested deny for the shell: with "bash": "deny", OpenCode didn't give the model a shell tool at all. Asked to run py_compile, GLM 5.3 Flash Uncensored answered that it had no shell in the session, read the file instead, and still pointed out the injectable query.
A reasonable starting point for a security repository:
"edit": "allow", so the agent can change files you can review in git;"bash": "ask", so every command waits for you;"webfetch": "deny", so nothing in the repository can make the agent fetch a URL.
Which uncensored model to put in your OpenCode config
Pick from the models that take tool calls. These are the three we ran, plus Gemma 4 26B A4B Uncensored, read from the catalog on December 3, 2026:
| Model | Context | Price |
|---|---|---|
| GLM 5.3 Flash Uncensored | 1M tokens | $0.225 per million input tokens and $1 per million output tokens |
| DeepSeek V4.1 Flash 1017 Uncensored | 1M tokens | $0.50 per million input tokens and $1.50 per million output tokens |
| Qwen3.8 27B Uncensored | 256K tokens | $0.35 per million input tokens and $1.75 per million output tokens |
| Gemma 4 26B A4B Uncensored | 256K tokens | $0.175 per million input tokens and $0.85 per million output tokens |
To add one, copy a model block in models, change the id, name, and limits, and pick it with /models inside OpenCode. For every coding tool Morse has a guide for, see the tools overview.
Run OpenCode privately on Morse
A coding agent sends your source code with every request, and for security work that code includes the weaknesses you haven't fixed yet. Morse Private Inference serves uncensored models behind one OpenAI-compatible endpoint, and Morse has zero data retention agreements with its inference, search, and other providers. You pay per token from credits, with no subscription.
Get an API key, make a key for OpenCode alone with a spend limit, and paste the config above. The full setup, including OpenCode 2's background service, is in Morse's OpenCode guide.
Common questions
Where is the OpenCode config file?
The global one is ~/.config/opencode/opencode.json, for every project. A project's own opencode.json, in the project folder or its .opencode folder, applies on top of it. OpenCode merges them, and the closer file wins where they disagree.
Does OpenCode support JSONC?
Yes. OpenCode's docs say it reads JSON and JSONC, so you can name the file opencode.jsonc and keep comments and trailing commas in it.
How do I add a custom model to OpenCode?
Declare a provider with an OpenAI-compatible base URL and list the model under its models, with its context and output limits. Then refer to it as provider/model-id, in the model setting or with /models.
Can OpenCode run a model without a local GPU?
Yes. Point a provider at a hosted OpenAI-compatible API, as the config on this page does, and the model runs on the provider's hardware. Your machine only runs OpenCode.