Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/users/configuration/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default {
settings: 'Settings',
auth: 'Authentication',
'model-providers': 'Model Providers',
'qwen-ignore': 'Ignoring Files',
'trusted-folders': 'Trusted Folders',
themes: 'Themes',
Expand Down
116 changes: 68 additions & 48 deletions docs/users/configuration/auth.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Authentication

Qwen Code supports three authentication methods. Pick the one that matches how you want to run the CLI:
Qwen Code's first-run `/auth` menu has three top-level options. Pick the one that matches how you want to run the CLI:

- **Qwen OAuth**: sign in with your `qwen.ai` account in a browser. **Free tier discontinued on 2026-04-15** — switch to another method.
- **Alibaba Cloud Coding Plan**: use an API key from Alibaba Cloud. Paid subscription with diverse model options and higher quotas.
- **API Key**: bring your own API key. Flexible to your own needs — supports OpenAI, Anthropic, Gemini, and other compatible endpoints.
- **Alibaba ModelStudio**: official recommended setup. Opens a sub-menu with **Coding Plan** (for individual developers · weekly quota included), **Token Plan** (for teams and companies · usage-based billing with a dedicated endpoint), or **Standard API Key** (connect with an existing ModelStudio API key).

ghost Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

ghost Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The intro was rewritten to describe the three current /auth menu entries — Alibaba ModelStudio, Third-party Providers, Custom Provider — but the section headers further down still use the old taxonomy: Option 1: Qwen OAuth (Discontinued), Option 2: Alibaba Cloud Coding Plan, Option 3: API Key. A reader who just saw the new menu on screen will struggle to map the doc's numbered options to what they saw.

Option 1: Qwen OAuth (Discontinued) (line 13) is especially jarring — the intro explicitly says it's no longer a selectable dialog entry, yet the body still numbers it first.

Suggested fix: drop the Option N numbering and restructure headers to align with the current menu hierarchy, e.g.

## Alibaba ModelStudio
### Coding Plan
### Token Plan
### Standard API Key
## Third-party Providers
## Custom Provider
## Legacy: Qwen OAuth (discontinued)

— qwen3.7-max via Qwen Code /review

ghost Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed the intro (new menu taxonomy: Alibaba ModelStudio / Third-party Providers / Custom Provider) and the body's Option 1/2/3 headers are out of sync — good catch. I'm intentionally not doing the full header restructure in this PR: the Option 3: API Key section is large (supported protocols, model/provider config, env-var setup, /model switching) and doesn't map cleanly onto the new Third-party Providers vs Custom Provider vs ModelStudio -> Standard API Key split, so reorganizing it properly is a bigger editorial change than this PR's minimal scope. Leaving this thread open for a maintainer call on the target structure rather than landing a partial restructure that could read worse. The other three items in this review batch are fixed in 8d67dcd.

- **Third-party Providers**: choose a built-in provider and connect with an API key (DeepSeek, MiniMax, Z.AI, Idealab, ModelScope, OpenRouter, Requesty).
- **Custom Provider**: manually connect a local server, proxy, or unsupported provider — supports OpenAI, Anthropic, Gemini, and other compatible endpoints.

> [!note]
>
> **Qwen OAuth** is no longer a selectable dialog entry — its free tier was discontinued on 2026-04-15. It remains documented below as a hard-coded, discontinued provider only.

## Option 1: Qwen OAuth (Discontinued)

Expand All @@ -23,7 +27,7 @@ Start the CLI and follow the browser flow:
qwen
```

Then run `/auth` and choose the OAuth provider from the interactive dialog.
Qwen OAuth is no longer offered as a selectable entry in the `/auth` dialog; run `/auth` and choose one of the current options (Alibaba ModelStudio, Third-party Providers, or Custom Provider) instead.

> [!note]
>
Expand All @@ -48,7 +52,7 @@ Alibaba Cloud Coding Plan is available in two regions:

### Interactive setup

Enter `qwen` in the terminal to launch Qwen Code, then run the `/auth` command and select **Alibaba Cloud Coding Plan**. Choose your region, then enter your `sk-sp-xxxxxxxxx` key.
Enter `qwen` in the terminal to launch Qwen Code, then run the `/auth` command, select **Alibaba ModelStudio**, and choose **Coding Plan** from the sub-menu. Choose your region, then enter your `sk-sp-xxxxxxxxx` key.

After authentication, use the `/model` command to switch between all Alibaba Cloud Coding Plan supported models (including qwen3.5-plus, qwen3.6-plus, qwen3.7-plus, qwen3-coder-plus, qwen3-coder-next, qwen3-max-2026-01-23, glm-5, glm-4.7, kimi-k2.5, and MiniMax-M2.5).

Expand All @@ -71,15 +75,18 @@ If you prefer to skip the interactive `/auth` flow, add the following to `~/.qwe
```json
{
"modelProviders": {
"openai": [
{
"id": "qwen3-coder-plus",
"name": "qwen3-coder-plus (Coding Plan)",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"description": "qwen3-coder-plus from Alibaba Cloud Coding Plan",
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
}
]
"openai": {
"protocol": "openai",
"models": [
{
"id": "qwen3-coder-plus",
"name": "qwen3-coder-plus (Coding Plan)",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"description": "qwen3-coder-plus from Alibaba Cloud Coding Plan",
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
}
]
}
},
"env": {
"BAILIAN_CODING_PLAN_API_KEY": "sk-sp-xxxxxxxxx"
Expand Down Expand Up @@ -110,15 +117,18 @@ The simplest way to get started with API Key authentication is to put everything
```json
{
"modelProviders": {
"openai": [
{
"id": "qwen3-coder-plus",
"name": "qwen3-coder-plus",
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"description": "Qwen3-Coder via Dashscope",
"envKey": "DASHSCOPE_API_KEY"
}
]
"openai": {
"protocol": "openai",
"models": [
{
"id": "qwen3-coder-plus",
"name": "qwen3-coder-plus",
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"description": "Qwen3-Coder via Dashscope",
"envKey": "DASHSCOPE_API_KEY"
}
]
}
},
"env": {
"DASHSCOPE_API_KEY": "sk-xxxxxxxxxxxxx"
Expand Down Expand Up @@ -158,10 +168,11 @@ The key concept is **Model Providers** (`modelProviders`): Qwen Code supports mu
| OpenAI-compatible | `openai` | `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `OPENAI_MODEL` | OpenAI, Azure OpenAI, OpenRouter, Requesty, ModelScope, Alibaba Cloud, any OpenAI-compatible endpoint |
| Anthropic | `anthropic` | `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL`, `ANTHROPIC_MODEL` | Anthropic Claude |
| Google GenAI | `gemini` | `GEMINI_API_KEY`, `GEMINI_MODEL` | Google Gemini |
| Vertex AI | `vertex-ai` | `GOOGLE_API_KEY`, `GOOGLE_MODEL` (sets `GOOGLE_GENAI_USE_VERTEXAI=true`; uses the `gemini` protocol) | Google Vertex AI |

#### Step 1: Configure models and providers in `~/.qwen/settings.json`

Define which models are available for each protocol. Each model entry requires at minimum an `id` and an `envKey` (the environment variable name that holds your API key).
Define which models are available for each protocol. Each model entry requires at minimum an `id`; `envKey` (the environment variable name that holds your API key) is optional and recommended — when omitted, it falls back to the auth type's default env key (e.g. `OPENAI_API_KEY` for `openai`).

> [!important]
>
Expand All @@ -172,28 +183,37 @@ Edit `~/.qwen/settings.json` (create it if it doesn't exist). You can mix multip
```json
{
"modelProviders": {
"openai": [
{
"id": "gpt-4o",
"name": "GPT-4o",
"envKey": "OPENAI_API_KEY",
"baseUrl": "https://api.openai.com/v1"
}
],
"anthropic": [
{
"id": "claude-sonnet-4-20250514",
"name": "Claude Sonnet 4",
"envKey": "ANTHROPIC_API_KEY"
}
],
"gemini": [
{
"id": "gemini-2.5-pro",
"name": "Gemini 2.5 Pro",
"envKey": "GEMINI_API_KEY"
}
]
"openai": {
"protocol": "openai",
"models": [
{
"id": "gpt-4o",
"name": "GPT-4o",
"envKey": "OPENAI_API_KEY",
"baseUrl": "https://api.openai.com/v1"
}
]
},
"anthropic": {
"protocol": "anthropic",
"models": [
{
"id": "claude-sonnet-4-20250514",
"name": "Claude Sonnet 4",
"envKey": "ANTHROPIC_API_KEY"
}
]
},
"gemini": {
"protocol": "gemini",
"models": [
{
"id": "gemini-2.5-pro",
"name": "Gemini 2.5 Pro",
"envKey": "GEMINI_API_KEY"
}
]
}
}
}
```
Expand All @@ -208,7 +228,7 @@ Edit `~/.qwen/settings.json` (create it if it doesn't exist). You can mix multip
| ------------------ | -------- | -------------------------------------------------------------------- |
| `id` | Yes | Model ID sent to the API (e.g. `gpt-4o`, `claude-sonnet-4-20250514`) |
| `name` | No | Display name in the `/model` picker (defaults to `id`) |
| `envKey` | Yes | Environment variable name for the API key (e.g. `OPENAI_API_KEY`) |
| `envKey` | No | Environment variable name for the API key (e.g. `OPENAI_API_KEY`); optional/recommended — defaults to the auth type's default env key when omitted |
| `baseUrl` | No | API endpoint override (useful for proxies or custom endpoints) |
| `generationConfig` | No | Fine-tune `timeout`, `maxRetries`, `samplingParams`, etc. |

Expand Down
Loading