Qwen Code with QCode: Windows & macOS walkthrough, one screenshot per step
Follow 12 steps and 12 screenshots to install Qwen Code CLI 0.28.3 on Windows 11 or macOS, configure QCode's Anthropic and OpenAI-compatible endpoints in settings.json, verify with /doctor, and switch between Claude, GPT, and Chinese models via /model.
Need an API key? Sign up →Endpoints & base URLs →
On This Page
- Download and install
- Follow the screenshots: Windows, one step at a time
- Download and install Node.js (22 or newer)
- Check the Node version and install Qwen Code
- Verify the qwen command works
- Write the Anthropic-side config and QCode key
- Launch Qwen Code in a project folder
- Run /doctor to self-check the configuration
- Run /model to verify the Claude entry
- Send your first test message with Claude
- Explore the /auth provider menu (optional)
- Add the OpenAI-compatible side (GPT and Chinese models) in settings.json
- Reopen /model in the session to hot-reload the new models
- Switch to GPT and send a test message
- Verify it works
- Common errors
- FAQ
- At a glance
- Which protocol and other endpoints
- Advanced configuration: fields, environment variables, and macOS / Linux
- Verify the endpoint outside the CLI
- Known limitations and troubleshooting
- Related
Follow the 12 steps below to install the terminal coding assistant Qwen Code CLI on Windows 11 or macOS and connect QCode's Claude, GPT, and Chinese models in a single config file so you can switch between them inside a session at any time.
Short answer: In Windows Terminal, run npm install -g @qwen-code/qwen-code@latest to install Qwen Code CLI 0.28.3, write QCode's endpoints and your cr_ key into %USERPROFILE%\.qwen\settings.json (Claude on the Anthropic side; GPT and Chinese models on the OpenAI-compatible side), run qwen in your project folder, verify with /doctor, and switch models with /model.
| Item | Fill in |
|---|---|
| Config file path | %USERPROFILE%\.qwen\settings.json |
| Anthropic endpoint (Claude) | https://api.qcode.cc/api |
| OpenAI-compatible endpoint (GPT, Chinese models) | https://api.qcode.cc/openai/v1 |
| Install command | npm install -g @qwen-code/qwen-code@latest |
| Key format | cr_xxxxxxxx |
Checked on 2026-11-22 · Qwen Code CLI 0.28.3 · Windows 11
Qwen Code is an open-source terminal coding assistant (npm package @qwen-code/qwen-code). On Chinese-language Windows 11 it launches in Simplified Chinese automatically (and follows your system locale elsewhere), with no vendor account sign-in needed. Once you configure the protocols and base URLs under modelProviders in settings.json, you can call Claude, GPT, and Chinese models using the same QCode API key.
On a Mac? Run the same steps in Terminal. The screenshots show Windows PowerShell; on macOS, set a variable with
export NAME="value"instead of$env:NAME = "value", and read%USERPROFILE%\as~/in file paths.
- The PC runs Windows 10 / 11 (64-bit) or macOS, and can open Windows Terminal, Windows PowerShell, or Terminal
- Node.js 22 or newer is installed; if not, install it first under Download and install below
- You have already signed up on QCode.cc and copied an API key starting with
cr_from the Dashboard. No account yet? Sign up for QCode first, pick a plan on the pricing page, then create a key in the Dashboard. - The PC can reach
nodejs.org(or a regional mirror),registry.npmjs.org(or npmmirror),qcode.cc, andapi.qcode.cc - Set aside about 10 minutes to save the config file step by step and run the self-check
Download and install¶
Qwen Code has no standalone Windows .exe or .msi installer and does not have separate x64 / ARM64 builds; install Node.js 22 or newer first, then install the CLI globally via npm.
Official entry points:
- Official Node.js download page: nodejs.org/en/download (choose the Windows
.msiinstaller:x64for standard PCs,ARM64for Windows on ARM; or runwinget install OpenJS.NodeJS) - Qwen Code CLI install command:
npm install -g @qwen-code/qwen-code@latest(no administrator privileges required; installs automatically to%APPDATA%\npm)
Network conditions vary slightly by region — pick yours first:
Europe / Japan
- Open the official Node.js download page and download the Windows LTS
.msi(or runwinget install OpenJS.NodeJSin Windows Terminal). - After Node.js finishes installing, run
npm install -g @qwen-code/qwen-code@latestin Windows Terminal, then runqwen --versionto confirm it works.
Mainland China
- Node.js: If the official download page is slow or drops connections, download the Windows LTS
.msiinstaller from a domestic mirror such ashttps://nodejs.cn/downloadorhttps://npmmirror.com/mirrors/node/(x64for standard PCs,ARM64for ARM64 machines). - Installer prompt: If User Account Control appears when you double-click the
.msi, click Yes to continue and leave all other options at their defaults. - Qwen Code CLI: If
registry.npmjs.orgis slow, specify the domestic mirror temporarily:npm install -g @qwen-code/qwen-code@latest --registry=https://registry.npmmirror.com.
Arab countries
- Same channels as Europe / Japan: use the official Node.js download page or
winget install OpenJS.NodeJSto install Node.js 22+. - Next, run
npm install -g @qwen-code/qwen-code@latest, then verify the command is available withqwen --version.
Russia / Iran
- Download and install the Windows LTS
.msifrom the official Node.js download page, then runnpm install -g @qwen-code/qwen-code@latest. - If the download times out, confirm your network can reach the Node.js download site and npm registry and retry; afterwards run
qwen --versionto verify.
Follow the screenshots: Windows, one step at a time¶
The 12 steps below each do one thing. The orange numbers on the screenshots match ①②③ in the text one to one.
Download and install Node.js (22 or newer)¶
Open a browser and go to the official Node.js download page. Check ① first to make sure the Windows platform and an LTS release are selected (shown here as v26.13.1 LTS, which meets the Node.js 22+ requirement). Below that in the prebuilt installer section, keep x64 for standard PCs (or choose ARM64 for Windows on ARM), then click the green Windows Installer (.msi) button at ② to download it. Once downloaded, double-click the .msi and click Next with default options until Finish (click Yes if User Account Control appears).

