Guide

Use an uncensored model in OpenCode

OpenCode connects to unrestricted.sh through its OpenAI-compatible provider, and one command sets it up. You get Qwen3.8 27B Uncensored, a model for coding and chat with 262K context, at $1.00 per million input tokens.

Get an API key

Sign up, then add credit: API keys work after your first top-up of $5 or more. A first top-up of $10 or more adds $5 of bonus credit.

Connect OpenCode

sh
sh -c "$(curl -fsSL https://unrestricted.sh/setup.sh)"

Run it in a terminal and approve the connection in your browser. It creates an API key for this machine, asks which tools to set up, and writes the OpenCode settings to ~/.config/opencode/opencode.json, leaving the rest of that file as it was. It needs curl and Node 18 or newer.

Already have a key? Set UNRESTRICTED_API_KEY to it first and the browser step is skipped. Put UNRESTRICTED_TOOLS=opencode in front of the command to set up only OpenCode.

Or set it up by hand

Merge this into ~/.config/opencode/opencode.json. OpenCode reads the key from UNRESTRICTED_API_KEY when it starts.

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "unrestricted": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "unrestricted.sh",
      "options": {
        "baseURL": "https://api.unrestricted.sh/v1",
        "apiKey": "{env:UNRESTRICTED_API_KEY}"
      },
      "models": {
        "qwen3.8-27b-uncensored": {
          "name": "Qwen3.8 27B Uncensored",
          "limit": {
            "context": 262144,
            "output": 32768
          }
        }
      }
    }
  },
  "model": "unrestricted/qwen3.8-27b-uncensored"
}

Pick the model

The model line makes Qwen3.8 27B Uncensored the default. To switch to it from another model, run /models in OpenCode and pick Qwen3.8 27B Uncensored.

If something goes wrong

401 invalid_api_key
Missing or revoked API key.
402 insufficient_funds
Out of funds.
403 api_locked
Add funds once to unlock API keys.
429 concurrent_request_limit
Too many requests running on this account.

Every error the API returns is listed in the API reference.

What a session costs

Cached input: when your tool resends the start of a conversation, those tokens cost $0.10 per million instead of $1.00. Cached-input pricing applies to the API and coding tools; messages in the web chat pay the full input price.

A coding-agent turn with 60,000 tokens in, 55,000 of them cached, 1,500 out costs $0.015. The pricing page has every price and more examples.

Next