One-Click Setup Script
One command to fully configure Claude Code / Codex: latency-based endpoint selection, config writing, CLI installation and connectivity verification — no sudo / admin rights required
One-Click Setup Script¶
Go from zero to working with a single command: the script picks the fastest endpoint via a latency test, prompts you for your API key, writes the configuration, installs Node.js and the CLI if needed, then sends a minimal request to verify connectivity. Start by picking your operating system:
📖 Before running, grab your API key (starting with
cr_) from the QCode.cc dashboard; the script will prompt you to paste it (input is not echoed).
🍎 macOS / 🐧 Linux¶
Open a terminal and paste (no sudo needed):
Claude Code¶
curl -fsSL https://qcode.cc/install/claude-code.sh | bash
Codex¶
curl -fsSL https://qcode.cc/install/codex.sh | bash
Configuration is written to your shell config file (a managed block in ~/.zshrc / ~/.bashrc) or ~/.codex/; if Node.js is missing, it is installed into your home directory via nvm.
🪟 Windows¶
Native PowerShell is all you need — no WSL, no administrator rights. Open Windows Terminal or PowerShell and paste:
Claude Code¶
irm https://qcode.cc/install/claude-code.ps1 | iex
Codex¶
irm https://qcode.cc/install/codex.ps1 | iex
Windows-specific notes:
- Configuration is written to user-level environment variables (Codex writes to
%USERPROFILE%\.codex\); previous values are automatically backed up to%USERPROFILE%\.qcode\ - If Node.js is missing, the LTS release is installed via winget; without winget, you'll get instructions for manual installation from nodejs.org
- Once setup completes, newly opened PowerShell / terminal windows pick up the config automatically; editors like VS Code need one restart
- If the script is blocked by the execution policy, run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserfirst, then retry
What the script does¶
- Latency-based endpoint selection — sends one lightweight request to each of the four endpoints (api / asia / us / eu) and recommends the fastest (you can override the choice)
- Write configuration — Claude Code: a managed shell block on macOS/Linux, user-level environment variables on Windows; Codex:
~/.codex/config.toml+auth.json(default model chosen interactively,gpt-5.6-terrarecommended) - Install the environment (skippable) — checks for Node.js ≥ 20, installs the LTS release via nvm (macOS/Linux) or winget (Windows) if missing, 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 troubleshooting hints based on the HTTP status code
- Back up before writing — every modified file is first backed up as
.bak.<timestamp>; on Windows, previous environment variables are backed up to%USERPROFILE%\.qcode\
Non-interactive mode (CI / no prompts)¶
macOS / Linux:
curl -fsSL https://qcode.cc/install/claude-code.sh | bash -s -- --key cr_xxx --yes
| Flag | Description |
|---|---|
--key <cr_...> |
API key; when provided, skips the interactive prompt |
--domain <api\|asia\|us\|eu> |
Pin the endpoint, skipping the latency test |
--model <id> |
(codex.sh only) Set the default model, skipping the picker |
--yes / -y |
Accept the default for every confirmation |
--no-install |
Write configuration only, don't install Node / CLI |
--no-verify |
Skip connectivity verification |
--help |
Show all flags |
Windows with parameters (matching the table above: -Key, -Domain, -Model, -Yes, -NoInstall, -NoVerify):
& ([scriptblock]::Create((irm https://qcode.cc/install/claude-code.ps1))) -Key cr_xxx -Yes
(Same pattern for codex.ps1.)
What files are written / 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 entire managed block, or restore from the .bak.<timestamp> backup in the same directory |
| Claude Code (Windows) | 3 user-level environment variables | Restore the previous values from %USERPROFILE%\.qcode\backup-*.json |
| Codex (all platforms) | ~/.codex/config.toml + ~/.codex/auth.json |
Restore from 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 being overwritten.
FAQ¶
- Verification returns 401 — invalid or expired key: check it in the dashboard (make sure the
cr_prefix was copied in full), then re-run the script - Verification returns 404 — wrong endpoint URL: the BASE_URL should be
https://{domain}/apifor Claude Code andhttps://{domain}/openaifor Codex, with no trailing slash - Network timeout — re-run the script with a different endpoint (e.g.
--domain asia); live status for each endpoint is at probe.qcode.cc claude/codexcommand not found after installing on Windows — open a new PowerShell window (PATH only refreshes in new sessions)- Don't want the script to install Node — add
--no-install(Windows:-NoInstall) to write configuration only - Want to inspect the script first — open https://qcode.cc/install/claude-code.sh and read the source; the script needs no sudo / administrator rights and never writes to system directories