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.

Updated 2026-11-26

Need an API key? Sign up →Endpoints & base URLs →

On This Page

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.

  • Applies to: Windows 10 / 11 (64-bit) and macOS; the screenshots come from Windows 11 with the English interface
  • Software version: one-click script v2026.11.21.1 · Claude Code 2.1.330 · Node.js 26.13.1
  • Screenshots updated: 2026-11
  • Time needed: about 10 minutes; a first-time Node.js download adds a few minutes
  • You will need: a QCode API key starting with cr_, and a working internet connection

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 PowerShell or Terminal
  • 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.cc and probe.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 .msi from https://nodejs.org/download.
  • The script comes from qcode.cc and opens normally. If the latency line for api.qcode.cc looks slow, type 2 or 3 at the endpoint prompt to use asia.qcode.cc or us.qcode.cc instead.

Mainland China

  • Windows PowerShell is already on the PC, so nothing has to be installed first. For a nicer window, install Windows Terminal from the Microsoft Store, or run winget install Microsoft.WindowsTerminal.
  • Node.js normally arrives through winget. If the script says winget not found, or winget cannot download it, install the LTS .msi from https://nodejs.org/download (ARM64 on a Snapdragon laptop) and run the script again. If nodejs.org is slow, the same version is mirrored on nodejs.cn and npmmirror.com/mirrors/node/.
  • When registry.npmjs.org does not answer, the script switches npm to https://registry.npmmirror.com by itself; you can also ask for it with -Mirror cn.
  • The script itself is served from qcode.cc and 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.cc and opens normally. At the endpoint prompt, pick whichever of api.qcode.cc, asia.qcode.cc or us.qcode.cc showed the lowest latency.

Russia / Iran

  • The Store, winget and https://nodejs.org/download normally work; when nodejs.org does not open, use the same version from nodejs.cn or npmmirror.com/mirrors/node/.
  • The script comes from qcode.cc and opens normally. Pick the endpoint with the lowest latency at the prompt in step 4.
  • Want to read the plan before anything happens? The -DryRun section 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.

PowerShell inside Windows Terminal: the tab says Windows PowerShell and the prompt starts with PS, both marked with orange numbers

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)

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.

Three latency lines with numbers in brackets (1) and the question asking which endpoint to use, with the recommendation in brackets (2)

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)

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.

The API key prompt after pasting: only asterisks are shown where the key was typed (the asterisks are masked in this image)

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.

After Enter: the key accepted line showing only the last four characters (1), and below it the backup and write lines (2)

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.

The line listing the four user-level environment variables that were written, and above it the backup path for previous values

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)

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.

The winget question for Node.js LTS (2) below the npm question, with the Node.js not found notice in between

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.

The English User Account Control prompt for Node.js: the question (1), publisher OpenJS Foundation and file origin (2), and the Yes button (3)

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]

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

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)

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.

Running claude in a fresh window: red text saying the file claude.ps1 cannot be loaded because running scripts is disabled on this system

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.

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned returning cleanly and giving the prompt back (1)

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.

First start of Claude Code: Welcome to Claude Code v2.1.330 (1), the text style question (2) and the Auto option that is already selected (3)

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.

The Claude Code main screen header: Claude Code v2.1.330 on one line and Opus 5.5 · API Usage Billing on the next, showing the key is being used (1)

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, claude opens the main screen with API Usage Billing in 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:

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.

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, drop sudo and run it again. It does not need it, and running it with sudo writes 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 RemoteSigned once (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:

  1. Codex desktop App (default, just press Enter) — writes the config files only; Node.js and the CLI are neither checked nor installed
  2. 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.toml already exists, the script only updates model_provider / model / review_model / model_reasoning_effort and the [model_providers.qcode] table. Your MCP servers, profiles, approval_policy and 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-level profile = … (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 run codex --profile <name>. A crs table written by an older version of the script is renamed to qcode automatically.

What the script does

  1. 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 eu is an old alias for us: with it the script skips the measurement and maps straight to us.qcode.cc
  2. 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-sol recommended, gpt-6.2-astra for top-tier reasoning)
  3. 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
  4. Verify connectivity — sends a minimal request with your key and, on failure, gives targeted hints based on the HTTP status code
  5. Back up before writing — every modified file is first backed up as .bak.<timestamp>; on Windows the previous environment variables go to %USERPROFILE%\.qcode\
  6. 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.)

⚠️ -Uninstall cannot be combined with -Key / -Domain / -Model / -Mirror / -NoInstall / -NoVerify. For an uninstall, pass -Uninstall alone, plus -Yes if 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.

-DryRun printing the plan only: the dry-run notice, the user-level variables with the key masked, and the verify request that would be sent but is not

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]

  • Claude Code (macOS / Linux): the # >>> qcode.cc claude-code >>> managed block in your shell config files (for fish, the same block in conf.d/qcode.fish); in the env of ~/.claude/settings.json, an ANTHROPIC_BASE_URL on qcode.cc and the matching ANTHROPIC_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_MODEL is kept — delete it yourself if you want.
  • Codex: the [model_providers.qcode] table and the top-level keys this script wrote in config.toml (keys whose values no longer match are kept and reported), and the OPENAI_API_KEY this script wrote in auth.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.

Get started with QCode

One API key for Claude Code, Codex and more — billed per token, per-model prices on qcode.cc/models

Enterprise →