# How to use Qwen Code with Subconscious

> To use Qwen Code with Subconscious, add Subconscious as an OpenAI-compatible entry under `modelProviders` in `~/.qwen/settings.json`, with base URL `https://api.subconscious.dev/v1`, model `subconscious/glm-5.3-marathon`, and `envKey` set to `SUBCONSCIOUS_API_KEY`. Then run `qwen`. Qwen Code sends every request to Subconscious, billed per token.

Canonical page: https://www.subconscious.dev/agents/terminal-and-ide/qwen-code
Category: [Terminal and IDE agents](https://www.subconscious.dev/agents/terminal-and-ide)
Last verified: 2026-09-30
Qwen Code: https://qwenlm.github.io/qwen-code-docs/en/
Source: https://github.com/QwenLM/qwen-code

## Before you start

- Node.js and npm
- A Subconscious account and API key

## Set up Qwen Code

### 1. Install Qwen Code

Install the qwen CLI globally with npm. Homebrew users can run brew install qwen-code instead.

```bash
npm install -g @qwen-code/qwen-code@latest
```

### 2. Create a Subconscious API key

Sign in at https://platform.subconscious.dev, create an API key, and export it so the tool can read it.

```bash
export SUBCONSCIOUS_API_KEY="your_key"
```

### 3. Add Subconscious as a model provider

`envKey` is the name of the environment variable that holds your key, not the key itself. Use `.qwen/settings.json` in a project instead to scope it to that project.

```json
{
  "modelProviders": {
    "openai": [
      {
        "id": "subconscious/glm-5.3-marathon",
        "name": "Subconscious GLM-5.3 Marathon",
        "baseUrl": "https://api.subconscious.dev/v1",
        "envKey": "SUBCONSCIOUS_API_KEY"
      }
    ]
  },
  "security": { "auth": { "selectedType": "openai" } },
  "model": { "name": "subconscious/glm-5.3-marathon" }
}
```

### 4. Start Qwen Code

Run qwen in your project. Use /model inside a session to switch between configured models.

```bash
qwen
```

## Connection details

- OpenAI-compatible base URL: https://api.subconscious.dev/v1
- Anthropic-compatible base URL: https://api.subconscious.dev
- API key: From subc login or the Subconscious dashboard
- Model: subconscious/glm-5.3-marathon
- Multimodal, high-throughput model: subconscious/deepseek-v4.1-flash-marathon

Full API reference: https://docs.subconscious.dev

## Frequently asked questions

### Can I still use security.auth.apiKey and baseUrl in Qwen Code?

Those settings are deprecated. Configure custom endpoints under modelProviders, which is also where Qwen Code documents OpenAI-, Anthropic- and Gemini-format providers.

### Which Subconscious model should I use with Qwen Code?

Start with subconscious/glm-5.3-marathon, an open frontier coding model built for long agent runs. subconscious/deepseek-v4.1-flash-marathon is a cheaper, high-throughput alternative that also takes image input. Use the full model ID, including the subconscious/ prefix.

### Is Qwen Code on Subconscious OpenAI- or Anthropic-compatible?

This guide connects Qwen Code through the OpenAI-compatible Subconscious API. Subconscious serves both formats: OpenAI Chat Completions at https://api.subconscious.dev/v1 and Anthropic Messages at https://api.subconscious.dev.

### How is Qwen Code usage on Subconscious billed?

Per token by default, with no commitment. Heavy users can switch to a monthly token plan: a fixed price for a large daily token allowance shared across your team.
