---
title: "OpenCode custom provider for uncensored models"
canonical: https://unrestrictable.ai/guides/opencode
generated: 2026-11-16T02:57:36.708Z
source: https://unrestrictable.ai/guides/opencode
base_url: https://api.unrestrictable.ai/v1
---

# Uncensored models in OpenCode

A provider block in opencode.json: the OpenAI-compatible package, base URL, a key from an env var, uncensored ids. Switch with /models; agent-turn cost; fixes.

Steps checked November 2, 2026 · prices as of November 16, 2026

OpenCode adds a provider from one block in `opencode.json`: which package to load, where to send requests, which key to send and which model ids to offer. Write that block once and an uncensored build runs in your terminal, with tool calls for edits and shell commands. The same ids also work in [Cursor](https://unrestrictable.ai/guides/cursor) and, behind a router, in [Claude Code](https://unrestrictable.ai/guides/claude-code).

## What you need

OpenCode installed, a key from the [console](https://app.unrestrictable.ai/console), and a project folder. OpenCode merges two config files: `opencode.json` (or `opencode.jsonc`, which allows comments) in the project root, and a global one at `~/.config/opencode/opencode.json`. When both define the same key, the project file takes precedence. `OPENCODE_CONFIG` can point at a file anywhere else.

Inside the TUI, two commands come up below. `/connect` saves a key for a provider, with custom ones filed under **Other**. `/models` lists the providers and models your config declares, so you can switch between them.

## First reply

1. Create a key in the [console](https://app.unrestrictable.ai/console) and export it in the shell you will launch OpenCode from:

```bash
export UNRESTRICTABLE_API_KEY="sk-unr-live-…"
```

1. Put the provider block in the project’s `opencode.json`, or in the global file if every project should have it. The four ids under `models` are the ones OpenCode users call most here; any other id from the [models page](https://unrestrictable.ai/models) is added the same way. The display names come from the catalog:

```
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "unrestrictable": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Unrestrictable",
      "options": {
        "baseURL": "https://api.unrestrictable.ai/v1",
        "apiKey": "{env:UNRESTRICTABLE_API_KEY}"
      },
      "models": {
        "glm-5.3-uncensored": { "name": "GLM-5.3 Uncensored" },
        "glm-5.3-flash-uncensored": { "name": "GLM-5.3 Flash Uncensored" },
        "deepseek-v4.1-flash-abliterated": { "name": "DeepSeek V4.1 Flash Abliterated" },
        "deepseek-v4-pro-uncensored": { "name": "DeepSeek V4 Pro Uncensored" }
      }
    }
  },
  "model": "unrestrictable/glm-5.3-uncensored"
}
```

1. Launch `opencode` inside the project. The `model` line already picks `glm-5.3-uncensored`; to use a different id under **Unrestrictable** for this session, run `/models`.

Prefer not to leave the key in the environment? Run `/connect`, pick **Other**, type `unrestrictable` as the provider id and paste the key. OpenCode writes it to `~/.local/share/opencode/auth.json`. Keep the provider block as shown but drop the `apiKey` line, and make sure the id you typed into `/connect` equals the key under `provider`.

To try the models before you install anything, the [browser chat](https://unrestrictable.ai/chat) gives three free turns a day, no account needed.

## Each field, explained

- npm: @ai-sdk/openai-compatible the AI SDK package behind the provider; it talks to /v1/chat/completions, the path this API serves
- name: Unrestrictable how /models labels the provider
- options.baseURL: https://api.unrestrictable.ai/v1 the root of every request; the trailing /v1 is required
- options.apiKey: {env:UNRESTRICTABLE_API_KEY} the full sk-unr- key, read from that variable at launch; unset, it turns into an empty string
- models: id → { name } what the picker offers: each id spelled as the models page has it, plus a label to show
- model: unrestrictable/glm-5.3-uncensored the default, written as provider id / model id; small_model uses the same form for titles

## Which model

Through that package OpenCode speaks the OpenAI format, and all the builds on the models page answer it. Deep into a session, each turn resends the conversation, the files OpenCode has read and all the tool results so far, so input tokens make up most of the cost and the input price is the figure to compare. The right-hand column tells you whether a build returns tool calls, without which the agent cannot edit a file or run a command.

| Model | One agent turn | Tool calls |
| --- | --- | --- |
| [GLM-5.3 Uncensored](https://unrestrictable.ai/models/glm-5.3-uncensored) | $0.01 | [model page](https://unrestrictable.ai/models/glm-5.3-uncensored) |
| [GLM-5.3 Flash Uncensored](https://unrestrictable.ai/models/glm-5.3-flash-uncensored) | $0.0047 | [model page](https://unrestrictable.ai/models/glm-5.3-flash-uncensored) |
| [DeepSeek V4.1 Flash Abliterated](https://unrestrictable.ai/models/deepseek-v4.1-flash-abliterated) | $0.04 | [model page](https://unrestrictable.ai/models/deepseek-v4.1-flash-abliterated) |
| [DeepSeek V4 Pro Uncensored](https://unrestrictable.ai/models/deepseek-v4-pro-uncensored) | $0.04 | [model page](https://unrestrictable.ai/models/deepseek-v4-pro-uncensored) |
| [GLM-5.3 Abliterated](https://unrestrictable.ai/models/glm-5.3-abliterated) | $0.09 | [model page](https://unrestrictable.ai/models/glm-5.3-abliterated) |
| [GLM-5.3 Flash Code Uncensored](https://unrestrictable.ai/models/glm-5.3-flash-code-uncensored) | $0.25 | [model page](https://unrestrictable.ai/models/glm-5.3-flash-code-uncensored) |

One turn priced at 40,000 tokens in and 1,200 out, using the catalog prices of 2026-11-16. Tool-call support is what the catalog publishes; a blank sends you to the model page.

| Model | Build | Input $/M | Output $/M |
| --- | --- | --- | --- |
| [GLM-5.3 Uncensored](https://unrestrictable.ai/models/glm-5.3-uncensored) glm-5.3-uncensored | Uncensored | $0.282 | $0.846 |
| [GLM-5.3 Flash Uncensored](https://unrestrictable.ai/models/glm-5.3-flash-uncensored) glm-5.3-flash-uncensored | Uncensored | $0.1053 | $0.3685 |
| [DeepSeek V4.1 Flash Abliterated](https://unrestrictable.ai/models/deepseek-v4.1-flash-abliterated) deepseek-v4.1-flash-abliterated | Abliterated | $0.8488 | $1.6975 |
| [DeepSeek V4 Pro Uncensored](https://unrestrictable.ai/models/deepseek-v4-pro-uncensored) deepseek-v4-pro-uncensored | Uncensored | $0.97 | $1.94 |
| [GLM-5.3 Abliterated](https://unrestrictable.ai/models/glm-5.3-abliterated) glm-5.3-abliterated | Abliterated | $2.1825 | $4.365 |
| [GLM-5.3 Flash Code Uncensored](https://unrestrictable.ai/models/glm-5.3-flash-code-uncensored) glm-5.3-flash-code-uncensored | Uncensored | $6.00 | $6.00 |

Prices per million tokens, read from the live catalog on 2026-11-16.

For the code builds compared over a full working day, see [the uncensored coding AI guide](https://unrestrictable.ai/guides/uncensored-coding-ai).

## Prove it works

Ask the API which models the key may call. Every id under `models` must be in the list:

```bash
curl https://api.unrestrictable.ai/v1/models -H "Authorization: Bearer sk-unr-live-…"
```

Then send one request shaped like OpenCode’s. `-i` shows the headers: `x-uplink-request-id` identifies the request, and `x-uplink-charge` reports the cost in USD when the answer is not streamed.

```bash
curl -i https://api.unrestrictable.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-unr-live-…" \
  -H "Content-Type: application/json" \
  -d '{"model": "glm-5.3-uncensored", "messages": [{"role": "user", "content": "Reply with the single word ok."}]}'
```

Back in OpenCode, send a message with one of your ids selected. The console’s usage page lists the request with its tokens and its charge, and the user agent on that record names your OpenCode version.

## When it fails

- `401 invalid_api_key`: a wrong or revoked key, or `UNRESTRICTABLE_API_KEY` was missing from the shell that launched OpenCode, so `apiKey` arrived empty. Export it and relaunch, or paste the key again from the console.
- `404 model_not_found`: one of the ids under `models` does not exist on the models page. Compare the spelling with the page, and remember the id is the key of the entry, not its `name`.
- `402 insufficient_balance`: not enough balance for this request; top up in the console. `402 monthly_limit_reached`: the key has reached the monthly spending cap you gave it.
- `403 scope_denied`: this key may only call certain models, and the one you chose is outside that set.
- `429 rate_limited`: the key’s rate limit was hit. `retry-after` in the response says how long to wait.
- Requests that never arrive, or land on some path other than `/chat/completions`: the wrong package is loaded. OpenCode’s docs put `@ai-sdk/openai-compatible` on endpoints that serve `/v1/chat/completions`, which this one does, and `@ai-sdk/openai` on endpoints that serve `/v1/responses`. Leave `npm` on the first.
- `/models` does not list the provider after `/connect`: the id you typed into `/connect` is not the key under `provider` in the config. Make them identical.

## Questions

### Does OpenCode work with an OpenAI-compatible API?

It does: any endpoint that speaks the OpenAI chat completions format loads through the @ai-sdk/openai-compatible package once it has a baseURL and a key. This API is such an endpoint, which makes the block above the entire setup.

### What providers can OpenCode use?

A built-in catalog that /connect lists by name, plus custom entries for any other OpenAI-compatible API: a provider key in opencode.json naming the package, the base URL and the model ids. This guide walks the custom route.

### Which of these models accept the OpenAI format?

All of them. One key covers the whole models page, and each build there takes an OpenAI-format call to /v1/chat/completions, so the models map of the provider block accepts any id from that page, spelled the same way. See the models page.

### How is an OpenCode session billed?

Per token at each model’s price, out of a prepaid balance, with no subscription. The table above prices one agent-sized turn on every build at the live rate. In a long session that keeps repeating the same prefix, the cached input tokens bill at the model’s cached rate.

Every model above is on the [uncensored model list](https://unrestrictable.ai/models) with its live price per million tokens. [Per-token pricing](https://unrestrictable.ai/pricing) sets the whole catalog side by side, and the [family directory](https://unrestrictable.ai/uncensored) groups the builds by base model.

[Get a key](https://app.unrestrictable.ai/console) Prepaid from $10, no subscription.

## New models and price changes, once a month.

New uncensored builds with their prices, price moves, and what the daily model check found.
