Claude Code One-Click Setup on Windows and macOS (With Screenshots)
Run one PowerShell command to connect Claude Code or Codex to QCode on Windows: 17 numbered screenshots for endpoint pick, API key, Node.js, and verification.
Need an API key? Sign up →Endpoints & base URLs →
On This Page
- Download and install
- Follow the screenshots: Windows, one step at a time
- Open Windows PowerShell
- Paste the one-line command
- Wait for the latency results
- Type 1 to choose api.qcode.cc
- Paste your API key
- Confirm the key was accepted
- Check what the script wrote
- Let npm install Claude Code
- Let winget install Node.js
- Click Yes in the User Account Control window
- Wait for the install to finish
- Check the access verification
- Read the summary
- Try claude in a new window
- Lift the script-execution limit once
- Start Claude Code for the first time
- Confirm it bills the API key, not an account
- Verify it works
- Common errors
- FAQ
- Do I need administrator rights to run the script?
- Where does the script put the settings?
- What happens when my key expires?
- The script asked whether to change the env block of settings.json. Should I accept?
- Can I use the same command on macOS or Linux?
- Why is the recommended endpoint not api.qcode.cc?
- 🍎 macOS / 🐧 Linux
- No irm, or blocked by the execution policy
- Windows notes
- Interface language
- Codex: desktop App or CLI
- What the script does
- Non-interactive mode (CI / no prompts)
- Preview the plan first: -DryRun
- Uninstall: -Uninstall
- What files are written and how to roll back
- Related docs
Run one command and you end up with Claude Code installed on Windows or macOS and already talking to QCode — the 17 screenshots below follow the whole run, from opening PowerShell to your first prompt.
Short answer: In Windows PowerShell, paste irm https://qcode.cc/install/claude-code.ps1 | iex, answer 1 to use api.qcode.cc, paste your cr_ key, and the script installs Claude Code and writes ANTHROPIC_BASE_URL=https://api.qcode.cc/api for you.
| Item | Fill in |
|---|---|
| One-line command | irm https://qcode.cc/install/claude-code.ps1 | iex |
Answer at the Choose an endpoint prompt |
1 |
Address written to ANTHROPIC_BASE_URL |
https://api.qcode.cc/api |
| API key format | cr_xxxxxxxx |
Checked on 2026-11-22 · one-click script v2026.11.21.1 · Claude Code 2.1.330 · Windows 11
You do not need WSL, an Anthropic account or an Administrator PowerShell window. The script writes your configuration into your own user account; the only elevated prompt in the whole run is the Node.js installer, and you answer it once.
On macOS or Linux, skip to the section near the end — the command is different, the rest works the same way.
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 macOS / Linux section of this page has the commands that differ.
- A Windows 10 or 11 PC (64-bit) or a Mac where you can open
Windows Terminal,Windows PowerShellorTerminal - Your QCode API key, copied from the dashboard (
cr_xxxxxxxx). No account yet? Sign up first, pick a plan on the pricing page, then create the key in your Dashboard. - A connection that can open
qcode.cc,api.qcode.ccandprobe.qcode.cc - Ten quiet minutes: the Node.js download in step 11 can take a while on a slow link
Haven't picked a plan yet? How to choose a plan walks through the options, and every plan uses the same key format. Running agents on a cloud server? The server page shows the same command; what comes after it — pasting the key and keeping tasks alive after a disconnect — is in Run agents on a cloud server.
Download and install¶
There is no installer to download: the command in step 2 fetches the script and runs it. The script installs whatever else it needs, so at this point you have nothing to fetch by hand.
QCode answers on three endpoints — api.qcode.cc, plus asia.qcode.cc and us.qcode.cc as alternatives. The script measures all three and you can pick another one at the prompt in step 4, so the only thing that changes between regions is where the downloads come from.
Europe / Japan
- The Store, winget and the official sites all work:
winget install Microsoft.WindowsTerminal,winget install OpenJS.NodeJS.LTS, or the.msifrom https://nodejs.org/download. - The script comes from
qcode.ccand opens normally. If the latency line forapi.qcode.cclooks slow, type2or3at the endpoint prompt to useasia.qcode.ccorus.qcode.ccinstead.
Mainland China
Windows PowerShellis already on the PC, so nothing has to be installed first. For a nicer window, installWindows Terminalfrom the Microsoft Store, or runwinget install Microsoft.WindowsTerminal.- Node.js normally arrives through winget. If the script says
winget not found, or winget cannot download it, install the LTS.msifrom https://nodejs.org/download (ARM64 on a Snapdragon laptop) and run the script again. Ifnodejs.orgis slow, the same version is mirrored on nodejs.cn andnpmmirror.com/mirrors/node/. - When
registry.npmjs.orgdoes not answer, the script switches npm tohttps://registry.npmmirror.comby itself; you can also ask for it with-Mirror cn. - The script itself is served from
qcode.ccand opens normally.
Arab countries
- Download sources are the same as in Europe and Japan: the Store, winget, and https://nodejs.org/download.
- The script comes from
qcode.ccand opens normally. At the endpoint prompt, pick whichever ofapi.qcode.cc,asia.qcode.ccorus.qcode.ccshowed the lowest latency.
Russia / Iran
- The Store, winget and https://nodejs.org/download normally work; when
nodejs.orgdoes not open, use the same version from nodejs.cn ornpmmirror.com/mirrors/node/. - The script comes from
qcode.ccand opens normally. Pick the endpoint with the lowest latency at the prompt in step 4. - Want to read the plan before anything happens? The
-DryRunsection near the end prints every change without writing, installing or sending anything.
To read the source before running it, open https://qcode.cc/install/claude-code.ps1. For Codex, replace claude-code with codex in every command on this page.
Follow the screenshots: Windows, one step at a time¶
The 17 steps below do one thing each. The orange numbers in the text (①, ②, ③) match the orange numbers drawn on the screenshot, so when you see ① look at the same mark in the picture.
Open Windows PowerShell¶
Press the Start button and type Windows Terminal (or Windows PowerShell), then open it. ① is the tab name, which reads Windows PowerShell, and ② is the prompt, which starts with PS — that is how you know you are in PowerShell and not in Command Prompt.

