Skip to main content
Use in AI Tools

Qwen Code

Use Token Plan with Qwen Code

Qwen Code is an AI programming assistant.

Install Qwen Code

  • macOS/Linux
  • Windows
Install Qwen Code:
bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)" -s --source bailian
Verify installation:
qwen --version

Configure and use Qwen Code

Edit or create the settings.json file. Replace YOUR_API_KEY with your Token Plan API key. The file is located at one of the following paths:
  • macOS/Linux: ~/.qwen/settings.json
  • Windows: C:\Users\<Windows username>\.qwen\settings.json
{
  "env": {
    "BAILIAN_TOKEN_PLAN_API_KEY": "YOUR_API_KEY"
  },
  "modelProviders": {
    "openai": [
      {
        "id": "qwen3.6-plus",
        "name": "[Token Plan] qwen3.6-plus",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "glm-5",
        "name": "[Token Plan] glm-5",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "MiniMax-M2.5",
        "name": "[Token Plan] MiniMax-M2.5",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "deepseek-v3.2",
        "name": "[Token Plan] deepseek-v3.2",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      }
    ]
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "tokenPlan": {
    "region": "global"
  },
  "model": {
    "name": "qwen3.6-plus"
  },
  "$version": 3
}
Start Qwen Code in your project directory:
qwen

Common commands

These commands are for Qwen Code CLI. IDE extensions support only a subset.
CommandDescriptionExample
/modelSwitch the model used in the current session./model
/authChange the authentication method./auth
/initAnalyze the current directory and create a context file (QWEN.md) with project-level instructions./init
/clearClear the screen and start a new chat session./clear
/compressReplace the chat history with a summary to save tokens./compress
/settingsOpen settings (language, theme, etc.)./settings
/summaryGenerate a project summary from the chat history./summary
/resumeResume a previous chat session./resume
/statsShow session statistics./stats
/helpShow available commands./help or /?
/quitExit Qwen Code./quit
For more commands and usage details, see the official Qwen Code docs.

Switch models (optional)

Enter /model to switch between models supported by Qwen Cloud Token Plan.
Text-based models, such as qwen3.6-plus and glm-5, work out of the box. Image generation models use a separate API and must be integrated through extension mechanisms. See Integrate multimodal generation models.
If a required model (such as qwen3.6-plus, MiniMax-M2.5, or glm-5) is not listed, update Qwen Code:
  1. Enter /quit to exit Qwen Code.
  2. Update Qwen Code:
npm install -g @qwen-code/qwen-code@latest
  1. Restart Qwen Code:
qwen
  1. Use /model to select models.

Qwen Code IDE plugin (optional)

Qwen Code is available as an IDE plugin for VS Code and JetBrains IDEs, providing AI-powered programming capabilities directly within your editor.
  • VS Code
  • JetBrains
Requires VS Code 1.85.0 or later.
  1. Search for Qwen Code Companion in VS Code extensions and install it.
  2. Edit or create the settings.json file. Replace YOUR_API_KEY with your Token Plan API key. The file is located at:
    • macOS/Linux: ~/.qwen/settings.json
    • Windows: C:\Users\<Windows username>\.qwen\settings.json
    Skip this if you already configured Qwen Code CLI -- the extension reads from the same settings.json file.
{
  "env": {
    "BAILIAN_TOKEN_PLAN_API_KEY": "YOUR_API_KEY"
  },
  "modelProviders": {
    "openai": [
      {
        "id": "qwen3.6-plus",
        "name": "[Token Plan] qwen3.6-plus",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "glm-5",
        "name": "[Token Plan] glm-5",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "MiniMax-M2.5",
        "name": "[Token Plan] MiniMax-M2.5",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "deepseek-v3.2",
        "name": "[Token Plan] deepseek-v3.2",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      }
    ]
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "tokenPlan": {
    "region": "global"
  },
  "model": {
    "name": "qwen3.6-plus"
  },
  "$version": 3
}
  1. Click the icon in the upper-right to start Qwen Code. Switch models: enter / and select Switch model.

Learn more

FAQ

See FAQ.