Done right you will see: the browser downloads the .msi installer, and the installation wizard reaches the Finish screen cleanly.
Stuck? Node.js is already installed — do I need to reinstall it?
If you already have Node.js installed, skip to the next step and run node --version in your terminal. As long as the version is v22 or higher, you do not need to reinstall; if it is lower than v22, come back here and install the latest LTS .msi over it.
Check the Node version and install Qwen Code¶
Open Windows Terminal (or Windows PowerShell) from the Start menu, then run these two commands in order:
node --version
npm install -g @qwen-code/qwen-code@latest
First verify that ① prints a version of v22 or newer (shown here as v26.13.1). The second command downloads and installs Qwen Code CLI globally, usually taking 20–60 seconds; once ② shows added 12 packages, the installation is complete with no administrator privileges required.

Done right you will see: ① outputs a version ≥ v22, and ② prints added 12 packages and returns to the command prompt.
Stuck? Seeing a yellow npm warn install-scripts warning, or a slow download
npm 11 may display npm warn install-scripts 1 package has install scripts not yet covered by allowScripts: @qwen-code/audio-capture@0.28.3. This warning is non-blocking and does not affect running the CLI or chatting — you can safely ignore it. If the download stalls for a long time, retry with a mirror:
npm install -g @qwen-code/qwen-code@latest --registry=https://registry.npmmirror.com
Verify the qwen command works¶
In the same Windows Terminal window, type the command below (①) and press Enter:
qwen --version
On Windows, global npm commands are placed in %APPDATA%\npm (which is already on your user PATH by default), so without restarting the terminal, ② prints the version 0.28.3 directly (the minor version may differ slightly with updates).

Done right you will see: ② prints a single version line (such as 0.28.3) with no red errors.
Stuck? Says qwen is not recognized as a cmdlet or internal command
Your current terminal window has not refreshed its PATH yet. Close the terminal completely, open a brand-new Windows Terminal or Windows PowerShell window, and run qwen --version again; if it is still not found, re-run npm install -g @qwen-code/qwen-code@latest.
Write the Anthropic-side config and QCode key¶
First run these two commands to create the config folder and open %USERPROFILE%\.qwen\settings.json in Notepad:
mkdir "$env:USERPROFILE\.qwen" -Force | Out-Null
notepad "$env:USERPROFILE\.qwen\settings.json"
If Notepad asks whether to create a new file, click Yes. Paste the entire JSON block below, replace cr_xxxxxxxx with your own QCode API key, and press Ctrl+S to save:
{
"modelProviders": {
"anthropic": [
{
"id": "claude-opus-5-5",
"name": "claude-opus-5-5",
"envKey": "ANTHROPIC_API_KEY",
"baseUrl": "https://api.qcode.cc/api"
}
]
},
"env": {
"ANTHROPIC_API_KEY": "cr_xxxxxxxx"
},
"security": {
"auth": {
"selectedType": "anthropic"
}
},
"model": {
"name": "claude-opus-5-5"
}
}
Before saving, double-check three key settings against the screenshot: at ①, "baseUrl" under modelProviders.anthropic is "https://api.qcode.cc/api" (no trailing slash, and do not append /v1/messages); at ②, security.auth.selectedType is "anthropic"; at ③, model.name is "claude-opus-5-5"; and ANTHROPIC_API_KEY inside env holds your cr_ key (masked in the screenshot).

