Skip to content

How to use uncensored abliterated models with Qwen Code

A settings.json that runs Qwen Code on abliterated DeepSeek and GLM models through an OpenAI-compatible API. Tested on Qwen Code 0.29.1.

Published Updated 4 min read

Qwen Code can use any OpenAI-compatible API in place of its own models, so you can run it on an uncensored, abliterated model. We set up Qwen Code 0.29.1 against CommentLLM's abliterated DeepSeek V4.1 Flash model and gave it a real bug to fix. It took about 33 seconds from prompt to passing tests.

The short version: list the models under modelProviders.openai in ~/.qwen/settings.json with baseUrl set to https://api.commentllm.com/v1 and envKey set to COMMENTLLM_API_KEY, set security.auth.selectedType to openai, and set model.name to deepseek-v4.1-flash-abliterated.

How a coding agent connects to an abliterated model: the agent sends prompts to the CommentLLM API, which passes them to the model and returns its tool calls

What you need

  • Qwen Code. We used version 0.29.1, installed with npm install -g @qwen-code/qwen-code.
  • A CommentLLM API key. Create one under Keys in the console after you sign up and add credit.

You do not need a Qwen or Alibaba Cloud account.

Step 1: put your key in an environment variable

export COMMENTLLM_API_KEY="cllm_..."

Qwen Code reads the key from the variable named in envKey, so the key never goes in the settings file.

Step 2: write ~/.qwen/settings.json

{
  "modelProviders": {
    "openai": [
      {
        "id": "deepseek-v4.1-flash-abliterated",
        "name": "DeepSeek V4.1 Flash Abliterated",
        "baseUrl": "https://api.commentllm.com/v1",
        "envKey": "COMMENTLLM_API_KEY"
      },
      {
        "id": "glm-5.3-abliterated",
        "name": "GLM 5.3 Abliterated",
        "baseUrl": "https://api.commentllm.com/v1",
        "envKey": "COMMENTLLM_API_KEY"
      }
    ]
  },
  "security": { "auth": { "selectedType": "openai" } },
  "model": { "name": "deepseek-v4.1-flash-abliterated" }
}
Setting Why
modelProviders.openai The list of models Qwen Code calls over the OpenAI Chat Completions API. id is the model ID sent to the API
envKey The name of the environment variable that holds the key
security.auth.selectedType openai skips the Qwen sign-in and uses your key
model.name The model Qwen Code starts with. It must match an id in the list

Older guides tell you to run qwen auth. That command is gone in this version; the settings file replaces it.

Step 3: start Qwen Code

Run qwen in your project. The header shows API Key and the model's name, and the status line shows a 1.0M context window.

Qwen Code 0.29.1 starting with API Key and DeepSeek V4.1 Flash Abliterated in the header

Step 4: give it a task

Our test project had a log-triage script with a bug: it counted failed SSH logins by username instead of by source address, so both tests failed. We asked:

The test suite fails. Run the tests, find the bug in auth_triage.py and fix it. Then run the tests again.

Qwen Code read the files, ran pytest and saw 2 failed, changed match.group(1) to match.group(2) and ran the tests again: 2 passed.

Qwen Code on DeepSeek V4.1 Flash Abliterated fixing the bug in auth_triage.py, with 2 passed

Approvals

Qwen Code started in its Auto mode, where a classifier decides which actions need your approval. Our test ran without a prompt. Press Shift+Tab to cycle through the approval modes, and choose a stricter one outside a sandbox.

Common problems and fixes

What you see Why Fix
qwen auth is not a command It was removed Configure ~/.qwen/settings.json as in step 2
Authentication error on the first prompt The variable named in envKey is not set in this shell export COMMENTLLM_API_KEY=... before qwen

Which model to use

Start with deepseek-v4.1-flash-abliterated, the model that fixed the bug here. glm-5.3-abliterated is the one to try for harder reasoning. Both take text only, so image input does not work. If the agent feels slow, switch the model ID to deepseek-v4.1-flash-abliterated-fast: it is the same model served about five times faster, at the same input and output rates and a higher cached-input rate. The pricing page lists every model and its rate.

Run it in a sandbox

Abliterated models refuse far fewer requests than standard ones, and that includes commands an agent should not run on your machine. Try it first in a throwaway project, as we did, and review what the model writes before you ship it.

Setting up a different agent? Uncensored coding AI lists every agent we tested, with a guide for each.

Questions

Can Qwen Code use uncensored or abliterated models?

Yes. Qwen Code accepts OpenAI-compatible models in settings.json. We ran Qwen Code 0.29.1 on DeepSeek V4.1 Flash Abliterated through CommentLLM, and it fixed a failing test in about 33 seconds.

How do I use a custom OpenAI-compatible API with Qwen Code?

Add each model under modelProviders.openai in ~/.qwen/settings.json with its id, a name, the API's baseUrl and an envKey naming the environment variable that holds your key. Set security.auth.selectedType to openai and model.name to the model's id.

Do I need a Qwen account to use my own API key?

No. With security.auth.selectedType set to openai, Qwen Code 0.29.1 started without a sign-in and used the key from the environment variable.

Where is the Qwen Code settings file?

At ~/.qwen/settings.json for every project. Qwen Code 0.29.1 has no qwen auth command, so this file is where the provider, the key's variable name and the default model are set.

Start building today.

Create an account, tell us what you work on, and send your first request.