@protolabsai/proto 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/README.md +286 -0
- package/dist/bundled/adversarial-verification/SKILL.md +98 -0
- package/dist/bundled/brainstorming/SKILL.md +171 -0
- package/dist/bundled/coding-agent-standards/SKILL.md +67 -0
- package/dist/bundled/dispatching-parallel-agents/SKILL.md +193 -0
- package/dist/bundled/executing-plans/SKILL.md +77 -0
- package/dist/bundled/finishing-a-development-branch/SKILL.md +213 -0
- package/dist/bundled/loop/SKILL.md +61 -0
- package/dist/bundled/qc-helper/SKILL.md +151 -0
- package/dist/bundled/qc-helper/docs/_meta.ts +30 -0
- package/dist/bundled/qc-helper/docs/common-workflow.md +571 -0
- package/dist/bundled/qc-helper/docs/configuration/_meta.ts +10 -0
- package/dist/bundled/qc-helper/docs/configuration/auth.md +366 -0
- package/dist/bundled/qc-helper/docs/configuration/memory.md +0 -0
- package/dist/bundled/qc-helper/docs/configuration/model-providers.md +542 -0
- package/dist/bundled/qc-helper/docs/configuration/qwen-ignore.md +55 -0
- package/dist/bundled/qc-helper/docs/configuration/settings.md +652 -0
- package/dist/bundled/qc-helper/docs/configuration/themes.md +160 -0
- package/dist/bundled/qc-helper/docs/configuration/trusted-folders.md +61 -0
- package/dist/bundled/qc-helper/docs/extension/_meta.ts +9 -0
- package/dist/bundled/qc-helper/docs/extension/extension-releasing.md +121 -0
- package/dist/bundled/qc-helper/docs/extension/getting-started-extensions.md +299 -0
- package/dist/bundled/qc-helper/docs/extension/introduction.md +303 -0
- package/dist/bundled/qc-helper/docs/features/_meta.ts +18 -0
- package/dist/bundled/qc-helper/docs/features/approval-mode.md +263 -0
- package/dist/bundled/qc-helper/docs/features/arena.md +218 -0
- package/dist/bundled/qc-helper/docs/features/checkpointing.md +77 -0
- package/dist/bundled/qc-helper/docs/features/commands.md +312 -0
- package/dist/bundled/qc-helper/docs/features/headless.md +318 -0
- package/dist/bundled/qc-helper/docs/features/hooks.md +343 -0
- package/dist/bundled/qc-helper/docs/features/language.md +139 -0
- package/dist/bundled/qc-helper/docs/features/lsp.md +453 -0
- package/dist/bundled/qc-helper/docs/features/mcp.md +281 -0
- package/dist/bundled/qc-helper/docs/features/sandbox.md +241 -0
- package/dist/bundled/qc-helper/docs/features/scheduled-tasks.md +139 -0
- package/dist/bundled/qc-helper/docs/features/skills.md +289 -0
- package/dist/bundled/qc-helper/docs/features/sub-agents.md +307 -0
- package/dist/bundled/qc-helper/docs/features/token-caching.md +29 -0
- package/dist/bundled/qc-helper/docs/ide-integration/_meta.ts +4 -0
- package/dist/bundled/qc-helper/docs/ide-integration/ide-companion-spec.md +182 -0
- package/dist/bundled/qc-helper/docs/ide-integration/ide-integration.md +144 -0
- package/dist/bundled/qc-helper/docs/integration-github-action.md +241 -0
- package/dist/bundled/qc-helper/docs/integration-jetbrains.md +81 -0
- package/dist/bundled/qc-helper/docs/integration-vscode.md +39 -0
- package/dist/bundled/qc-helper/docs/integration-zed.md +72 -0
- package/dist/bundled/qc-helper/docs/overview.md +64 -0
- package/dist/bundled/qc-helper/docs/quickstart.md +273 -0
- package/dist/bundled/qc-helper/docs/reference/_meta.ts +4 -0
- package/dist/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +72 -0
- package/dist/bundled/qc-helper/docs/reference/sdk-api.md +524 -0
- package/dist/bundled/qc-helper/docs/support/Uninstall.md +42 -0
- package/dist/bundled/qc-helper/docs/support/_meta.ts +6 -0
- package/dist/bundled/qc-helper/docs/support/tos-privacy.md +112 -0
- package/dist/bundled/qc-helper/docs/support/troubleshooting.md +123 -0
- package/dist/bundled/receiving-code-review/SKILL.md +226 -0
- package/dist/bundled/requesting-code-review/SKILL.md +115 -0
- package/dist/bundled/review/SKILL.md +123 -0
- package/dist/bundled/subagent-driven-development/SKILL.md +292 -0
- package/dist/bundled/subagent-driven-development/code-quality-reviewer-prompt.md +27 -0
- package/dist/bundled/subagent-driven-development/implementer-prompt.md +113 -0
- package/dist/bundled/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/dist/bundled/systematic-debugging/SKILL.md +305 -0
- package/dist/bundled/test-driven-development/SKILL.md +396 -0
- package/dist/bundled/using-git-worktrees/SKILL.md +223 -0
- package/dist/bundled/using-superpowers/SKILL.md +117 -0
- package/dist/bundled/verification-before-completion/SKILL.md +147 -0
- package/dist/bundled/writing-plans/SKILL.md +159 -0
- package/dist/bundled/writing-skills/SKILL.md +716 -0
- package/dist/cli.js +483432 -0
- package/dist/sandbox-macos-permissive-closed.sb +32 -0
- package/dist/sandbox-macos-permissive-open.sb +27 -0
- package/dist/sandbox-macos-permissive-proxied.sb +37 -0
- package/dist/sandbox-macos-restrictive-closed.sb +93 -0
- package/dist/sandbox-macos-restrictive-open.sb +96 -0
- package/dist/sandbox-macos-restrictive-proxied.sb +98 -0
- package/dist/vendor/ripgrep/COPYING +3 -0
- package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/x64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/dist/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
- package/dist/vendor/tree-sitter/tree-sitter.wasm +0 -0
- package/package.json +143 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# Authentication
|
|
2
|
+
|
|
3
|
+
Qwen Code supports three authentication methods. Pick the one that matches how you want to run the CLI:
|
|
4
|
+
|
|
5
|
+
- **Qwen OAuth**: sign in with your `qwen.ai` account in a browser. Free with a daily quota.
|
|
6
|
+
- **Alibaba Cloud Coding Plan**: use an API key from Alibaba Cloud. Paid subscription with diverse model options and higher quotas.
|
|
7
|
+
- **API Key**: bring your own API key. Flexible to your own needs — supports OpenAI, Anthropic, Gemini, and other compatible endpoints.
|
|
8
|
+
|
|
9
|
+
## Option 1: Qwen OAuth (Free)
|
|
10
|
+
|
|
11
|
+
Use this if you want the simplest setup and you're using Qwen models.
|
|
12
|
+
|
|
13
|
+
- **How it works**: on first start, Qwen Code opens a browser login page. After you finish, credentials are cached locally so you usually won't need to log in again.
|
|
14
|
+
- **Requirements**: a `qwen.ai` account + internet access (at least for the first login).
|
|
15
|
+
- **Benefits**: no API key management, automatic credential refresh.
|
|
16
|
+
- **Cost & quota**: free, with a quota of **60 requests/minute** and **1,000 requests/day**.
|
|
17
|
+
|
|
18
|
+
Start the CLI and follow the browser flow:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
qwen
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or authenticate directly without starting a session:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
qwen auth qwen-oauth
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> [!note]
|
|
31
|
+
>
|
|
32
|
+
> In non-interactive or headless environments (e.g., CI, SSH, containers), you typically **cannot** complete the OAuth browser login flow.
|
|
33
|
+
> In these cases, please use the Alibaba Cloud Coding Plan or API Key authentication method.
|
|
34
|
+
|
|
35
|
+
## 💳 Option 2: Alibaba Cloud Coding Plan
|
|
36
|
+
|
|
37
|
+
Use this if you want predictable costs with diverse model options and higher usage quotas.
|
|
38
|
+
|
|
39
|
+
- **How it works**: Subscribe to the Coding Plan with a fixed monthly fee, then configure Qwen Code to use the dedicated endpoint and your subscription API key.
|
|
40
|
+
- **Requirements**: Obtain an active Coding Plan subscription from [Alibaba Cloud ModelStudio(Beijing)](https://bailian.console.aliyun.com/cn-beijing?tab=coding-plan#/efm/coding-plan-index) or [Alibaba Cloud ModelStudio(intl)](https://modelstudio.console.alibabacloud.com/?tab=coding-plan#/efm/coding-plan-index), depending on the region of your account.
|
|
41
|
+
- **Benefits**: Diverse model options, higher usage quotas, predictable monthly costs, access to a wide range of models (Qwen, GLM, Kimi, Minimax and more).
|
|
42
|
+
- **Cost & quota**: View Aliyun ModelStudio Coding Plan documentation[Beijing](https://bailian.console.aliyun.com/cn-beijing/?tab=doc#/doc/?type=model&url=3005961)[intl](https://modelstudio.console.alibabacloud.com/?tab=doc#/doc/?type=model&url=2840914).
|
|
43
|
+
|
|
44
|
+
Alibaba Cloud Coding Plan is available in two regions:
|
|
45
|
+
|
|
46
|
+
| Region | Console URL |
|
|
47
|
+
| ---------------------------- | ---------------------------------------------------------------------------- |
|
|
48
|
+
| Aliyun ModelStudio (Beijing) | [bailian.console.aliyun.com](https://bailian.console.aliyun.com) |
|
|
49
|
+
| Alibaba Cloud (intl) | [bailian.console.alibabacloud.com](https://bailian.console.alibabacloud.com) |
|
|
50
|
+
|
|
51
|
+
### Interactive setup
|
|
52
|
+
|
|
53
|
+
You can set up Coding Plan authentication in two ways:
|
|
54
|
+
|
|
55
|
+
**Option A: From the terminal (recommended for first-time setup)**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Interactive — prompts for region and API key
|
|
59
|
+
qwen auth coding-plan
|
|
60
|
+
|
|
61
|
+
# Or non-interactive — pass region and key directly
|
|
62
|
+
qwen auth coding-plan --region china --key sk-sp-xxxxxxxxx
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Option B: Inside a Qwen Code session**
|
|
66
|
+
|
|
67
|
+
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.
|
|
68
|
+
|
|
69
|
+
After authentication, use the `/model` command to switch between all Alibaba Cloud Coding Plan supported models (including qwen3.5-plus, qwen3-coder-plus, qwen3-coder-next, qwen3-max, glm-4.7, and kimi-k2.5).
|
|
70
|
+
|
|
71
|
+
### Alternative: configure via `settings.json`
|
|
72
|
+
|
|
73
|
+
If you prefer to skip the interactive `/auth` flow, add the following to `~/.qwen/settings.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"modelProviders": {
|
|
78
|
+
"openai": [
|
|
79
|
+
{
|
|
80
|
+
"id": "qwen3-coder-plus",
|
|
81
|
+
"name": "qwen3-coder-plus (Coding Plan)",
|
|
82
|
+
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
|
|
83
|
+
"description": "qwen3-coder-plus from Alibaba Cloud Coding Plan",
|
|
84
|
+
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"env": {
|
|
89
|
+
"BAILIAN_CODING_PLAN_API_KEY": "sk-sp-xxxxxxxxx"
|
|
90
|
+
},
|
|
91
|
+
"security": {
|
|
92
|
+
"auth": {
|
|
93
|
+
"selectedType": "openai"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"model": {
|
|
97
|
+
"name": "qwen3-coder-plus"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
> [!note]
|
|
103
|
+
>
|
|
104
|
+
> The Coding Plan uses a dedicated endpoint (`https://coding.dashscope.aliyuncs.com/v1`) that is different from the standard Dashscope endpoint. Make sure to use the correct `baseUrl`.
|
|
105
|
+
|
|
106
|
+
## 🚀 Option 3: API Key (flexible)
|
|
107
|
+
|
|
108
|
+
Use this if you want to connect to third-party providers such as OpenAI, Anthropic, Google, Azure OpenAI, OpenRouter, ModelScope, or a self-hosted endpoint. Supports multiple protocols and providers.
|
|
109
|
+
|
|
110
|
+
### Recommended: One-file setup via `settings.json`
|
|
111
|
+
|
|
112
|
+
The simplest way to get started with API Key authentication is to put everything in a single `~/.qwen/settings.json` file. Here's a complete, ready-to-use example:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"modelProviders": {
|
|
117
|
+
"openai": [
|
|
118
|
+
{
|
|
119
|
+
"id": "qwen3-coder-plus",
|
|
120
|
+
"name": "qwen3-coder-plus",
|
|
121
|
+
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
122
|
+
"description": "Qwen3-Coder via Dashscope",
|
|
123
|
+
"envKey": "DASHSCOPE_API_KEY"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"env": {
|
|
128
|
+
"DASHSCOPE_API_KEY": "sk-xxxxxxxxxxxxx"
|
|
129
|
+
},
|
|
130
|
+
"security": {
|
|
131
|
+
"auth": {
|
|
132
|
+
"selectedType": "openai"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"model": {
|
|
136
|
+
"name": "qwen3-coder-plus"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
What each field does:
|
|
142
|
+
|
|
143
|
+
| Field | Description |
|
|
144
|
+
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
145
|
+
| `modelProviders` | Declares which models are available and how to connect to them. Keys (`openai`, `anthropic`, `gemini`) represent the API protocol. |
|
|
146
|
+
| `env` | Stores API keys directly in `settings.json` as a fallback (lowest priority — shell `export` and `.env` files take precedence). |
|
|
147
|
+
| `security.auth.selectedType` | Tells Qwen Code which protocol to use on startup (e.g. `openai`, `anthropic`, `gemini`). Without this, you'd need to run `/auth` interactively. |
|
|
148
|
+
| `model.name` | The default model to activate when Qwen Code starts. Must match one of the `id` values in your `modelProviders`. |
|
|
149
|
+
|
|
150
|
+
After saving the file, just run `qwen` — no interactive `/auth` setup needed.
|
|
151
|
+
|
|
152
|
+
> [!tip]
|
|
153
|
+
>
|
|
154
|
+
> The sections below explain each part in more detail. If the quick example above works for you, feel free to skip ahead to [Security notes](#security-notes).
|
|
155
|
+
|
|
156
|
+
The key concept is **Model Providers** (`modelProviders`): Qwen Code supports multiple API protocols, not just OpenAI. You configure which providers and models are available by editing `~/.qwen/settings.json`, then switch between them at runtime with the `/model` command.
|
|
157
|
+
|
|
158
|
+
#### Supported protocols
|
|
159
|
+
|
|
160
|
+
| Protocol | `modelProviders` key | Environment variables | Providers |
|
|
161
|
+
| ----------------- | -------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
|
|
162
|
+
| OpenAI-compatible | `openai` | `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `OPENAI_MODEL` | OpenAI, Azure OpenAI, OpenRouter, ModelScope, Alibaba Cloud, any OpenAI-compatible endpoint |
|
|
163
|
+
| Anthropic | `anthropic` | `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL`, `ANTHROPIC_MODEL` | Anthropic Claude |
|
|
164
|
+
| Google GenAI | `gemini` | `GEMINI_API_KEY`, `GEMINI_MODEL` | Google Gemini |
|
|
165
|
+
|
|
166
|
+
#### Step 1: Configure models and providers in `~/.qwen/settings.json`
|
|
167
|
+
|
|
168
|
+
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).
|
|
169
|
+
|
|
170
|
+
> [!important]
|
|
171
|
+
>
|
|
172
|
+
> It is recommended to define `modelProviders` in the user-scope `~/.qwen/settings.json` to avoid merge conflicts between project and user settings.
|
|
173
|
+
|
|
174
|
+
Edit `~/.qwen/settings.json` (create it if it doesn't exist). You can mix multiple protocols in a single file — here is a multi-provider example showing just the `modelProviders` section:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"modelProviders": {
|
|
179
|
+
"openai": [
|
|
180
|
+
{
|
|
181
|
+
"id": "gpt-4o",
|
|
182
|
+
"name": "GPT-4o",
|
|
183
|
+
"envKey": "OPENAI_API_KEY",
|
|
184
|
+
"baseUrl": "https://api.openai.com/v1"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"anthropic": [
|
|
188
|
+
{
|
|
189
|
+
"id": "claude-sonnet-4-20250514",
|
|
190
|
+
"name": "Claude Sonnet 4",
|
|
191
|
+
"envKey": "ANTHROPIC_API_KEY"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"gemini": [
|
|
195
|
+
{
|
|
196
|
+
"id": "gemini-2.5-pro",
|
|
197
|
+
"name": "Gemini 2.5 Pro",
|
|
198
|
+
"envKey": "GEMINI_API_KEY"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
> [!tip]
|
|
206
|
+
>
|
|
207
|
+
> Don't forget to also set `env`, `security.auth.selectedType`, and `model.name` alongside `modelProviders` — see the [complete example above](#recommended-one-file-setup-via-settingsjson) for reference.
|
|
208
|
+
|
|
209
|
+
**`ModelConfig` fields (each entry inside `modelProviders`):**
|
|
210
|
+
|
|
211
|
+
| Field | Required | Description |
|
|
212
|
+
| ------------------ | -------- | -------------------------------------------------------------------- |
|
|
213
|
+
| `id` | Yes | Model ID sent to the API (e.g. `gpt-4o`, `claude-sonnet-4-20250514`) |
|
|
214
|
+
| `name` | No | Display name in the `/model` picker (defaults to `id`) |
|
|
215
|
+
| `envKey` | Yes | Environment variable name for the API key (e.g. `OPENAI_API_KEY`) |
|
|
216
|
+
| `baseUrl` | No | API endpoint override (useful for proxies or custom endpoints) |
|
|
217
|
+
| `generationConfig` | No | Fine-tune `timeout`, `maxRetries`, `samplingParams`, etc. |
|
|
218
|
+
|
|
219
|
+
> [!note]
|
|
220
|
+
>
|
|
221
|
+
> When using the `env` field in `settings.json`, credentials are stored in plain text. For better security, prefer `.env` files or shell `export` — see [Step 2](#step-2-set-environment-variables).
|
|
222
|
+
|
|
223
|
+
For the full `modelProviders` schema and advanced options like `generationConfig`, `customHeaders`, and `extra_body`, see [Model Providers Reference](model-providers.md).
|
|
224
|
+
|
|
225
|
+
#### Step 2: Set environment variables
|
|
226
|
+
|
|
227
|
+
Qwen Code reads API keys from environment variables (specified by `envKey` in your model config). There are multiple ways to provide them, listed below from **highest to lowest priority**:
|
|
228
|
+
|
|
229
|
+
**1. Shell environment / `export` (highest priority)**
|
|
230
|
+
|
|
231
|
+
Set directly in your shell profile (`~/.zshrc`, `~/.bashrc`, etc.) or inline before launching:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
|
|
235
|
+
# Alibaba Dashscope
|
|
236
|
+
export DASHSCOPE_API_KEY="sk-..."
|
|
237
|
+
|
|
238
|
+
# OpenAI / OpenAI-compatible
|
|
239
|
+
export OPENAI_API_KEY="sk-..."
|
|
240
|
+
|
|
241
|
+
# Anthropic
|
|
242
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
243
|
+
|
|
244
|
+
# Google GenAI
|
|
245
|
+
export GEMINI_API_KEY="AIza..."
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**2. `.env` files**
|
|
249
|
+
|
|
250
|
+
Qwen Code auto-loads the **first** `.env` file it finds (variables are **not merged** across multiple files). Only variables not already present in `process.env` are loaded.
|
|
251
|
+
|
|
252
|
+
Search order (from the current directory, walking upward toward `/`):
|
|
253
|
+
|
|
254
|
+
1. `.qwen/.env` (preferred — keeps Qwen Code variables isolated from other tools)
|
|
255
|
+
2. `.env`
|
|
256
|
+
|
|
257
|
+
If nothing is found, it falls back to your **home directory**:
|
|
258
|
+
|
|
259
|
+
3. `~/.qwen/.env`
|
|
260
|
+
4. `~/.env`
|
|
261
|
+
|
|
262
|
+
> [!tip]
|
|
263
|
+
>
|
|
264
|
+
> `.qwen/.env` is recommended over `.env` to avoid conflicts with other tools. Some variables (like `DEBUG` and `DEBUG_MODE`) are excluded from project-level `.env` files to avoid interfering with Qwen Code behavior.
|
|
265
|
+
|
|
266
|
+
**3. `settings.json` → `env` field (lowest priority)**
|
|
267
|
+
|
|
268
|
+
You can also define API keys directly in `~/.qwen/settings.json` under the `env` key. These are loaded as the **lowest-priority fallback** — only applied when a variable is not already set by the system environment or `.env` files.
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"env": {
|
|
273
|
+
"DASHSCOPE_API_KEY": "sk-...",
|
|
274
|
+
"OPENAI_API_KEY": "sk-...",
|
|
275
|
+
"ANTHROPIC_API_KEY": "sk-ant-..."
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
This is the approach used in the [one-file setup example](#recommended-one-file-setup-via-settingsjson) above. It's convenient for keeping everything in one place, but be mindful that `settings.json` may be shared or synced — prefer `.env` files for sensitive secrets.
|
|
281
|
+
|
|
282
|
+
**Priority summary:**
|
|
283
|
+
|
|
284
|
+
| Priority | Source | Override behavior |
|
|
285
|
+
| ----------- | ------------------------------ | -------------------------------------------- |
|
|
286
|
+
| 1 (highest) | CLI flags (`--openai-api-key`) | Always wins |
|
|
287
|
+
| 2 | System env (`export`, inline) | Overrides `.env` and `settings.json` → `env` |
|
|
288
|
+
| 3 | `.env` file | Only sets if not in system env |
|
|
289
|
+
| 4 (lowest) | `settings.json` → `env` | Only sets if not in system env or `.env` |
|
|
290
|
+
|
|
291
|
+
#### Step 3: Switch models with `/model`
|
|
292
|
+
|
|
293
|
+
After launching Qwen Code, use the `/model` command to switch between all configured models. Models are grouped by protocol:
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
/model
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
The picker will show all models from your `modelProviders` configuration, grouped by their protocol (e.g. `openai`, `anthropic`, `gemini`). Your selection is persisted across sessions.
|
|
300
|
+
|
|
301
|
+
You can also switch models directly with a command-line argument, which is convenient when working across multiple terminals.
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# In one terminal
|
|
305
|
+
|
|
306
|
+
qwen --model "qwen3-coder-plus"
|
|
307
|
+
|
|
308
|
+
# In another terminal
|
|
309
|
+
|
|
310
|
+
qwen --model "qwen3.5-plus"
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## `qwen auth` CLI command
|
|
314
|
+
|
|
315
|
+
In addition to the in-session `/auth` slash command, Qwen Code provides a standalone `qwen auth` CLI command for managing authentication directly from the terminal — without starting an interactive session first.
|
|
316
|
+
|
|
317
|
+
### Interactive mode
|
|
318
|
+
|
|
319
|
+
Run `qwen auth` without arguments to get an interactive menu:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
qwen auth
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
You'll see a selector with arrow-key navigation:
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
Select authentication method:
|
|
329
|
+
|
|
330
|
+
> Qwen OAuth - Free · Up to 1,000 requests/day · Qwen latest models
|
|
331
|
+
Alibaba Cloud Coding Plan - Paid · Up to 6,000 requests/5 hrs · All Alibaba Cloud Coding Plan Models
|
|
332
|
+
|
|
333
|
+
(Use ↑ ↓ arrows to navigate, Enter to select, Ctrl+C to exit)
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Subcommands
|
|
337
|
+
|
|
338
|
+
| Command | Description |
|
|
339
|
+
| ---------------------------------------------------- | ------------------------------------------------- |
|
|
340
|
+
| `qwen auth` | Interactive authentication setup |
|
|
341
|
+
| `qwen auth qwen-oauth` | Authenticate with Qwen OAuth |
|
|
342
|
+
| `qwen auth coding-plan` | Authenticate with Alibaba Cloud Coding Plan |
|
|
343
|
+
| `qwen auth coding-plan --region china --key sk-sp-…` | Non-interactive Coding Plan setup (for scripting) |
|
|
344
|
+
| `qwen auth status` | Show current authentication status |
|
|
345
|
+
|
|
346
|
+
**Examples:**
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
# Authenticate with Qwen OAuth directly
|
|
350
|
+
qwen auth qwen-oauth
|
|
351
|
+
|
|
352
|
+
# Set up Coding Plan interactively (prompts for region and key)
|
|
353
|
+
qwen auth coding-plan
|
|
354
|
+
|
|
355
|
+
# Set up Coding Plan non-interactively (useful for CI/scripting)
|
|
356
|
+
qwen auth coding-plan --region china --key sk-sp-xxxxxxxxx
|
|
357
|
+
|
|
358
|
+
# Check your current auth configuration
|
|
359
|
+
qwen auth status
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Security notes
|
|
363
|
+
|
|
364
|
+
- Don't commit API keys to version control.
|
|
365
|
+
- Prefer `.qwen/.env` for project-local secrets (and keep it out of git).
|
|
366
|
+
- Treat your terminal output as sensitive if it prints credentials for verification.
|
|
File without changes
|