Done right you will see: the Notepad tab reads settings.json (not settings.json.txt), all four top-level JSON blocks are present, and the file is saved with Ctrl+S.
Need an API key?
If you do not have a QCode account yet, Sign up for QCode first. If you prefer to pay by usage, buy a Pay-as-you-go Pack first, then create a key in the Dashboard. Copy the entire string starting with cr_ and replace cr_xxxxxxxx in the JSON above. You can pay by credit/debit card (Visa / Mastercard), Apple Pay / Google Pay, or cryptocurrency — see Payment methods.
Stuck? Worried about a missing comma in JSON or an extra .txt extension
Run this command in Windows Terminal to validate both the file path and the JSON syntax:
node -e "JSON.parse(require('fs').readFileSync(process.env.USERPROFILE + '\\.qwen\\settings.json','utf8')); console.log('JSON OK')"
Seeing JSON OK confirms the filename and syntax are valid; if it throws an error, copy and paste the entire JSON block above again and save.
Launch Qwen Code in a project folder¶
Close Notepad and return to Windows Terminal. Move into your project folder (or create a scratch folder demo-qwen if you do not have one handy) and run qwen:
mkdir "$env:USERPROFILE\demo-qwen" -Force | Out-Null
cd "$env:USERPROFILE\demo-qwen"
qwen
On Chinese-language Windows 11, Qwen Code starts automatically in Simplified Chinese and skips vendor sign-in straight to the welcome screen (on English Windows it starts in English). Check two places: ① the top banner shows API Key | claude-opus-5-5, and ② the prompt input box (输入您的消息或 @ 文件路径 / Type your message or @ file path) appears at the bottom.

Done right you will see: the top banner shows Qwen Code v0.28.3 and API Key | claude-opus-5-5, and you can type normally in the input box at the bottom.
Stuck? Want to switch the UI language, or startup fails with No auth type is selected
If the interface language does not match what you want, run /language ui en (or /language ui zh for Simplified Chinese) inside the session and press Enter. If startup fails with No auth type is selected, %USERPROFILE%\.qwen\settings.json was not found or contains a JSON syntax error — return to the previous step and verify it with the node -e command.
Run /doctor to self-check the configuration¶
Type /doctor in the bottom input box and press Enter to view the built-in configuration diagnostic report. Check two areas: ① under Authentication, the API key shows configured (anthropic), Base URL is https://api.qcode.cc/api, the model is claude-opus-5-5, and the key source is ANTHROPIC_API_KEY (/doctor shows only the variable name, never the key value); ② the bottom summary reads 9 passed, 2 warnings, 0 failures.

