# Install Claude Code Manually on Windows 11 and Connect to QCode


**Short answer**: Install Node.js and Claude Code in Windows Terminal on Windows 11, set user environment variables `ANTHROPIC_BASE_URL` to `https://api.qcode.cc/api` and `ANTHROPIC_AUTH_TOKEN` to `cr_xxxxxxxx`, reopen the terminal, and run `claude`.

| Setting | Value |
|---|---|
| Base URL | `https://api.qcode.cc/api` |
| API Key | `cr_xxxxxxxx` |
| Install command | `npm install -g @anthropic-ai/claude-code` |
| Launch command | `claude` |

Verified on 2026-11-22 · Claude Code 2.1.330 · Windows 11


By the end of this guide, your Windows 11 PC will have Node.js and Claude Code installed and connected to QCode—just open **Windows Terminal**, `cd` into any project folder, and run `claude` to chat and edit project files without an Anthropic account.

Prefer to configure everything automatically in one command? Use the [One-Click Setup Script](/docs/getting-started/one-click-install). If you want to install each piece manually and see every screen along the way, keep reading.


- **Supported OS**: Windows 10 / 11 (64-bit); see macOS and Linux at the end of this guide
- **Software version**: Node.js v26.13.1 LTS (22 LTS or newer recommended) · npm 11.20.0 · Claude Code 2.1.330
- **Screenshots updated**: 2026-11
- **Estimated time**: About 20 minutes (depends on download speed for Node.js and npm packages)
- **What you need**: A QCode API key (starts with `cr_`); access to `nodejs.org`