Done right you will see: a dark window whose tab reads Windows PowerShell, with a prompt like PS C:\Users\your-name> waiting for input.
Stuck? The prompt starts with C:\Users\...> and has no PS
That is Command Prompt. The command in the next step does not work there. Close the window and open Windows Terminal or Windows PowerShell from the Start menu instead.
Paste the one-line command¶
Click into the window, paste this and press Enter:
irm https://qcode.cc/install/claude-code.ps1 | iex
Nothing appears for a second or two while the script downloads, then the screen fills in: ① is that same command line above your cursor, ② is the two-line banner, ③ is ==> [1/5] Measuring latency to the 3 endpoints.... The version number in the banner changes as the script is updated; any version is fine.
![After Enter: the command itself (1), the two-line banner with the script name and version (2), then [1/5] starting the endpoint test (3)](/static/images/tut/one-click-install/202611/en/02-script-banner.webp)
Done right you will see: QCode.cc - Claude Code one-click setup v2026.11.21.1, then No admin rights needed | old values backed up | verified after setup, then the [1/5] line.
Wait for the latency results¶
After a few seconds ① shows one line per endpoint with its latency in brackets. Line 1, api.qcode.cc, picks a node by region (North America and Europe go to the US, everywhere else to Asia); line 2 is Asia, line 3 is North America. A line reading [timeout] means that endpoint did not answer this time, which is normal and does not stop you.
② is the question that follows: which endpoint to use. The recommendation sits in the square brackets.