Done right you will see: every check under Authentication and Configuration passes with a green checkmark, and the bottom summary shows 0 failures.
Stuck? Seeing yellow warnings npm version not found or Git not available
Both warnings are normal on Windows (npm version not found can appear even when npm works, and Git not available appears when Git is not installed). As long as Authentication and Configuration are all green and the summary says 0 failures, your QCode configuration is working properly.
Run /model to verify the Claude entry¶
Type /model in the input box and press Enter to open the 选择模型 (Select Model) panel. Verify two things: ① the list includes the declared [anthropic] claude-opus-5-5 entry, and ② the details box below shows Base URL as https://api.qcode.cc/api and API Key source as ANTHROPIC_API_KEY.
![Running /model opens the Select Model panel: list shows [anthropic] claude-opus-5-5 (1), and the details box below shows Base URL https://api.qcode.cc/api and API Key ANTHROPIC_API_KEY (2)](/static/images/tut/qwen-code/202611/zh/07-qwen-model-anthropic.webp)
Done right you will see: the panel lists [anthropic] claude-opus-5-5, and the details box points Base URL directly to https://api.qcode.cc/api.
Send your first test message with Claude¶
Press Enter in the 选择模型 (Select Model) panel to confirm claude-opus-5-5, then send a test prompt such as 你好,用一句话介绍你自己 ("Hello, introduce yourself in one sentence") (①) and press Enter. A few seconds later, ② shows Claude's reply coming back through QCode's Anthropic endpoint, and ③ the bottom status bar displays the active model claude-opus-5-5 along with context usage (the terminal echoes the last four characters of the key when switching models; masked in the screenshot).

Done right you will see: a complete reply prints on screen, the bottom status bar shows claude-opus-5-5, and no errors appear.
Stuck? Getting a 401 or model unavailable error after sending a message
Check three things in order: 1) confirm env.ANTHROPIC_API_KEY in settings.json contains your own cr_ key with no leading or trailing spaces; 2) confirm baseUrl is https://api.qcode.cc/api with no trailing slash; 3) make sure Claude models are declared under the modelProviders.anthropic array, never under openai.
Explore the /auth provider menu (optional)¶
Besides editing settings.json directly, you can also run /auth inside a session to open the 连接服务商 (Connect Provider) menu. In Qwen Code 0.28.3, this menu lists 5 top-level options, with Custom Provider for manually connecting third-party or self-hosted endpoints as item 5 (①), which opens a 7-step protocol wizard when selected. Press Esc to close the menu and keep your current qwen session running.

Done right you will see: the menu lists 5 provider options with Custom Provider at item 5, and pressing Esc returns you to the chat view.
Add the OpenAI-compatible side (GPT and Chinese models) in settings.json¶
To switch between GPT and Chinese models inside the same session, you do not need to exit the running qwen process. Open %USERPROFILE%\.qwen\settings.json in Notepad again, replace its contents with the merged configuration below (use the same QCode key in both cr_xxxxxxxx placeholders), and press Ctrl+S to save:
{
"modelProviders": {
"anthropic": [
{
"id": "claude-opus-5-5",
"name": "claude-opus-5-5",
"envKey": "ANTHROPIC_API_KEY",
"baseUrl": "https://api.qcode.cc/api"
}
],
"openai": [
{
"id": "gpt-6.2-sol",
"name": "gpt-6.2-sol",
"envKey": "OPENAI_API_KEY",
"baseUrl": "https://api.qcode.cc/openai/v1"
},
{
"id": "deepseek-v4.1-flash",
"name": "deepseek-v4.1-flash",
"envKey": "OPENAI_API_KEY",
"baseUrl": "https://api.qcode.cc/openai/v1"
},
{
"id": "qwen3.8-max",
"name": "qwen3.8-max",
"envKey": "OPENAI_API_KEY",
"baseUrl": "https://api.qcode.cc/openai/v1"
}
]
},
"env": {
"ANTHROPIC_API_KEY": "cr_xxxxxxxx",
"OPENAI_API_KEY": "cr_xxxxxxxx"
},
"security": {
"auth": {
"selectedType": "anthropic"
}
},
"model": {
"name": "claude-opus-5-5"
}
}
Check the newly added openai array and the three callouts: ① gpt-6.2-sol with baseUrl set to https://api.qcode.cc/openai/v1 (stop at /v1, no trailing slash), ② the Chinese model deepseek-v4.1-flash, and ③ the Chinese model qwen3.8-max; below that, env contains both ANTHROPIC_API_KEY and OPENAI_API_KEY (both key lines are masked in the screenshot).