- A 64-bit Windows 10 or Windows 11 PC that can open **Windows Terminal** or **Windows PowerShell**
- A QCode.cc account with an API key starting with `cr_` copied from the [Dashboard](https://qcode.cc/en/dashboard). Don't have an account yet? [Sign up for QCode](https://qcode.cc/en/auth/sign-up?utm_source=docs.qcode.cc&utm_medium=tut_before&utm_campaign=knowledge_base&src=docs-getting-started-installation-before), pick a plan on the [Pricing page](https://qcode.cc/en/pricing?utm_source=docs.qcode.cc&utm_medium=tut_before&utm_campaign=knowledge_base&src=docs-getting-started-installation-before), and create your key in the [Dashboard](https://qcode.cc/en/dashboard).
- Access to `nodejs.org` (if it does not load, check the regional tabs under **Download and install** below)
- About 20 uninterrupted minutes to download and install Node.js and Claude Code


## Download and install

Manual installation only needs two pieces:

- **Node.js**: Download the Windows `.msi` installer from [nodejs.org/en/download](https://nodejs.org/en/download). Pick **x64** for standard Intel or AMD PCs, or **ARM64** for Windows on ARM devices.
- **Claude Code**: Installed globally via npm with `npm install -g @anthropic-ai/claude-code` (requires Node.js 22 LTS or newer).

Using Claude Code through QCode only requires a QCode API key—no Anthropic account is needed. Set your base URL to `https://api.qcode.cc/api` (Anthropic-compatible). If you also configure tools that expect the OpenAI-compatible format, use `https://api.qcode.cc/openai/v1`. Two optional regional endpoints, `https://asia.qcode.cc/api` and `https://us.qcode.cc/api`, work identically—use whichever gives you lower latency. See [Endpoints & API Paths](/docs/getting-started/endpoints-and-api-paths) for full details.

Want to skip manual downloads and run the automated script instead? Run the command for your OS (see [One-Click Setup Script](/docs/getting-started/one-click-install) for flags and rollback):

```powershell
# Windows PowerShell
irm https://qcode.cc/install/claude-code.ps1 | iex
```

```bash
# macOS / Linux
curl -fsSL https://qcode.cc/install/claude-code.sh | bash
```

Download access differs slightly by region—choose your region below:

**Global (US / Europe / Japan)**

- Open [nodejs.org/en/download](https://nodejs.org/en/download), select **Windows** and **x64** (or **ARM64**), and download **Windows Installer (.msi)**.
- Use the default official npm registry (`registry.npmjs.org`) when installing Claude Code.


**Mainland China**

- Access to `nodejs.org` can be intermittent. If it opens, follow the screenshots below; otherwise download the matching `.msi` from **nodejs.cn** or `npmmirror.com/mirrors/node/`.
- If `npm install` stalls, switch to the mirror registry first with `npm config set registry https://registry.npmmirror.com`, then run the install command again.
- Installing the npm package does not require an Anthropic account.


**Arab Countries**

- Use the same download path as **Global (US / Europe / Japan)**: download the Windows `.msi` from [nodejs.org/en/download](https://nodejs.org/en/download) and install Claude Code from the default npm registry.


**Russia / Iran**

- `nodejs.org` usually loads directly; if it does not, download the matching `.msi` from **nodejs.cn** or `npmmirror.com/mirrors/node/`.
- If npm downloads time out or hang, run `npm config set registry https://registry.npmmirror.com` and retry the install command.


If you already use `winget`, you can also install Node.js in PowerShell with `winget install OpenJS.NodeJS.LTS`, then jump straight to Step 10 below.

## Step-by-step on Windows 11

The 23 steps below do one thing per step. The orange circled numbers (①, ②, ③) match the exact callouts on each screenshot.



### Open the Node.js website

Open Microsoft Edge and go to `https://nodejs.org/en/`. In the middle of the page, ① is the green **"Get Node.js"** button, and the footer at ② shows the current LTS version `v26.13.1` (seeing a newer LTS number is normal). Click ① to open the download page.

![Node.js English homepage showing the green Get Node.js button and v26.13.1 Latest LTS in the footer](https://docs.qcode.cc/static/images/tut/installation/202611/en/01-node-home.webp)


You did it right when the address bar shows `nodejs.org/en/`, the green **"Get Node.js"** button is visible in the center, and the footer lists `v26.13.1 Latest LTS` (or newer).


**Stuck? The page keeps spinning or will not load**

Download the same Windows `.msi` from **nodejs.cn** or `npmmirror.com/mirrors/node/` instead. Once Node.js is installed, continue from Step 10.




### Select Windows x64 and download the installer

On the download page, confirm the version selector at ① shows `v26.13.1` with **LTS**, and that the prebuilt package section below it is set to **Windows** and **x64** (switch **x64** to **ARM64** on Windows on ARM PCs). Click **"Windows Installer (.msi)"** at ② to start the download.

![Node.js download page with v26.13.1 LTS selected and the Windows Installer (.msi) download button](https://docs.qcode.cc/static/images/tut/installation/202611/en/02-node-download.webp)


You did it right when the selectors show `v26.13.1 LTS`, `Windows`, and `x64`, and Edge starts downloading the `.msi` file in the top-right corner.




### Confirm the download finished and open the installer

Edge's **Downloads** panel shows `node-v26.13.1-x64.msi` (about 34.9 MB) at ①. Click the file name (or **"Open file"** below it) to launch the installer; if the panel has already closed, double-click the file in your **Downloads** folder. ② is the **"Windows Installer (.msi)"** button on the page if you need to trigger the download again.

![Edge Downloads panel showing node-v26.13.1-x64.msi ready to open alongside the Windows Installer (.msi) button](https://docs.qcode.cc/static/images/tut/installation/202611/en/03-node-downloaded.webp)


You did it right when `node-v26.13.1-x64.msi` appears in the **Downloads** panel and clicking it opens the **Node.js Setup** window.




### Click Next on the Welcome screen

The installer opens on the Welcome screen showing `Welcome to the Node.js Setup Wizard` at ①. Click **"Next"** at ② to continue; you will keep the default choices through the rest of the wizard.

![Node.js Setup Wizard Welcome screen with the Next button in the bottom right](https://docs.qcode.cc/static/images/tut/installation/202611/en/04-setup-welcome.webp)


You did it right when the window title reads **Node.js Setup** and the heading shows `Welcome to the Node.js Setup Wizard`.




### Accept the License Agreement

Check **"I accept the terms in the License Agreement"** at ①, then click **"Next"** at ②.

![Node.js Setup End-User License Agreement page with the acceptance checkbox ticked and Next button](https://docs.qcode.cc/static/images/tut/installation/202611/en/05-setup-license.webp)


You did it right when the checkbox has a checkmark and the **"Next"** button becomes clickable.




### Keep the default folder and verify Add to PATH

On the **Destination Folder** page, keep the default path `C:\Program Files\nodejs\` and click **"Next"**. On **Custom Setup**, verify that **"Add to PATH"** at ① stays enabled (no red X icon) so new terminals can find `node` and `npm`, then click **"Next"** at ②.

![Node.js Custom Setup screen with Add to PATH enabled and the Next button](https://docs.qcode.cc/static/images/tut/installation/202611/en/06-setup-path.webp)


You did it right when **"Add to PATH"** displays a drive icon (not a red X) and the installation folder is `C:\Program Files\nodejs\`.




### Skip Tools for Native Modules

The **Tools for Native Modules** page offers to install Chocolatey and Visual Studio build tools. Claude Code does not need them—leave the checkbox at ① unchecked and click **"Next"** at ②.

![Node.js Setup Tools for Native Modules page with the checkbox left unchecked and the Next button](https://docs.qcode.cc/static/images/tut/installation/202611/en/07-setup-native-tools.webp)


You did it right when the checkbox remains empty and clicking **"Next"** moves straight to the confirmation screen.




### Click Install and approve UAC

The **Ready to install Node.js** confirmation page is shown at ①. Click **"Install"** at ②. Windows then shows a **User Account Control** (UAC) prompt—verify the publisher is `OpenJS Foundation` and click **"Yes"** (or press `Alt+Y`). This is the only step in the tutorial that requires administrator permission.

![Ready to install Node.js confirmation screen with the Install button](https://docs.qcode.cc/static/images/tut/installation/202611/en/08-setup-ready.webp)


You did it right when the UAC dialog shows publisher `OpenJS Foundation` and clicking **"Yes"** starts the installation progress bar.


**Stuck? You clicked "No" on the UAC prompt by mistake**

The installer cancels without changing your system. Double-click the downloaded `.msi` file again, click through to this screen, click **"Install"**, and choose **"Yes"** when UAC appears.




### Click Finish to close the wizard

When installation finishes, ① shows `Completed the Node.js Setup Wizard`. Click **"Finish"** at ② to close the setup window.

![Completed the Node.js Setup Wizard screen with the Finish button](https://docs.qcode.cc/static/images/tut/installation/202611/en/09-setup-finish.webp)


You did it right when the wizard closes and `C:\Program Files\nodejs\node.exe` exists on your PC.




### Open Windows Terminal, enter a project folder, and check node

Close Edge and open **Windows Terminal** from the Start menu (it opens in a **Windows PowerShell** tab by default). Run ① `cd C:\demo-hello` to enter an empty project folder (or `cd` into your own existing project folder), then run `node --version` at ②—it prints `v26.13.1`, confirming Node.js is installed and on `PATH`.

![Windows Terminal PowerShell tab running cd C:\demo-hello and node --version returning v26.13.1](https://docs.qcode.cc/static/images/tut/installation/202611/en/10-terminal-node-npm.webp)


You did it right when the prompt shows `PS C:\demo-hello>` and `node --version` prints `v26.13.1` (or any version `v22` or higher).


**Stuck? PowerShell says node is not recognized**

The new `PATH` entry only loads in terminal windows opened after installation. Close **Windows Terminal**, open a fresh window, and run `node --version` again. If it still fails, rerun the Node.js `.msi` and verify **"Add to PATH"** is enabled on the **Custom Setup** page.




### Run npm --version and expect an execution policy error

Next, run `npm --version`. At ③, PowerShell displays a red error: `File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system.` This is not a broken install—Windows blocks `.ps1` scripts in PowerShell by default, and `npm` runs through a `.ps1` wrapper. You will fix it with one command in the next step.

![Windows PowerShell blocking npm --version with the red execution policy error for npm.ps1](https://docs.qcode.cc/static/images/tut/installation/202611/en/10-terminal-node-npm.webp)


You did it right when the red message mentions `npm.ps1` and `running scripts is disabled on this system`, then returns to the `PS C:\demo-hello>` prompt. (If `npm --version` already prints a version number like `11.20.0`, your execution policy is already configured—skip ahead to Step 13.)


**Stuck? The red error names claude.ps1 instead**

It has the exact same cause. Running the `Set-ExecutionPolicy` command in Step 12 fixes both `npm.ps1` and `claude.ps1` without reinstalling anything.




### Allow PowerShell scripts for your user account

In the same PowerShell window, run ① `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser` and press Enter. This only applies to your Windows account, needs no administrator rights, and only has to be run once. Run `npm --version` again—at ② it now prints `11.20.0`.

![Running Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser followed by npm --version printing 11.20.0](https://docs.qcode.cc/static/images/tut/installation/202611/en/11-policy-fix.webp)


You did it right when `Set-ExecutionPolicy` finishes with no red error and `npm --version` outputs `11.20.0`.


**Stuck? Access denied when changing execution policy**

Check that `-Scope CurrentUser` is at the end of the command. Do not omit it—with `-Scope CurrentUser`, the command runs in a regular PowerShell window with no administrator prompt.




### Type the Claude Code install command

At the prompt ①, type `npm install -g @anthropic-ai/claude-code` (do not press Enter yet until you double-check the package name). This command downloads Claude Code from npm and installs the `claude` CLI globally so you can run it from any folder.

![PowerShell prompt with npm install -g @anthropic-ai/claude-code typed and ready to run](https://docs.qcode.cc/static/images/tut/installation/202611/en/12-npm-install-command.webp)


You did it right when the line reads `npm install -g @anthropic-ai/claude-code` exactly, with the cursor at the end.




### Press Enter and wait for the installation to finish

Press Enter to run the command at ①. npm downloads the package and finishes with `added 2 packages` at ② (the time varies by network). You can safely ignore the yellow `npm warn install-scripts` lines underneath—they are an npm 11 informational warning and do not affect `claude`.

![npm install -g @anthropic-ai/claude-code completed with added 2 packages and yellow npm warn install-scripts lines](https://docs.qcode.cc/static/images/tut/installation/202611/en/13-npm-install-done.webp)


You did it right when the output shows `added 2 packages`, followed by the yellow `npm warn` lines and a fresh PowerShell prompt.


**Stuck? The download hangs with no progress**

Switch npm to a mirror registry with `npm config set registry https://registry.npmmirror.com`, then run `npm install -g @anthropic-ai/claude-code` again. On a corporate network or behind antivirus inspection, hanging output or TLS errors may require switching networks.




### Verify that Claude Code is installed

Run `claude --version`. At ①, PowerShell prints `2.1.330 (Claude Code)`, confirming both the global npm package and `PATH` are working. The first run can take 10–20 seconds before printing output—that is normal.

![PowerShell running claude --version and printing 2.1.330 (Claude Code)](https://docs.qcode.cc/static/images/tut/installation/202611/en/14-claude-version.webp)


You did it right when you see a single line reading `2.1.330 (Claude Code)`.




### Save the QCode base URL to your user environment

Run the command at ① to save `ANTHROPIC_BASE_URL` permanently for your Windows user account so every future terminal window inherits it:

```powershell
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.qcode.cc/api", [System.EnvironmentVariableTarget]::User)
```

No output and an immediate return to the prompt means it succeeded.

![PowerShell running SetEnvironmentVariable to save ANTHROPIC_BASE_URL as https://api.qcode.cc/api for the current user](https://docs.qcode.cc/static/images/tut/installation/202611/en/15-env-permanent.webp)


You did it right when PowerShell returns directly to `PS C:\demo-hello>` with no error text.


**Stuck? Want to test in the current window only first?**

You can set a temporary session-only variable with `$env:ANTHROPIC_BASE_URL = "https://api.qcode.cc/api"`. It disappears when you close the window, so use the permanent `[System.Environment]::SetEnvironmentVariable` command above for daily work.




### Save your QCode API key from the clipboard

First copy your `cr_xxxxxxxx` API key from the [Dashboard](https://qcode.cc/en/dashboard) to your clipboard. Then run the command at ② to store it in `ANTHROPIC_AUTH_TOKEN` without ever showing the key on screen:

```powershell
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", (Get-Clipboard), [System.EnvironmentVariableTarget]::User)
```

Reading from `(Get-Clipboard)` keeps your real key out of terminal history and screenshots. Never paste your key into chats or screenshots.

![PowerShell running SetEnvironmentVariable to read ANTHROPIC_AUTH_TOKEN from Get-Clipboard without displaying the key](https://docs.qcode.cc/static/images/tut/installation/202611/en/15-env-permanent.webp)


You did it right when PowerShell returns to the prompt with no output and no `cr_` string visible on screen.


**Need an API Key?**

[Sign up for QCode](https://qcode.cc/en/auth/sign-up?utm_source=docs.qcode.cc&utm_medium=tut_key_step&utm_campaign=knowledge_base&src=docs-getting-started-installation-key), purchase a [pay-as-you-go pack](https://qcode.cc/en/pay-as-you-go?utm_source=docs.qcode.cc&utm_medium=tut_key_step&utm_campaign=knowledge_base&src=docs-getting-started-installation-key) if you want to start without a recurring plan, and create your API key in the [Dashboard](https://qcode.cc/en/dashboard). Copy the `cr_` key and run the command above. For supported payment options, see [Payment Methods](/docs/reference/payment-methods).




### Reopen PowerShell and verify both environment variables

User-level environment variables only apply to **newly opened** windows. Type `exit` to close Windows Terminal, open a new **Windows Terminal** window, and run `cd C:\demo-hello`. At ①, `echo $env:ANTHROPIC_BASE_URL` prints `https://api.qcode.cc/api`. At ②, run `echo $env:ANTHROPIC_AUTH_TOKEN.Length` to confirm the key is loaded (it prints a number such as `67`) without printing the secret itself.

![New PowerShell window printing https://api.qcode.cc/api for ANTHROPIC_BASE_URL and length 67 for ANTHROPIC_AUTH_TOKEN](https://docs.qcode.cc/static/images/tut/installation/202611/en/16-env-check.webp)


You did it right when the first output line is `https://api.qcode.cc/api` and the second line is a non-zero number (for example `67`).


**Stuck? The first line prints nothing**

Either the variable was not saved with `[System.EnvironmentVariableTarget]::User`, or the terminal was not fully closed and reopened. Repeat Steps 16 and 17, close all **Windows Terminal** windows, open a new one, and check again.




### Launch claude for the first time and pick a text style

Inside `C:\demo-hello`, type `claude` and press Enter. The welcome screen shows `Claude Code v2.1.330` at ① and asks you to `Choose the text style that looks best with your terminal` at ②. The default option **"Auto (match terminal)"** at ③ works cleanly with Windows Terminal—just press Enter.

![Claude Code v2.1.330 welcome screen prompting to choose a terminal text style with Auto (match terminal) highlighted](https://docs.qcode.cc/static/images/tut/installation/202611/en/17-claude-first-run.webp)


You did it right when you see `Claude Code v2.1.330` and the text style list with **"Auto (match terminal)"** selected.


**Stuck? Claude Code asks you to log in to an Anthropic account**

You do not need an Anthropic account when using QCode. A login prompt means your environment variables were not loaded—press `Ctrl+C` or type `/exit`, then return to Step 18 and confirm both `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN.Length` print values.




### Trust your project folder

Press Enter to pass the **Security notes** screen. Next, Claude Code displays `Accessing workspace: C:\demo-hello` and `Quick safety check: Is this a project you created or one you trust?` at ① and ②. The cursor starts on **"No, exit"**—press the Down arrow (`↓`) once to highlight **"Yes, I trust this folder"** at ③, then press Enter.

![Claude Code workspace safety check for C:\demo-hello with Yes, I trust this folder selected](https://docs.qcode.cc/static/images/tut/installation/202611/en/18-claude-trust.webp)


You did it right when the selection cursor moves to **"Yes, I trust this folder"** and pressing Enter opens the main screen.




### Check the main screen

At ①, the header displays `Claude Code v2.1.330` and `Opus 5.5 · API Usage Billing`—seeing `API Usage Billing` confirms Claude Code is using your API key rather than a web login. ② explains that `auto mode` is now the default permission mode, and ③ is the prompt box at the bottom where you type requests.

![Claude Code main screen showing Opus 5.5 API Usage Billing header, auto mode notice, and prompt input box](https://docs.qcode.cc/static/images/tut/installation/202611/en/19-claude-ready.webp)


You did it right when the header shows `Claude Code v2.1.330` and `Opus 5.5 · API Usage Billing`, and the cursor is ready in the input box.




### Send your first message

In the input box at ①, type `Hello, please introduce yourself in one sentence.` and press Enter. Claude responds in one sentence at ② and prints a timing line at ③, proving your API key, base URL, and network connection to QCode all work end to end.

![Claude Code replying in one sentence to a greeting with a timing line below](https://docs.qcode.cc/static/images/tut/installation/202611/en/20-claude-reply.webp)


You did it right when your prompt appears at the top, followed by a reply and a timing line—with no `401`, `404`, or timeout error.


**Stuck? You get a 401 or 404 error instead of a reply**

A `401` means your key was not loaded or was copied with extra spaces—return to Step 18 to verify `ANTHROPIC_AUTH_TOKEN.Length` and recopy the key if needed. A `404` means the base URL is wrong: it must be `https://api.qcode.cc/api` with no trailing `/` and no `/v1`.




### Ask Claude Code to create a file

Send one more test prompt at ①: `Create a file hello.txt in the current folder with the content hello.` Claude Code calls the `Write(hello.txt)` tool at ② and prints a completion summary at ③. Because `auto mode` is active by default, low-risk file writes run without asking for confirmation each time.

![Claude Code invoking the Write tool to create hello.txt and summarizing completion](https://docs.qcode.cc/static/images/tut/installation/202611/en/21-claude-write.webp)


You did it right when you see the `Write(hello.txt)` block and a summary confirming creation, and `C:\demo-hello\hello.txt` contains `hello`.




## Verify it works

Your installation is complete when all three checks pass:

- `node --version` prints `v26.13.1` (any version `v22` or newer works) and `npm --version` prints `11.20.0` (or newer).
- In a **newly opened** PowerShell window, `echo $env:ANTHROPIC_BASE_URL` returns `https://api.qcode.cc/api`.
- Running `claude` opens the main screen, answers a prompt cleanly, and creates `hello.txt` in your project folder.

If you want extra confirmation that requests are routing through QCode, open <https://probe.qcode.cc/> and check with your API key.


### All set

Node.js and Claude Code are installed on Windows 11 and connected to QCode. Next time, just open **Windows Terminal**, `cd` into your project folder, and run `claude`. Where to go next:

- [Claude Code Tutorial](/docs/getting-started/claude-code-tutorial)
- [Quick Start](/docs/getting-started/quick-start)
- [CLI Tips](/docs/usage/cli-tips)
- [Troubleshooting](/docs/reference/troubleshooting)
- Next: compare plans on the [Pricing page](https://qcode.cc/en/pricing?utm_source=docs.qcode.cc&utm_medium=tut_done&utm_campaign=knowledge_base&src=docs-getting-started-installation-done)
- Return to the [Dashboard](https://qcode.cc/en/dashboard) to check usage and balance


## Common errors

| Error message | Cause | Fix |
|---|---|---|
| `File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system.` | PowerShell's default execution policy blocks `.ps1` script shims, including `npm.ps1` and `claude.ps1`. | Run `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser` once in PowerShell, then retry `npm --version`. |
| `npm warn install-scripts 1 package has install scripts not yet covered by allowScripts: @anthropic-ai/claude-code@2.1.330 (postinstall: node install.cjs)` | An informational npm 11 warning for packages with postinstall scripts—not an installation failure. | No action needed. Run `claude --version`; if it prints the version, installation succeeded. |
| `claude : The term 'claude' is not recognized as the name of a cmdlet` | The terminal was opened before installation or the npm global bin folder is not on `PATH`. | Close and reopen **Windows Terminal**, then run `claude --version`. If it still fails, ensure `node --version` is `v22` or newer and rerun `npm install -g @anthropic-ai/claude-code`. |
| `Not logged in · Please run /login` | `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_BASE_URL` was not loaded in the current terminal session. | Close and reopen **Windows Terminal**, check `echo $env:ANTHROPIC_BASE_URL` and `echo $env:ANTHROPIC_AUTH_TOKEN.Length`, and repeat Steps 16 and 17 if either is empty. |
| `Please run /login   API Error: 401 Invalid authentication credentials` | The API key is truncated, has leading/trailing spaces, or has expired. | Copy the full `cr_` key again from the [Dashboard](https://qcode.cc/en/dashboard), rerun Step 17, and reopen **Windows Terminal**. If the key expired, see **What happens when my API key expires?** below. |
| `{"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}` | The key was stored in `ANTHROPIC_API_KEY` (sent as `x-api-key`) instead of `ANTHROPIC_AUTH_TOKEN` (sent as `Authorization: Bearer`). | Unset `ANTHROPIC_API_KEY`, store your QCode key in `ANTHROPIC_AUTH_TOKEN`, keep `ANTHROPIC_BASE_URL` set to `https://api.qcode.cc/api` (no `/v1`), and reopen PowerShell. |

## FAQ

### Running claude says the command is not recognized

Newly installed commands and updated `PATH` entries only load in **newly opened** terminals. Close **Windows Terminal**, open a fresh window, and run `claude` again. If it still fails, check that `node --version` is `v22` or newer and reinstall Node.js with **"Add to PATH"** enabled.

### Do I need to install Git?

No. Installing Node.js, npm, and Claude Code and connecting to QCode does not require Git. You only need Git later if you want Claude Code to inspect repository history or diffs.

### Do I have to cd into a project folder every time?

Yes. Claude Code treats the folder you launch it from as its workspace for reading and writing files. To switch projects, type `/exit`, `cd` into the other folder, and run `claude` again.

### What happens when my API key expires?

It depends on which type of key you have:

- **Personal plan keys** cannot be renewed after they expire. You need to start a new plan, create a new API key in the [Dashboard](https://qcode.cc/en/dashboard), and update `ANTHROPIC_AUTH_TOKEN` to the new key.
- **Pay-as-you-go pack keys** reactivate automatically after you purchase another pack—the same key resumes working and you do not need to change your environment variables.

### I changed environment variables, but Claude Code still connects to the old endpoint

If you previously configured another provider in `C:\Users\<username>\.claude\settings.json`, values inside its `env` block take precedence over Windows environment variables. Update or remove `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` in that file, then restart `claude`.

### How do I use the OpenAI-compatible format?

For tools that require an OpenAI-compatible endpoint, set the base URL to `https://api.qcode.cc/openai/v1` and keep the same QCode API key. See [Endpoints & API Paths](/docs/getting-started/endpoints-and-api-paths) for full details.

## macOS and Linux installation

The Windows walkthrough ends above. On macOS or Linux, the QCode configuration is identical—only the Node.js install and shell export commands differ. Node.js 22 LTS or newer is recommended on all platforms.

### macOS

```bash
# With Homebrew (recommended)
brew update
brew install node
brew install --cask claude-code

# Or download the macOS .pkg installer from:
# https://nodejs.org/en/download
```

You can also install Claude Code via npm (same as Windows):

```bash
npm install -g @anthropic-ai/claude-code
claude --version
```

Save the environment variables permanently in `~/.zshrc` (macOS default) or `~/.bash_profile` for bash:

```bash
# For zsh (macOS default)
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxx"' >> ~/.zshrc
source ~/.zshrc

# For bash
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.bash_profile
echo 'export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxx"' >> ~/.bash_profile
source ~/.bash_profile
```

For a temporary current-session test only:

```bash
export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"
export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxx"
```

Replace `cr_xxxxxxxx` with your key from the [Dashboard](https://qcode.cc/en/dashboard). If `npm install -g` hits a permission error, either run `sudo npm install -g @anthropic-ai/claude-code` or set a user-local prefix with `npm config set prefix ~/.npm-global` and add `~/.npm-global/bin` to your `PATH`. If macOS blocks an installer or binary, open **System Settings** → **Privacy & Security** and click **"Open Anyway"** or **"Allow"**.

### Linux / WSL2

```bash
# Ubuntu / Debian (NodeSource LTS repository)
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

npm install -g @anthropic-ai/claude-code
claude --version
```

On Fedora / RHEL / CentOS you can also run `sudo dnf install nodejs npm` (verify `node --version` is `v22` or newer afterward).

Save the environment variables permanently in `~/.bashrc` (or `~/.zshrc` if you use zsh):

```bash
# For bash (default)
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxx"' >> ~/.bashrc
source ~/.bashrc

# For zsh
echo 'export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxx"' >> ~/.zshrc
source ~/.zshrc
```

If native build dependencies are missing, install them first: `sudo apt install build-essential` (Ubuntu / Debian) or `sudo dnf groupinstall "Development Tools"` (CentOS / RHEL / Fedora).

### Verify on macOS and Linux

```bash
echo "$ANTHROPIC_BASE_URL"
cd /path/to/your/project
claude
```

The first command should print `https://api.qcode.cc/api`, and `claude` should open and reply to a prompt. Avoid echoing `$ANTHROPIC_AUTH_TOKEN` directly so your key never appears in terminal logs or screenshots.

## Advanced configuration (optional environment variables)

Beyond the two required variables, you can customize Claude Code with these optional settings:

### ANTHROPIC_MODEL

Specify the default model. We recommend setting Sonnet 5 explicitly. If unset, Claude Code uses its own built-in default for that CLI version—do not rely on a historical default name from this page. 4.x IDs such as `claude-sonnet-4-6` and `claude-opus-4-8` remain available.

```bash
# Daily recommendation (Sonnet 5)
export ANTHROPIC_MODEL=claude-opus-5-5

# Heavy work (Opus 5, higher cost)
export ANTHROPIC_MODEL=claude-opus-5-5
```

On Windows PowerShell (permanent user variable):

```powershell
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "claude-opus-5-5", [System.EnvironmentVariableTarget]::User)
```

### MAX_THINKING_TOKENS

Control the maximum tokens for the model's thinking process (set to `0` to disable):

```bash
export MAX_THINKING_TOKENS=16000
```

### CLAUDE_CODE_EFFORT_LEVEL

Adjust Claude's effort level:

```bash
# Options: low / medium / high
export CLAUDE_CODE_EFFORT_LEVEL=high
```

### CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC

Disable non-essential network requests (such as telemetry):

```bash
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
```

## Installing Node.js with a package manager (optional)

If you already use Chocolatey, Scoop, or winget on Windows, you can skip the `.msi` wizard (advanced option—beginners can skip this section):

```powershell
# Chocolatey
choco install nodejs

# Scoop
scoop install nodejs

# winget
winget install OpenJS.NodeJS.LTS
```

After installing, close and reopen **Windows Terminal**, then continue from Step 10 above.

## Next steps

Congratulations—you have installed Claude Code and connected it to QCode. Next:

1. Check out [Quick Start](/docs/getting-started/quick-start) to learn everyday workflows.
2. Explore [CLI Tips](/docs/usage/cli-tips) to work faster in the terminal.
3. Visit [Troubleshooting](/docs/reference/troubleshooting) if you run into issues later.