Guide

Use an uncensored model in Qwen Code

Qwen Code connects to unrestricted.sh through its OpenAI-compatible provider, and one command sets it up. You get Qwen3.8 27B Uncensored, MiMo V2.6 Flash Uncensored, GLM-5.3 Flash Uncensored and DeepSeek V4.1 Flash 1017 Uncensored for coding and chat, with up to 1M context, from $0.35 per million input tokens.

Get an API key

Sign up and go: your $0.50 of welcome credit works on the API right away, no top-up needed. A first top-up of $10 or more adds $5 of bonus credit.

Connect Qwen Code

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

Or with npm: npx unrestricted

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 Qwen Code settings to ~/.qwen/settings.json, leaving the rest of that file as it was. It needs Node 18 or newer, and the macOS/Linux command also needs curl.

Already have a key? Set UNRESTRICTED_API_KEY to it first and the browser step is skipped. Put UNRESTRICTED_TOOLS=qwen-code in front of the command to set up only Qwen Code.

Or set it up by hand

Merge this into ~/.qwen/settings.json. Qwen Code reads the key from UNRESTRICTED_API_KEY, so set it in the shell that starts Qwen Code.

json
{
  "modelProviders": {
    "unrestricted": [
      {
        "id": "qwen3.8-27b-uncensored",
        "name": "Qwen3.8 27B Uncensored",
        "description": "unrestricted.sh",
        "envKey": "UNRESTRICTED_API_KEY",
        "baseUrl": "https://api.unrestricted.sh/v1",
        "generationConfig": {
          "contextWindowSize": 262144,
          "samplingParams": {
            "max_tokens": 32768
          }
        }
      },
      {
        "id": "mimo-v2.6-flash-uncensored",
        "name": "MiMo V2.6 Flash Uncensored",
        "description": "unrestricted.sh",
        "envKey": "UNRESTRICTED_API_KEY",
        "baseUrl": "https://api.unrestricted.sh/v1",
        "generationConfig": {
          "contextWindowSize": 1048576,
          "samplingParams": {
            "max_tokens": 65536
          }
        }
      },
      {
        "id": "glm-5.3-flash-uncensored",
        "name": "GLM-5.3 Flash Uncensored",
        "description": "unrestricted.sh",
        "envKey": "UNRESTRICTED_API_KEY",
        "baseUrl": "https://api.unrestricted.sh/v1",
        "generationConfig": {
          "contextWindowSize": 1048576,
          "samplingParams": {
            "max_tokens": 32768
          }
        }
      },
      {
        "id": "deepseek-v4.1-flash-uncensored",
        "name": "DeepSeek V4.1 Flash 1017 Uncensored",
        "description": "unrestricted.sh",
        "envKey": "UNRESTRICTED_API_KEY",
        "baseUrl": "https://api.unrestricted.sh/v1",
        "generationConfig": {
          "contextWindowSize": 1048576,
          "samplingParams": {
            "max_tokens": 65536
          }
        }
      }
    ]
  },
  "providerProtocol": {
    "unrestricted": "openai"
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "model": {
    "name": "qwen3.8-27b-uncensored"
  }
}

Pick the model

Run qwen. The model setting starts it on Qwen3.8 27B Uncensored, and /model switches models.

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.0135. The pricing page has every price and more examples.

Next