Done right you will see: settings.json has both the anthropic and openai arrays, both environment variables hold your cr_ key, and the file is saved.
Reopen /model in the session to hot-reload the new models¶
Close Notepad, switch back to your running qwen terminal window, and run /model again. Without restarting qwen, the new modelProviders entries and env key hot-reload automatically: ① the list now shows [openai] gpt-6.2-sol, deepseek-v4.1-flash, qwen3.8-max, and [anthropic] claude-opus-5-5. Use the arrow keys to highlight gpt-6.2-sol and verify that ② shows Base URL as https://api.qcode.cc/openai/v1.
![Reopening /model without restarting qwen hot-reloads [openai] gpt-6.2-sol, deepseek-v4.1-flash, qwen3.8-max, and [anthropic] claude-opus-5-5 (1); highlighting gpt-6.2-sol shows Base URL https://api.qcode.cc/openai/v1 (2)](/static/images/tut/qwen-code/202611/zh/11-qwen-model-openai.webp)
Done right you will see: the panel lists all 4 models, and selecting gpt-6.2-sol displays Base URL: https://api.qcode.cc/openai/v1 in the details box.
Stuck? The newly added models do not appear after reopening /model
The usual cause is a missing comma when merging the JSON (for example, right after the closing ] of the anthropic array) or forgetting to press Ctrl+S. Save the file, validate the JSON with the node -e command from step 4, and then run /model again to see the new entries.
Switch to GPT and send a test message¶
Press Enter in the 选择模型 (Select Model) panel to switch to gpt-6.2-sol. ① prints the switch confirmation showing authType: openai and Base URL: https://api.qcode.cc/openai/v1 (last four characters of the key masked). Next, send a prompt such as 你好,用一句话介绍你自己 ("Hello, introduce yourself in one sentence") and press Enter: ② shows a normal reply, and ③ the bottom status bar updates to gpt-6.2-sol. Whenever you want to exit the session later, type /quit and press Enter.