Done right you will see: three lines starting with 1), 2) and 3), each ending in something like [302ms], and then Choose an endpoint [Enter = 2 (fastest: asia.qcode.cc)]:.
Type 1 to choose api.qcode.cc¶
Type 1 and press Enter. Do not just press Enter: the bracketed default is whichever endpoint was fastest this time, and it is often 2.
1 selects api.qcode.cc, 2 selects asia.qcode.cc, 3 selects us.qcode.cc. ① then shows the endpoint you picked together with the address it writes, and ② shows the script moving on to the key.
![After typing 1 and Enter: the endpoint api.qcode.cc with ANTHROPIC_BASE_URL=https://api.qcode.cc/api (1), then [2/5] asking for the key (2)](/static/images/tut/one-click-install/202611/en/04-endpoint-chosen.webp)
Done right you will see: [OK] Endpoint: api.qcode.cc -> ANTHROPIC_BASE_URL=https://api.qcode.cc/api, and the next line starts with ==> [2/5].
Stuck? The confirmation says asia.qcode.cc or us.qcode.cc
You accepted the default with a bare Enter. All three endpoints serve the same models with the same key, only the latency differs. To pin api.qcode.cc, run the script again and type 1 at this prompt.
Paste your API key¶
Copy the cr_ key from your Dashboard, paste it at the prompt and press Enter. ① shows only a row of asterisks — as many as the key has characters. That is deliberate: the input is never echoed, so a full row of asterisks means the key arrived.
Because of that, never paste the key into a chat window, a screenshot or a screen recording.

Done right you will see: API key: followed by a row of asterisks and nothing else, and pressing Enter immediately produces the next line.
Stuck? The API key contains invalid characters.
Quotes, spaces or full-width punctuation came along with the copy. The script strips quotes and whitespace at both ends, but anything odd in the middle is rejected; copy the string again from the Dashboard, starting at cr_.
Need an API key?
If you do not have a QCode account yet, sign up first. If a monthly plan is more than you need, buy a Pay-as-you-go Pack, then create the key in the Dashboard and copy the string that starts with cr_. You can pay by credit or debit card (Visa / Mastercard), Apple Pay / Google Pay, or cryptocurrency — see Payment methods.
Confirm the key was accepted¶
Press Enter and ① reports the key with its last four characters: Key accepted: cr_****31f2. Only the tail is shown, which is enough to tell the key apart without exposing it.

Done right you will see: [OK] Key accepted: cr_**** plus four characters, with no red text anywhere.
Stuck? Keys normally start with cr_ ; this one does not.
Something other than a QCode key was pasted, for example a key from another service. Go back to the Dashboard, copy the cr_ key and run the script again.
Check what the script wrote¶
Next comes ==> [3/5] Writing user-level environment variables. ② is the line listing the four variables it wrote: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC and CLAUDE_CODE_AUTO_MODE_SERVER.
A PC that already had another relay configured also shows [OK] Previous environment variables backed up: followed by a path under .qcode. A fresh PC has no such line, and that is normal too.

Done right you will see: [OK] Wrote ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN / … on one line, with no red text.
Let npm install Claude Code¶
[4/5] checks the runtime environment and ① asks Claude Code was not found. Install it with npm? [Y/n]:. Press Enter — that is Y — and let it install.
![[4/5] asking whether to install Claude Code with npm (1), and further down the prompt to install Node.js LTS with winget (2)](/static/images/tut/one-click-install/202611/en/07-node-install-prompt.webp)
Done right you will see: the question ends with [Y/n]:, and after Enter the script keeps printing instead of stopping.
Stuck? It never asked, and printed Claude Code is already installed: …
This PC already has Claude Code, so the script skipped that part. That is good news — continue with the next steps.
Let winget install Node.js¶
Claude Code needs Node.js. If it is missing, the script prints [ ! ] Node.js not found and ② asks Install Node.js LTS with winget? [Y/n]:. Press Enter again.
The two questions are not on the same line: the Node.js question only appears after npm has been answered and the check has run.

Done right you will see: Install Node.js LTS with winget? [Y/n]:, and after Enter the download starts and this step takes a few minutes.
Stuck? winget not found.
The script cannot install Node.js by itself here. Install the LTS .msi from https://nodejs.org/download (ARM64 on a Snapdragon laptop), then run the script again. If nodejs.org will not open, take the same version from nodejs.cn or npmmirror.com/mirrors/node/.
Click Yes in the User Account Control window¶
Installing Node.js raises a Windows prompt. ① is the question, Do you want to allow this app to make changes to your device?; ② shows the publisher, Verified publisher: OpenJS Foundation, and the file origin; ③ is the Yes button. The default button is No, so clicking or pressing Alt + Y is required.
This is the only place in the whole run that asks for administrator rights. Installing Claude Code afterwards does not.

Done right you will see: the prompt closes and the terminal keeps scrolling with the winget progress.
Stuck? I closed the prompt, or clicked No
The script reports that winget failed and prints its exit code. Your QCode configuration is already written, so nothing is lost: run the script again, or install the LTS build from https://nodejs.org/download and re-run.
Wait for the install to finish¶
Nothing to click here. The first part of the output is winget installing Node.js (Found Node.js (LTS) …, Successfully installed), the second part is npm installing Claude Code. A few yellow npm warn lines are npm's own notes, not failures.
The last line of this block is ==> [5/5], where the script moves on to the access check.
![After Yes: winget finishes installing Node.js and the script installs Claude Code with npm, then moves on to [5/5]](/static/images/tut/one-click-install/202611/en/09-node-installing.webp)
Done right you will see: Successfully installed, then [OK] Claude Code installed, then the [5/5] line.
Check the access verification¶
The script sends one minimal request with your key. ① shows [OK] Access verified - the model responded normally. — that one line means the key, the address and your network all work together.
The line right under it points at probe.qcode.cc, where the same key shows usage and per-request details.
![[5/5] sends one minimal test request and reports [OK] Access verified (1), with the masked backup path in the summary below](/static/images/tut/one-click-install/202611/en/10-verified.webp)
Done right you will see: [OK] Access verified - the model responded normally.
Stuck? Config was written, but verification did not pass
The configuration is in place; only the last test request failed. Follow the status code printed above it: 401 means check the key in the Dashboard, 404 means check the address, a timeout means try another endpoint with -Domain asia. Then run the script again.
Read the summary¶
① is [OK] All set! Summary:, followed by what the run did — the endpoint, the method, and ② Connectivity [OK] verified. Once you see those, the window has done its job.
![The summary: endpoint api.qcode.cc, method user-level environment variables (1), and the connectivity line showing [OK] verified (2)](/static/images/tut/one-click-install/202611/en/11-summary.webp)
Done right you will see: Endpoint api.qcode.cc, Method user-level environment variables, Connectivity [OK] verified, and the sentence New PowerShell / terminal sessions pick this up automatically; restart editors such as VS Code.
Try claude in a new window¶
Environment variables only reach windows that start after they were written. Close this window, open Windows Terminal again and type:
claude
On a default Windows setup the first attempt can answer with the red text marked ①: claude : File C:\Users\user\AppData\Roaming\npm\claude.ps1 cannot be loaded because running scripts is disabled on this system. That is Windows' execution policy blocking a .ps1 script — not a failed install and not a key problem. The next step fixes it in one command.

Done right you will see either the Claude Code welcome screen, in which case skip the next step, or exactly that red cannot be loaded because running scripts is disabled on this system message.
Lift the script-execution limit once¶
In the same window run this and press Enter:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
It only affects your own account, needs no administrator rights, and is a one-time step. ① shows the command and, right below it, a clean prompt — no red text.

Done right you will see: the command echoed, no new red text, and a prompt like PS C:\Users\your-name> at ①.
Stuck? The policy command itself is refused
That happens when the machine-wide policy is managed by an administrator. Run the per-user form above in a normal (not elevated) window; if it still fails, ask whoever manages the PC, or call claude.cmd instead of claude.
Start Claude Code for the first time¶
Type claude again in that window. The first start walks you through a short setup: ① Welcome to Claude Code v2.1.330, ② the text-style question, where ③ Auto matches your terminal and is already selected — press Enter.
After that, press Enter through Security notes, and when it asks whether to trust the folder, move down to Yes, I trust this folder before pressing Enter: the default is No, exit.

Done right you will see: Welcome to Claude Code v2.1.330, the style picker with Auto marked, and after the questions the main screen.
Confirm it bills the API key, not an account¶
The two-line header at ① reads Claude Code v2.1.330 and Opus 5.5 · API Usage Billing. API Usage Billing means the session is using your QCode key; you were never asked to log in to Anthropic. That is the sign that the setup worked.
To leave, type /exit. To start working, type a question in the box at the bottom and press Enter.

Done right you will see: Claude Code v2.1.330, then a model name with API Usage Billing, then the folder you started it in.
Verify it works¶
All three of these should be true when you are done:
- The script's summary ended with
Connectivity [OK] verified. - In a new terminal window,
claudeopens the main screen withAPI Usage Billingin the header — no red text and no "command not found". - Nothing in Claude Code asked you to sign in to an account.
To see the requests themselves, enter the same key at probe.qcode.cc and watch the traffic arrive at QCode.
All done¶
Claude Code is installed on this PC and connected to QCode: open Windows Terminal, type claude and start working. From here you can:
- Claude Code full tutorial
- Codex setup
- Environment variables and config files
- Troubleshooting guide
- Compare the plans on the pricing page and pick the one that suits long-term use
- Go back to your Dashboard to check usage and balance
Common errors¶
| What you see | Why | What to do |
|---|---|---|
claude : File C:\Users\user\AppData\Roaming\npm\claude.ps1 cannot be loaded because running scripts is disabled on this system. |
Windows' default execution policy does not allow .ps1 scripts, and claude is one |
Run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once in the same window (step 15), then type claude again |
claude : The term 'claude' is not recognized as the name of a cmdlet |
The new command only exists in windows opened after the install, so this window's PATH is stale |
Close the window, open a new one and try again; if it persists, check that node --version prints 22 or higher |
'claude' is not recognized as an internal or external command |
The command was typed in Command Prompt, where the npm shims are not on PATH |
Use Windows PowerShell or Windows Terminal; the one-line command in step 2 does not run in Command Prompt |
API Error: 401 |
The key is invalid, expired, or was copied incompletely | Check the key in the Dashboard and run the script again; a monthly plan key cannot be renewed once expired, so open a new plan and create a new key. A Pay-as-you-go Pack key comes back on its own when you buy another pack, same key |
Invalid URL (POST /v1/v1/messages) in a 404 body |
ANTHROPIC_BASE_URL ends in /v1, and Claude Code appends its own path |
Set the address to exactly https://api.qcode.cc/api, with no trailing slash and no /v1, then open a new terminal or run the script again |
[ ! ] Node.js not found |
Node.js is missing or older than v22, which the Claude Code installer needs | Answer Y to the Install Node.js LTS with winget? prompt (step 9); without winget, install the LTS build from https://nodejs.org/download and run the script again |
FAQ¶
Do I need administrator rights to run the script?¶
No. The script writes user-level environment variables and installs into your own user folder. The single exception is the Node.js installer, which raises one User Account Control prompt; you answer it once and the rest of the run stays unelevated.
Where does the script put the settings?¶
On Windows, four user-level environment variables: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC and CLAUDE_CODE_AUTO_MODE_SERVER. Previous values are copied to a file under %USERPROFILE%\.qcode\ first. If you pass -Model, a fifth variable, ANTHROPIC_MODEL, is written as well. The full table is in What files are written.
What happens when my key expires?¶
It depends on the key. A monthly personal plan key cannot be renewed once it has expired: open a new plan and create a new key, then paste the new key into the script. A Pay-as-you-go Pack key comes back by itself when you buy another pack — the same key keeps working, no new key is needed.
The script asked whether to change the env block of settings.json. Should I accept?¶
Yes, if that block points at another provider. The env block takes precedence over environment variables, so Claude Code would keep calling the other address even though the script's own check passes. Accepting makes the script back the file up and change only the endpoint keys. Declining leaves the summary yellow and the exit code at 1.
Can I use the same command on macOS or Linux?¶
No, the installers differ: macOS and Linux use a shell script and write a managed block into your shell config. The command is in the macOS / Linux section below; the key, the endpoint choice and the verification work the same way.
Why is the recommended endpoint not api.qcode.cc?¶
The bracket in the prompt only reflects this run's latency measurement, and asia.qcode.cc or us.qcode.cc can come out ahead. All three serve the same models with the same key, so either choice works; type 1 if you want api.qcode.cc anyway.
🍎 macOS / 🐧 Linux¶
Open a terminal and paste the command for your tool (no sudo needed). To read it first, open https://qcode.cc/install/claude-code.sh — Codex is https://qcode.cc/install/codex.sh.
Claude Code¶
curl -fsSL https://qcode.cc/install/claude-code.sh | bash
Codex¶
curl -fsSL https://qcode.cc/install/codex.sh | bash
Configuration goes into your shell config file — a managed block in ~/.zshrc or ~/.bashrc, or conf.d/qcode.fish for fish — or into ~/.codex/ for Codex. If Node.js is missing, it is installed into your home directory with nvm.
⚠️ If the script says it detected
sudo, dropsudoand run it again. It does not need it, and running it withsudowrites the configuration into root's home directory, where your own shell will never read it.
No irm, or blocked by the execution policy¶
The script already relaxes the execution policy for its own run only and leaves your user-level and machine-level settings untouched, and it prefers npm.cmd over the policy-restricted npm.ps1. For the remaining cases:
1. In Command Prompt, or when irm is not recognized
irm only exists in PowerShell. This form works in both shells:
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://qcode.cc/install/claude-code.ps1 | iex"
2. To run it by double-clicking, or when iex is blocked
Download the .cmd bootstrapper and double-click it, or run it from Command Prompt:
curl -fsSL https://qcode.cc/install/claude-code.cmd -o "%TEMP%\qcode.cmd" && "%TEMP%\qcode.cmd"
Windows 10 1803 and newer ship curl.exe. The bootstrapper uses PowerShell 7 when it is installed, forces TLS 1.2 and keeps the window open at the end, so a double-click never flashes past. Add en for the English interface: "%TEMP%\qcode.cmd" en. For Codex, replace claude-code with codex.
3. So that claude also runs in later windows
The relaxation above covers only that one run. Run this once — no administrator rights, it affects only your account:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Windows notes¶
- The configuration lives in user-level environment variables (Codex writes
%USERPROFILE%\.codex\); previous values are backed up to%USERPROFILE%\.qcode\ - When Node.js is missing, the script installs the LTS release with winget; without winget it points you at nodejs.org
- Newly opened PowerShell windows and terminal tabs pick the configuration up automatically. Windows that were already open do not, and editors such as VS Code need one restart
- If a new window reports that scripts are disabled, run
Set-ExecutionPolicy -Scope CurrentUser RemoteSignedonce (step 15) and try again
Interface language¶
The scripts follow your Windows display language and switch between English and Chinese on their own. The priority is the display language (Get-UICulture), then the regional format (Get-Culture), then Chinese — so a Chinese Windows with the regional format set to English still shows the Chinese interface.
To force one, set the variable before running, or pass the flag:
# Windows PowerShell
$env:QCODE_LANG='en'; irm https://qcode.cc/install/claude-code.ps1 | iex
# macOS / Linux
curl -fsSL https://qcode.cc/install/claude-code.sh | bash -s -- --lang en
Chinese is the default, and the plain commands above are unaffected. The same applies to codex.
Codex: desktop App or CLI¶
codex.sh / codex.ps1 first asks which client you plan to use:
- Codex desktop App (default, just press Enter) — writes the config files only; Node.js and the CLI are neither checked nor installed
- Codex CLI — also applies to the App; installs Node.js and the Codex CLI as needed
If you only use the desktop App, pick 1 and Node.js is never touched. Re-run the script and pick 2 whenever you later want the CLI. Non-interactive: --target app / --target cli (Windows: -Target app / -Target cli).
ℹ️ If
~/.codex/config.tomlalready exists, the script only updatesmodel_provider/model/review_model/model_reasoning_effortand the[model_providers.qcode]table. Your MCP servers, profiles,approval_policyand other settings are kept, and the original is backed up as.bak.<timestamp>in the same directory first. Only a file that cannot be merged safely is overwritten as a whole, and the script says so. A top-levelprofile = …(no longer supported by current Codex) is commented out; to keep using that profile, move the[profiles.<name>]table into~/.codex/<name>.config.toml, delete the original table, then runcodex --profile <name>. Acrstable written by an older version of the script is renamed toqcodeautomatically.
What the script does¶
- Latency-based endpoint selection — sends one lightweight request to each of the three endpoints (api / asia / us) and recommends the fastest; you can override the choice.
-Domain euis an old alias forus: with it the script skips the measurement and maps straight tous.qcode.cc - Write the configuration — Claude Code: a managed shell block on macOS and Linux, user-level environment variables on Windows; Codex:
~/.codex/config.toml+auth.json(the default model is chosen interactively,gpt-6.2-solrecommended,gpt-6.2-astrafor top-tier reasoning) - Install the environment (skippable) — checks Node.js (≥ 22 for Claude Code, ≥ 20 for Codex), installs the LTS release via nvm or winget when it is missing or older, then installs the CLI with
npm install -g; everything stays in your user directory - Verify connectivity — sends a minimal request with your key and, on failure, gives targeted hints based on the HTTP status code
- Back up before writing — every modified file is first backed up as
.bak.<timestamp>; on Windows the previous environment variables go to%USERPROFILE%\.qcode\ - Key sanitising — surrounding quotes, whitespace and full-width punctuation pasted along with the key are stripped automatically; a key with invalid characters in the middle is rejected instead of being written into your configuration
Non-interactive mode (CI / no prompts)¶
macOS / Linux:
curl -fsSL https://qcode.cc/install/claude-code.sh | bash -s -- --key cr_xxxxxxxx --yes
| Flag | Description |
|---|---|
--key <cr_...> |
API key; when provided, skips the interactive prompt |
--domain <name> |
Pin the endpoint (api, asia or us; eu is the same as us), skipping the latency test |
--model <id> |
Codex: set the default model (such as gpt-6.2-sol or gpt-6.2-astra), skipping the picker; Claude Code: pin the default model (writes ANTHROPIC_MODEL — claude-opus-5-5 for everyday default, claude-sonnet-5-5 balanced, claude-haiku-5-5 lightweight, claude-fable-5-2 high-end) — omit it to keep the Claude Code default, which follows its upgrades |
--lang <code> |
Interface language, zh or en; follows the system locale by default |
--target <name> |
(codex only) app for config only, cli to also install the CLI; asks interactively by default |
--yes / -y |
Accept the default for every confirmation |
--no-install |
Write configuration only, do not install Node / CLI |
--no-verify |
Skip connectivity verification |
--dry-run |
Print what would be written, installed and verified; write no files, install nothing, send no verify request |
--uninstall |
Remove the settings this script wrote (does not uninstall Node / CLI); --yes skips the prompt |
--help |
Show all flags |
Windows with parameters (-Key, -Domain, -Model, -Lang, -Target, -Yes, -NoInstall, -NoVerify, -DryRun, -Uninstall):
& ([scriptblock]::Create((irm https://qcode.cc/install/claude-code.ps1))) -Key cr_xxxxxxxx -Yes
(Same pattern for codex.ps1.)
⚠️
-Uninstallcannot be combined with-Key/-Domain/-Model/-Mirror/-NoInstall/-NoVerify. For an uninstall, pass-Uninstallalone, plus-Yesif you want to skip the confirmation.
Preview the plan first: -DryRun¶
With --dry-run (Windows: -DryRun) the script only prints its plan: which file the settings go to, the full managed block with the key masked as cr_**** plus its last four characters, the keys it would sync in ~/.claude/settings.json, Codex's config.toml and auth.json, the software it would install, and the verify request it would send.
It writes no files, installs nothing and sends no verify request; it only runs the latency probe, and skips even that when you pass --domain. Without a key it uses a placeholder instead of stopping to ask. Because the probe still runs, the BASE_URL printed here can differ from the one you get in a normal run — that is expected.
& ([scriptblock]::Create((irm https://qcode.cc/install/claude-code.ps1))) -DryRun
The first band in the screenshot is the dry-run: printing the plan only. No files, no install, no verify request. line. The middle band is the list of user-level variables it would write, key masked, plus the note Windows does not write a shell block; the variables above are what would be written. The bottom band is the request it would send: Would verify (not sent): POST https://api.qcode.cc/api/v1/messages model=claude-haiku-5-5.

One detail: in this version the placeholder for a missing key still reads cr_****<未提供>, and the uninstall list keeps the label 用户环境变量. Those strings were not translated in the English build; nothing is wrong with your setup.
Uninstall: -Uninstall¶
--uninstall (Windows: -Uninstall) removes the settings this script wrote whose values still match. It does not remove Node or the CLI, and at the end it prints the matching npm uninstall -g … command for you to run yourself. It lists what it will change and asks first; --yes (Windows: -Yes) skips the question. Combined with --dry-run it only lists them.
curl -fsSL https://qcode.cc/install/claude-code.sh | bash -s -- --uninstall
curl -fsSL https://qcode.cc/install/codex.sh | bash -s -- --uninstall --yes
& ([scriptblock]::Create((irm https://qcode.cc/install/claude-code.ps1))) -Uninstall
& ([scriptblock]::Create((irm https://qcode.cc/install/codex.ps1))) -Uninstall -Yes
On Windows it starts with Will remove the settings this script wrote: and lists the four variables, then asks Delete the settings above? [y/N]:. Type y and press Enter to delete them; a bare Enter cancels.
![-Uninstall listing the four user environment variables it would remove, then asking Delete the settings above? [y/N]](/static/images/tut/one-click-install/202611/en/17-uninstall-prompt.webp)
- Claude Code (macOS / Linux): the
# >>> qcode.cc claude-code >>>managed block in your shell config files (for fish, the same block inconf.d/qcode.fish); in theenvof~/.claude/settings.json, anANTHROPIC_BASE_URLonqcode.ccand the matchingANTHROPIC_AUTH_TOKEN. - Claude Code (Windows): the user-level environment variables the script set, only where the value still matches; old values are backed up to
%USERPROFILE%\.qcode\first.ANTHROPIC_MODELis kept — delete it yourself if you want. - Codex: the
[model_providers.qcode]table and the top-level keys this script wrote inconfig.toml(keys whose values no longer match are kept and reported), and theOPENAI_API_KEYthis script wrote inauth.json.
Another provider's address and key, your other settings and the CLI's PATH entry are all kept, and every file it changes is backed up as .bak.<timestamp> first. When there is nothing to remove it prints No settings written by this script were found. and exits normally. Environment variables in terminals that are already open disappear only in a new terminal.
What files are written and how to roll back¶
| Tool / platform | Written to | Rollback |
|---|---|---|
| Claude Code (macOS / Linux) | The # >>> qcode.cc claude-code >>> managed block in ~/.zshrc or ~/.bashrc |
Delete the whole managed block, or restore the .bak.<timestamp> backup in the same directory |
| Claude Code (Windows) | 4 user-level environment variables (ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN / CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC / CLAUDE_CODE_AUTO_MODE_SERVER), plus ANTHROPIC_MODEL when -Model is used |
Restore the previous values from %USERPROFILE%\.qcode\backup-*.json; ANTHROPIC_MODEL is not restored by default |
| Codex (all platforms) | ~/.codex/config.toml + ~/.codex/auth.json |
Restore the .bak.<timestamp> backup in the same directory |
Claude Code (only when the env block of ~/.claude/settings.json points at another provider) |
ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN in that block (ANTHROPIC_API_KEY becomes ANTHROPIC_AUTH_TOKEN), changed only after you confirm |
Restore the .bak.<timestamp> backup in the same directory |
Re-running the script is always safe: the managed block is updated in place and config files are backed up before they change.
Related docs¶
- Endpoints and API paths
- Subscriptions vs API keys vs QCode keys
- Billing
- Payment methods
- Troubleshooting
Get started with QCode
One API key for Claude Code, Codex and more — billed per token, per-model prices on qcode.cc/models