{"id":50619738,"url":"https://github.com/becomeless/cc-x","last_synced_at":"2026-06-06T10:00:48.846Z","repository":{"id":361773140,"uuid":"1255739635","full_name":"becomeless/cc-x","owner":"becomeless","description":"极简安全的 Claude Code API 切换器（命令 xx）/ A safe, minimal Claude Code API switcher — env-var based, never writes your config files","archived":false,"fork":false,"pushed_at":"2026-06-02T13:27:42.000Z","size":294,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-02T15:21:29.539Z","etag":null,"topics":["anthropic","api","claude","claude-code","cli","devtools","llm","powershell"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/becomeless.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-01T06:08:31.000Z","updated_at":"2026-06-02T13:28:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/becomeless/cc-x","commit_stats":null,"previous_names":["becomeless/ccx","becomeless/cc-x"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/becomeless/cc-x","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becomeless%2Fcc-x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becomeless%2Fcc-x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becomeless%2Fcc-x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becomeless%2Fcc-x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/becomeless","download_url":"https://codeload.github.com/becomeless/cc-x/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becomeless%2Fcc-x/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33977371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anthropic","api","claude","claude-code","cli","devtools","llm","powershell"],"created_at":"2026-06-06T10:00:35.567Z","updated_at":"2026-06-06T10:00:48.809Z","avatar_url":"https://github.com/becomeless.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCC-X\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eNo config files · Process isolation · Parallel terminals · Zero deps\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/becomeless/cc-x/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/becomeless/cc-x?style=flat-square\u0026color=blue\" alt=\"version\"\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/becomeless/cc-x?style=flat-square\" alt=\"license\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/becomeless/cc-x/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/downloads/becomeless/cc-x/total?style=flat-square\u0026color=success\" alt=\"downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/becomeless/cc-x/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/becomeless/cc-x/release.yml?style=flat-square\u0026label=build\" alt=\"build\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"README.md\"\u003e🇨🇳 中文\u003c/a\u003e · \u003ca href=\"README.en.md\"\u003e🇺🇸 English\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#install\"\u003eInstall\u003c/a\u003e · \u003ca href=\"#60-second-quick-start\"\u003eQuick Start\u003c/a\u003e · \u003ca href=\"#two-modes-the-key-concept\"\u003eConcepts\u003c/a\u003e · \u003ca href=\"#configuration\"\u003eConfig\u003c/a\u003e · \u003ca href=\"#faq\"\u003eFAQ\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003e `xx` — one command to switch Claude Code between APIs. **Zero config risk.**\n\nSwitching Claude Code between the official account and third-party APIs means juggling\nenvironment variables — or trusting a tool that rewrites your Claude config. CC-X takes a\ndifferent path: **switching happens purely at the environment-variable layer.** It never\nreads or writes any Claude Code config file. Your MCP, plugins, hooks — it won't touch them.\n\n```text\n  cc-x v0.4.6 · Claude Code API switcher     (default = used by bare `claude` in new terminals)\n\n   ▶ Official          (default)[Logged in]\n     DeepSeek                   [Key set] — work\n     智谱GLM                    [No key]\n     小米MiMo                   [No key]\n\n     New profile  ·  切换到中文  ·  Update check: off  ·  Exit\n\n  ↑↓ move · Enter open · Shift+↑↓ reorder · q quit\n```\n\n\u003e **Two builds**: the **native Go build** is recommended — GitHub Releases provide a lightweight\n\u003e `xx` / `xx.exe` with no Node.js, for Windows x64, macOS Intel / Apple Silicon, Linux x64 / arm64.\n\u003e If you prefer npm, install `@cc-x/cc-x` (command is still `xx`). Both builds are feature-equal.\n\n---\n\n## Install\n\n\u003e Install [Claude Code](https://claude.ai/code) first (`claude` on PATH). **Open a new terminal** after installing.\n\n### Step 1 · Install CC-X\n\n**Windows (native, recommended)**\n\n```powershell\nirm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1 | iex\n```\n\nThe installer chooses a per-user directory and adds it to your user PATH automatically, so no administrator rights or manual PATH edits are needed.\n\n**macOS / Linux (native, recommended)**\n\n```bash\ncurl -fsSL https://github.com/becomeless/cc-x/releases/latest/download/install.sh | sh\n```\n\nThe installer places `xx` in a user-level command directory. If that directory isn't on PATH,\nit prints a hint (the Unix installer deliberately doesn't edit your shell config).\n\n**npm (any platform, Node.js ≥ 18)**\n\n```bash\nnpm install -g @cc-x/cc-x\n```\n\n### Step 2 · Configure your API key\n\n```bash\nxx   # First run seeds 4 presets — pick one, edit, paste your key\n```\n\n### Step 3 · Start using it\n\n```bash\nxx DeepSeek -s     # Use this session, launch Claude now\nxx DeepSeek        # Set as default for new terminals\n```\n\n---\n\n## 60-second quick start\n\nThe first run of `xx` seeds 4 profiles in `~/.cc-mini/providers.json` (Official + DeepSeek +\nZhipu GLM + Xiaomi MiMo), **with empty keys**.\n\n1. `xx` → ↑↓ to a profile → Enter → **Edit** → **API key** → paste your key\n2. Then either:\n   - **Use this session** — launch Claude now in this terminal (temporary, parallel-friendly)\n   - **Set default** — bare `claude` in new terminals uses it from now on\n\n```bash\nxx                 # open the menu\nxx DeepSeek        # set as default\nxx DeepSeek -s     # use this session, launch Claude now (--session)\nxx -l              # list all profiles and state (--list)\nxx --help          # all options\n```\n\n---\n\n## Two modes (the key concept)\n\nWhich API Claude uses is decided by **environment variables**. CC-X offers two scopes:\n\n| | Use this session (`-s`) | Set default |\n|---|---|---|\n| Mechanism | Sets env vars on this process + launches `claude` | Writes **user environment variables** |\n| Scope | This terminal only; **gone when you close it** | **New** terminals going forward |\n| Running sessions | Unaffected | Unaffected (env freezes at process start) |\n| Best for | Parallel terminals on different APIs | Set your daily-driver API once |\n\n\u003e 💡 **Analogy**: \"Use this session\" is a quick oil change — just for this trip. \"Set default\" is\n\u003e refilling the tank — every new drive uses it from now on.\n\n**Parallel example**: open 4 terminals and run `xx Official -s`, `xx DeepSeek -s`, `xx 智谱GLM -s`,\n`xx 小米MiMo -s` — four Claudes running at once, each on its own API, zero interference.\n\n**Why not a global config file?** `settings.json` is shared globally; editing it hits running\nsessions (classic symptom: another terminal suddenly says `cannot be parsed as a URL`).\nEnvironment variables are naturally process-isolated.\n\n---\n\n## When CC-X is NOT the right tool\n\n- You need to manage MCP, hooks, plugins, or multiple CLIs → use [cc-switch](https://github.com/farion1231/cc-switch)\n- You only use the official API, never switch → you don't need CC-X\n- You want automatic config migration/backup → that's outside CC-X's scope\n\nCC-X cares more about boundaries than features. It does one thing: **switch APIs**.\n\n---\n\n## CC-X vs cc-switch\n\ncc-switch is an excellent full-featured GUI; CC-X takes the opposite, minimal approach.\n\n| | CC-X (`xx`) | cc-switch |\n|---|---|---|\n| Form | Terminal command (lightweight) | Desktop GUI (full-featured) |\n| Scope | Just API switching | API + MCP + multiple CLIs + prompts… |\n| Touches config? | **Never** (env vars only) | Rewrites config from its own DB |\n| Can lose MCP? | **Physically impossible** | Users have reported it |\n| Parallel terminals | **Native** (process isolation) | Global switch; sessions can clash |\n\n- → **CC-X**: terminal natives, parallel-session runners, anyone burned by a config-wrecking switcher, \"just switch the API\" people\n- → **cc-switch**: GUI preference, all-in-one MCP + multi-CLI management\n\n---\n\n## Design philosophy\n\n\u003e CC-X cares more about boundaries than features.\n\nClaude Code already has its own config system, MCP ecosystem, and session state. CC-X is not trying to become a control panel above it, or to copy user config into another database. It stands at one narrow point before Claude Code starts: prepare the 7 managed environment variables, then let Claude Code run.\n\nThat constraint is deliberate: no writes to Claude Code config files, no MCP management, no automatic migration, no resident background controller. If process environment variables can solve it, CC-X avoids global files; if a choice matters, the user makes it explicitly. Doing less keeps the failure surface small.\n\nIssues / PRs are welcome, but the direction is clear: **make switching steadier, clearer, and less intrusive** before adding broader management power. Anything that writes a Claude Code config file will not be accepted.\n\n---\n\n## Configuration\n\n### Fields\n\n| Field | Environment variable | Notes |\n|---|---|---|\n| API URL | `ANTHROPIC_BASE_URL` | Third-party endpoint; empty for Official = logged-in session |\n| Auth field | — | `AUTH_TOKEN` (default) or `API_KEY`; **wrong one = 401** |\n| API key | `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY` | Value for the chosen auth field |\n| opus → model | `ANTHROPIC_DEFAULT_OPUS_MODEL` | Three-tier model mapping; haiku also covers background tasks — **must be set** |\n| sonnet → model | `ANTHROPIC_DEFAULT_SONNET_MODEL` | |\n| haiku → model | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | |\n| effort level | `CLAUDE_CODE_EFFORT_LEVEL` | `low`–`max`; `auto` = model default; empty = unset. Third parties may not honor it |\n\n\u003e CC-X **deliberately does not set** `ANTHROPIC_MODEL`. Use `/model opus|sonnet|haiku` in-session;\n\u003e the mapping table translates to the provider's real model name.\n\n### Auth field: AUTH_TOKEN vs API_KEY\n\n| Option | Request header | Used by |\n|---|---|---|\n| `AUTH_TOKEN` (default) | `Authorization: Bearer \u003ckey\u003e` | Most third-party relays |\n| `API_KEY` | `x-api-key: \u003ckey\u003e` | The official API, and a few relays |\n\n### Pre-seeded profiles\n\n| Profile | BASE_URL | OPUS / SONNET | HAIKU (incl. background) | effort |\n|---|---|---|---|---|\n| Official | empty (logged-in) | — | — | — |\n| DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-v4-pro` | `deepseek-v4-flash` | `max` (recommended) |\n| Zhipu GLM | `https://open.bigmodel.cn/api/anthropic` | `GLM-4.7` | `glm-4.5-air` | — |\n| Xiaomi MiMo | `https://api.xiaomimimo.com/anthropic` | `mimo-v2.5-pro` | `mimo-v2.5-pro` | — |\n\n\u003e Model names change as providers update. Xiaomi MiMo has both pay-as-you-go and TokenPlan\n\u003e endpoints; you pick one when selecting the provider.\n\n### Advanced\n\n- **Multiple accounts**: create multiple profiles from the same provider — names auto-suffix\n  with ` 2`, ` 3`… Use **Note** to tell them apart, shown as \"Provider — Note\".\n- **Custom providers**: `presets.json` is the provider catalog; add a JSON entry to offer a new\n  one, no code change. Drop `~/.cc-mini/presets.json` to override the shipped catalog.\n- **First-launch login prompt**: third-party APIs may still show onboarding. Add\n  `\"hasCompletedOnboarding\": true` to `~/.claude.json` (**only this key** — don't overwrite\n  the file; it also holds your MCP config).\n- **Update check**: toggle to \"notify\" in the menu — a yellow one-liner appears atop the menu\n  when a new release is out. At most one check per day; never auto-upgrades.\n\n---\n\n## Data \u0026 files\n\n- **Profiles (plaintext keys, keep local)**: `~/.cc-mini/providers.json` (also holds `lang` and `update`)\n- **Provider catalog**: shipped `presets.json`; override at `~/.cc-mini/presets.json`\n- **\"Set default\" writes user environment variables** (not Claude config files):\n  - Windows → registry `HKCU\\Environment` + one change broadcast\n  - Unix → `# \u003e\u003e\u003e xx \u003e\u003e\u003e` … `# \u003c\u003c\u003c xx \u003c\u003c\u003c` marker block in shell startup file (idempotent rewrite, chosen by `$SHELL`)\n  - Same semantics either way: **only affects new terminals**; switching to \"Official\" clears all managed vars\n- **No Claude Code config file is ever modified.**\n\nCC-X only touches these 7 \"managed\" variables (and clears the ones a target profile doesn't use):\n`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, `ANTHROPIC_DEFAULT_OPUS_MODEL`,\n`ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `CLAUDE_CODE_EFFORT_LEVEL`.\n\n\u003e 💡 To change `settings.json`, use Claude Code's own `/update-config` and describe what you want\n\u003e in natural language (e.g. \"allow npm commands\") — safer than letting an external tool rewrite it.\n\n---\n\n## FAQ\n\n**Does switching in one terminal affect another?** No. \"Use this session\" is process-scoped;\n\"Set default\" only affects new terminals.\n\n**I set default but bare `claude` here is still the old one?** Expected — this terminal has\nthe old env. Open a new one.\n\n**Seeing `cannot be parsed as a URL`?** A profile's API URL is invalid. Edit to fix or delete it.\n\n**Set effort on a third party but nothing happens?** effort is a Claude-model feature; third\nparties may not support it. DeepSeek recommends `max`; leave empty otherwise.\n\n**Are keys safe?** Plaintext in your home dir, protected by your OS account. Don't commit\n`providers.json` to a repo.\n\n**Can I choose the install directory?** Yes. The Windows installer supports `-InstallDir`;\nmacOS / Linux supports `CCX_INSTALL_DIR` or `--install-dir`. Most users should keep the default;\nif you change it, pass the same directory when uninstalling.\n\n**Can I download the binary manually?** Yes. Go to [GitHub Releases](https://github.com/becomeless/cc-x/releases/latest),\ndownload the zip / tar.gz for your platform, extract it, and put `xx` / `xx.exe` somewhere on PATH.\nFor most users, the install command above is better: it picks the platform, verifies checksums, and handles PATH / uninstall.\n\n---\n\n## Uninstall\n\n1. Clear env vars: `xx` → Official → Set default\n2. Remove the binary:\n   - Windows native:\n     ```powershell\n     $s = irm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1\n     \u0026 ([scriptblock]::Create($s)) -Uninstall\n     ```\n     This removes the installed files and automatically removes the matching user PATH entry.\n   - macOS / Linux native:\n     ```bash\n     curl -fsSL https://github.com/becomeless/cc-x/releases/latest/download/install.sh | sh -s -- --uninstall\n     ```\n   - npm: `npm uninstall -g @cc-x/cc-x`\n3. Delete data: `rm -rf ~/.cc-mini`\n\n---\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecomeless%2Fcc-x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbecomeless%2Fcc-x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecomeless%2Fcc-x/lists"}