Done right you will see: the terminal confirms authType: openai and https://api.qcode.cc/openai/v1, returns a normal reply, and updates the bottom status bar to gpt-6.2-sol.
Verify it works¶
When all four checks below pass, Qwen Code is fully connected to QCode:
qwen --versionprints a version number (such as0.28.3), and runningqweninside a project folder opens the welcome screen directly;- Running
/doctorin a session shows green checkmarks forAuthenticationandConfigurationwith0 failuresin the summary; - Running
/modellists both[anthropic]and[openai]entries, withBase URLset tohttps://api.qcode.cc/apiandhttps://api.qcode.cc/openai/v1respectively; - Selecting
claude-opus-5-5andgpt-6.2-solin turn and sending a test prompt returns a normal reply from each.
All done¶
You now have Qwen Code CLI installed on Windows 11 with QCode's Claude, GPT, and Chinese models wired up in a single settings.json, ready to switch via /model inside any session. From here you can:
- Endpoints and API paths
- Tool compatibility
- OpenCode setup
- Chinese models
- Next: compare plans on the pricing page
- Go back to your Dashboard to check usage and balance
Common errors¶
| Error message | Why | What to do |
|---|---|---|
No auth type is selected |
%USERPROFILE%\.qwen\settings.json was not created, is missing security.auth.selectedType, or has a JSON syntax error preventing the config from loading |
Confirm the path is %USERPROFILE%\.qwen\settings.json (not .json.txt), add security.auth.selectedType ("anthropic" or "openai"), and validate the JSON with node -e |
Model '<id>' is not available on this endpoint |
A Claude model was placed on the OpenAI-compatible endpoint, or a GPT / Chinese model was placed on the Anthropic endpoint | Put Claude models under modelProviders.anthropic with https://api.qcode.cc/api; put GPT and Chinese models under modelProviders.openai with https://api.qcode.cc/openai/v1 |
npm warn install-scripts 1 package has install scripts not yet covered by allowScripts: @qwen-code/audio-capture@0.28.3 |
A non-blocking npm 11 warning about an optional sub-package's install script, not an installation failure | Does not affect connecting Qwen Code to QCode or chatting — ignore it and verify with qwen --version |
⚠ npm version not found |
A common yellow warning from /doctor on Windows when checking the npm version, even when npm works fine |
As long as Authentication and Configuration are all green in /doctor and the summary shows 0 failures, your QCode setup is fine — ignore this warning |
⚠ Git not available |
Git for Windows is not installed or git is not on your PATH, prompting a yellow notice from /doctor |
Does not affect connecting to QCode or daily chat; if you want Git-dependent features, install Git for Windows and reopen your terminal |
FAQ¶
What happens when my key expires?¶
Two cases:
- A personal plan key cannot be renewed when it expires — open a new plan and switch to a new key.
- For a pay-as-you-go pack, buy another pack after the key expires and the same key automatically starts working again.
When switching to a new key, update ANTHROPIC_API_KEY and OPENAI_API_KEY inside the env block of %USERPROFILE%\.qwen\settings.json (or ~/.qwen/settings.json on macOS / Linux), save, and reopen /model or restart qwen.
How do I change the interface language?¶
Qwen Code follows your system locale at launch (for example, Simplified Chinese on Chinese-language Windows 11, as seen in the screenshots). To switch manually inside a session, run:
/language ui en— set the interface language to English (also acceptszh,zh-TW, etc.)/language output English— set the model's reply language (for example,中文for Chinese)
How do I switch to the Asia or North America / Europe node?¶
QCode also provides an Asia node (asia.qcode.cc) and a North America / Europe node (us.qcode.cc) using the same cr_ key. Replace the baseUrl domain in settings.json:
- Asia node:
https://asia.qcode.cc/apifor Anthropic,https://asia.qcode.cc/openai/v1for OpenAI-compatible - North America / Europe node:
https://us.qcode.cc/apifor Anthropic,https://us.qcode.cc/openai/v1for OpenAI-compatible
Does the terminal expose my API key when switching models?¶
When you select or switch a model via /model, the terminal prints a confirmation block echoing the last four characters of the key (in the form API key: cr_…xxxx), so mask it before sharing screenshots or recordings. By contrast, /doctor displays only the environment variable name (such as ANTHROPIC_API_KEY) and never echoes the key itself.
Do I have to restart Qwen Code after editing settings.json?¶
When adding new modelProviders entries or adding a key under env in settings.json, you do not need to exit qwen — simply run /model again in the active session to hot-reload the new entries. If you change the default startup settings or underlying protocol options, exit with /quit and launch qwen again.
At a glance¶
| Item | Details |
|---|---|
| Models you can use | Claude ✅ (under anthropic) · GPT ✅ · Chinese models ✅ (under openai) · Gemini ❌ (QCode does not offer the Gemini series — use Claude, GPT, or a Chinese model) |
| Protocol & Base URL | Anthropic: https://api.qcode.cc/api · OpenAI-compatible: https://api.qcode.cc/openai/v1 |
| Config location | Windows: %USERPROFILE%\.qwen\settings.json · macOS / Linux: ~/.qwen/settings.json; in-session commands: /auth, /model, /doctor, /help, /language |
| Official docs | Authentication · Settings reference |
Which protocol and other endpoints¶
| Models you want | modelProviders key (auth type) |
Base URL to enter |
|---|---|---|
| Claude | anthropic |
https://api.qcode.cc/api |
| GPT and Chinese models | openai |
https://api.qcode.cc/openai/v1 |
Qwen Code encodes the protocol in the provider key: for built-in providers, the key must be a valid auth type (openai, anthropic, gemini, vertex-ai). Each model entry is identified by its protocol, its id, and its configured baseUrl.
🔴 Never call Claude through the OpenAI-compatible endpoint. QCode's OpenAI endpoint rejects Claude models with an error such as Model '<id>' is not available on this endpoint. Always configure Claude under anthropic with https://api.qcode.cc/api, and configure GPT and Chinese models under openai with https://api.qcode.cc/openai/v1.
Enter the base URL exactly as shown above: no trailing slash, and do not include the request path in baseUrl (do not write .../v1/messages or .../chat/completions; the client appends the path automatically). To use a regional node, swap the domain — the same key works everywhere:
| Node | Anthropic (Claude) | OpenAI-compatible (GPT / Chinese models) |
|---|---|---|
| Global (default) | https://api.qcode.cc/api |
https://api.qcode.cc/openai/v1 |
| Asia (optional for Mainland China) | https://asia.qcode.cc/api |
https://asia.qcode.cc/openai/v1 |
| North America / Europe | https://us.qcode.cc/api |
https://us.qcode.cc/openai/v1 |
Advanced configuration: fields, environment variables, and macOS / Linux¶
The four top-level blocks in settings.json¶
modelProviders: declares which models are available and how to connect to them. Each auth type maps to an array; every entry requiresid, whilename,baseUrl, andgenerationConfigare optional, andenvKeynames the environment variable holding the credential.env: stores API keys insidesettings.jsonas a fallback; shell environment variables and.envfiles take precedence.security.auth.selectedType: sets which protocol is active by default at startup ("anthropic"or"openai"); models on the other side can be switched to at any time via/model.model.name: sets the default model activated at startup and must match one of your declaredidvalues.
Use QCode's active catalog IDs: on the Claude side, claude-opus-5-5 and others; on the OpenAI-compatible side, gpt-6.2-sol, gpt-6.2-astra, and Chinese model IDs such as glm-5.3, deepseek-v4.1-flash, and qwen3.8-max.
Launch with environment variables¶
Instead of settings.json, you can also launch directly using environment variables.
On macOS / Linux (also installable via brew install qwen-code) or in Bash:
# Claude (Anthropic side)
export ANTHROPIC_API_KEY="cr_xxxxxxxx"
export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"
export ANTHROPIC_MODEL="claude-opus-5-5"
qwen
# GPT and Chinese models (OpenAI-compatible side)
export OPENAI_API_KEY="cr_xxxxxxxx"
export OPENAI_BASE_URL="https://api.qcode.cc/openai/v1"
export OPENAI_MODEL="gpt-6.2-sol"
qwen
In Windows PowerShell, use $env: syntax (scoped to the current window only):
# Claude (Anthropic side)
$env:ANTHROPIC_API_KEY="cr_xxxxxxxx"
$env:ANTHROPIC_BASE_URL="https://api.qcode.cc/api"
$env:ANTHROPIC_MODEL="claude-opus-5-5"
qwen
# GPT and Chinese models (OpenAI-compatible side)
$env:OPENAI_API_KEY="cr_xxxxxxxx"
$env:OPENAI_BASE_URL="https://api.qcode.cc/openai/v1"
$env:OPENAI_MODEL="gpt-6.2-sol"
qwen
Add manually through the /auth wizard¶
Inside a CLI session, type /auth to open the 连接服务商 (Connect Provider) menu, pick item 5 Custom Provider, and follow the 7-step wizard to choose the protocol (OpenAI-compatible or Anthropic-compatible) and enter the base URL, key, and model ID.
Run /help on the welcome screen or inside a session to list all available slash commands.
Verify the endpoint outside the CLI¶
If calls fail inside the CLI, test connectivity to the Anthropic endpoint directly with curl (pass the key in x-api-key and the API version in anthropic-version):
KEY="cr_xxxxxxxx"
curl -X POST https://api.qcode.cc/api/v1/messages \
-H "x-api-key: $KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-opus-5-5","max_tokens":32,"messages":[{"role":"user","content":"ping"}]}'
If curl succeeds while the CLI fails, the issue is usually the path, field names, or JSON syntax in settings.json. If curl fails too, check your base URL and API key first, then follow the Troubleshooting guide.
Known limitations and troubleshooting¶
| Symptom | What it means | What to do |
|---|---|---|
| A Claude ID fails on the OpenAI-compatible base URL | QCode serves Claude only over the Anthropic protocol | Move that model into the anthropic array with baseUrl set to https://api.qcode.cc/api |
security.auth.apiKey or security.auth.baseUrl left in config |
Both fields are deprecated in favor of modelProviders (using envKey for credentials) |
Remove them and declare models under modelProviders |
wireApi set on an Anthropic entry |
wireApi is an OpenAI-side field and causes a configuration error on Anthropic entries |
Remove it from Anthropic entries |
extra_body has no effect |
Supported only for openai-compatible providers; ignored for Anthropic and Gemini providers |
When passing custom parameters, place them under modelProviders[].generationConfig.extra_body |
model.name does not take effect |
It must match an id declared under modelProviders |
Change it to a declared id, or select the model with /model |
| Desired model is missing from the picker | Non-default auth types are exposed through /model, and custom models must be declared in modelProviders |
Add the entry to settings.json, save, and reopen /model |
A few more points to keep in mind:
- Gemini: Qwen Code supports a
geminiauth type, but QCode does not offer the Gemini series — use Claude, GPT, or Chinese models. - Not offered: QCode does not offer
gpt-6-lunaorgpt-5.6-luna; use other GPT models such asgpt-6.2-solorgpt-6.2-astra. See Choosing a model for guidance on which model fits each task. - Hot-reload vs. restart: updates to
modelProvidersandenvare picked up by a running session when you reopen/model; if you change underlying protocol settings, exit with/quitand restartqwen. - Credential configuration: configure credentials via
settings.jsonor environment variables rather than relying on CLI flags. - Base URL formatting: never include a trailing slash, and never include the request path itself inside
baseUrl. - Billing: billed by token usage; see the live model catalog at qcode.cc/en/models.
Related¶
- Endpoints and API paths: which protocol serves which model family
- Tool compatibility: other tools supporting Anthropic or OpenAI-compatible protocols
- OpenCode setup: another terminal CLI using the same two endpoints
- Chinese models
- Choosing a model
- Troubleshooting
Get started with QCode
One API key for Claude Code, Codex and more — billed per token, per-model prices on qcode.cc/models