@cc-x/cc-x 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.en.md +135 -227
  2. package/README.md +116 -214
  3. package/package.json +1 -1
package/README.en.md CHANGED
@@ -1,33 +1,25 @@
1
1
  # ccx
2
2
 
3
+ > `xx` — one command to switch Claude Code between APIs. **Zero config risk.**
4
+ >
3
5
  > [简体中文](README.md) | English
4
6
 
5
- **A Claude Code API switcher** (terminal command `xx`). One command to switch Claude Code
6
- between the official account and third-party Anthropic-compatible APIs (DeepSeek, Zhipu GLM,
7
- Xiaomi MiMo…).
8
-
9
- What sets it apart from other switchers — **it never writes any Claude Code config file**;
10
- switching works purely through environment variables. So:
11
-
12
- - 🛡️ **Zero config risk**: it never touches `~/.claude/settings.json`, never opens
13
- `~/.claude.json` (where MCP lives) — **physically incapable** of losing your MCP / plugins / hooks.
14
- - 🔀 **Parallel terminals**: each terminal can run a different API without interference (process-level isolation).
15
- - ⚡ **One command**: pick in `xx`, then use it for this terminal only or set it as the future default.
7
+ Switching Claude Code between the official account and third-party APIs means juggling
8
+ environment variables or trusting a tool that rewrites your Claude config. ccx takes a
9
+ different path: **switching happens purely at the environment-variable layer.** It never
10
+ reads or writes any Claude Code config file. Your MCP, plugins, hooks — it won't touch them.
16
11
 
17
12
  ```text
18
- cc-x v0.4.4 · Claude Code API switcher (default = used by bare `claude` in new terminals)
13
+ cc-x v0.4.6 · Claude Code API switcher (default = used by bare `claude` in new terminals)
19
14
 
20
15
  ▶ Official (default)[Logged in]
21
16
  DeepSeek [Key set] — work
22
17
  智谱GLM [No key]
23
18
  小米MiMo [No key]
24
19
 
25
- New profile
26
- 切换到中文
27
- Update check: off
28
- Exit
20
+ New profile · 切换到中文 · Update check: off · Exit
29
21
 
30
- ↑↓ move · Enter open · Shift+↑↓ (or PgUp/PgDn) reorder · q quit
22
+ ↑↓ move · Enter open · Shift+↑↓ reorder · q quit
31
23
  ```
32
24
 
33
25
  > **Two builds**: the **native Go build** is recommended — GitHub Releases provide a lightweight
@@ -36,301 +28,217 @@ switching works purely through environment variables. So:
36
28
 
37
29
  ---
38
30
 
39
- ## ccx vs cc-switch
40
-
41
- cc-switch is an excellent all-in-one **GUI**; ccx takes the opposite, **minimal** approach:
42
-
43
- | | ccx (command `xx`) | cc-switch |
44
- |---|---|---|
45
- | Form | Terminal command (lightweight) | Desktop GUI (full-featured) |
46
- | Scope | Only switches the API | API + MCP + multiple CLIs + prompts… |
47
- | Touches config files? | **No** (env vars only) | Rewrites config files from its own DB |
48
- | Can lose MCP / plugins? | **Impossible by design** | Users have reported it overwriting them |
49
- | Different API per terminal | **Native** (process-level isolation) | Global switch; sessions can interfere |
50
-
51
- - **ccx fits you if you** live in the terminal, often run several terminals with different APIs
52
- in parallel, have been burned by a switcher corrupting your config/MCP, or just want that one job done.
53
- - **cc-switch fits you if you** want a GUI, need to manage MCP and several AI CLIs in one place,
54
- or prefer an all-in-one tool.
55
-
56
31
  ## Install
57
32
 
58
- > Install **Claude Code** first (`claude` on PATH) — "Use this session" launches it. **Open a new terminal** after installing.
33
+ > Install [Claude Code](https://claude.ai/code) first (`claude` on PATH). **Open a new terminal** after installing.
59
34
 
60
- **Windows native (recommended)**
35
+ **Windows (native, recommended)**
61
36
 
62
37
  ```powershell
63
38
  irm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1 | iex
64
39
  ```
65
40
 
66
- Installs to `%LOCALAPPDATA%\Programs\ccx` and adds it to your user PATH.
41
+ The installer chooses a per-user directory and adds it to your user PATH automatically, so no administrator rights or manual PATH edits are needed.
67
42
 
68
- **macOS / Linux native (recommended)**
43
+ **macOS / Linux (native, recommended)**
69
44
 
70
45
  ```bash
71
46
  curl -fsSL https://github.com/becomeless/cc-x/releases/latest/download/install.sh | sh
72
47
  ```
73
48
 
74
- Installs to `~/.local/bin` (override with `CCX_INSTALL_DIR`) and verifies `checksums.txt`. If that dir
75
- isn't on PATH, follow the printed hint.
49
+ The installer places `xx` in a user-level command directory. If that directory isn't on PATH,
50
+ it prints a hint (the Unix installer deliberately doesn't edit your shell config).
76
51
 
77
- **npm, any platform** (needs Node.js ≥ 18)
52
+ **npm (any platform, Node.js ≥ 18)**
78
53
 
79
54
  ```bash
80
55
  npm install -g @cc-x/cc-x
81
56
  ```
82
57
 
83
- Open a new terminal and run `xx --version` to verify.
58
+ ---
59
+
60
+ ## 60-second quick start
84
61
 
85
- ## Quick start (60 seconds)
62
+ The first run of `xx` seeds 4 profiles in `~/.cc-mini/providers.json` (Official + DeepSeek +
63
+ Zhipu GLM + Xiaomi MiMo), **with empty keys**.
64
+
65
+ 1. `xx` → ↑↓ to a profile → Enter → **Edit** → **API key** → paste your key
66
+ 2. Then either:
67
+ - **Use this session** — launch Claude now in this terminal (temporary, parallel-friendly)
68
+ - **Set default** — bare `claude` in new terminals uses it from now on
69
+
70
+ ```bash
71
+ xx # open the menu
72
+ xx DeepSeek # set as default
73
+ xx DeepSeek -s # use this session, launch Claude now (--session)
74
+ xx -l # list all profiles and state (--list)
75
+ xx --help # all options
76
+ ```
86
77
 
87
- 1. Open a new terminal and run `xx`. The first run creates 4 default profiles in
88
- `~/.cc-mini/providers.json` (Official + DeepSeek + Zhipu GLM + Xiaomi MiMo), **with empty keys**.
89
- 2. ↑↓ to the one you want → Enter → **Edit** → pick **API key** and paste your key (done locally).
90
- 3. Then either:
91
- - **Set default**: future **new** terminals running bare `claude` use it.
92
- - **Use this session**: launch Claude right now in this terminal (temporary, parallel-friendly).
78
+ ---
93
79
 
94
- ## Two activation modes (core concept)
80
+ ## Two modes (the key concept)
95
81
 
96
- This is the key to ccx. Which API Claude uses is decided by **environment variables**; ccx offers two scopes:
82
+ Which API Claude uses is decided by **environment variables**. ccx offers two scopes:
97
83
 
98
- | | Use this session | Set default |
84
+ | | Use this session (`-s`) | Set default |
99
85
  |---|---|---|
100
- | Mechanism | Sets env vars for **this one process** and launches `claude` | Writes the API as **user environment variables** |
101
- | Scope | This terminal only, **ephemeral** (gone when you close it) | **New** terminals running bare `claude` use it |
102
- | Effect on running sessions | **None** | **None** (env vars freeze at process start) |
103
- | Typical use | Several terminals in parallel, each on its own API | Set your everyday "main API" |
86
+ | Mechanism | Sets env vars on this process + launches `claude` | Writes **user environment variables** |
87
+ | Scope | This terminal only; **gone when you close it** | **New** terminals going forward |
88
+ | Running sessions | Unaffected | Unaffected (env freezes at process start) |
89
+ | Best for | Parallel terminals on different APIs | Set your daily-driver API once |
104
90
 
105
91
  **Parallel example**: open 4 terminals and run `xx Official -s`, `xx DeepSeek -s`, `xx 智谱GLM -s`,
106
- `xx 小米MiMo -s` — four Claudes running at once, each on its own API, never interfering.
92
+ `xx 小米MiMo -s` — four Claudes running at once, each on its own API, zero interference.
107
93
 
108
- **Why not switch via a global config file?** Because `settings.json` is shared globally; editing it hits
109
- **running** sessions (a classic symptom: another terminal suddenly reports `... cannot be parsed as a URL`).
110
- Environment variables are process-isolated, sidestepping that trap.
94
+ **Why not a global config file?** `settings.json` is shared globally; editing it hits running
95
+ sessions (classic symptom: another terminal suddenly says `cannot be parsed as a URL`).
96
+ Environment variables are naturally process-isolated.
111
97
 
112
- ## Command-line usage
98
+ ---
113
99
 
114
- ```bash
115
- xx # open the interactive menu
116
- xx DeepSeek # "Set default" to the profile named DeepSeek
117
- xx DeepSeek -s # "Use this session" for DeepSeek and launch Claude (--session)
118
- xx -l # list all profiles and their state (--list)
119
- xx --lang en # UI language for this run (zh / en)
120
- xx --help # all options
121
- ```
100
+ ## ccx vs cc-switch
122
101
 
123
- `xx <name>` defaults to "Set default"; add `-s` / `--session` for "Use this session".
102
+ cc-switch is an excellent full-featured GUI; ccx takes the opposite, minimal approach.
124
103
 
125
- ## Menus & editing
104
+ | | ccx (`xx`) | cc-switch |
105
+ |---|---|---|
106
+ | Form | Terminal command (lightweight) | Desktop GUI (full-featured) |
107
+ | Scope | Just API switching | API + MCP + multiple CLIs + prompts… |
108
+ | Touches config? | **Never** (env vars only) | Rewrites config from its own DB |
109
+ | Can lose MCP? | **Physically impossible** | Users have reported it |
110
+ | Parallel terminals | **Native** (process isolation) | Global switch; sessions can clash |
126
111
 
127
- Run `xx` for the main menu: `↑↓` move, `Enter` select, `q` / `Esc` quit. With a profile selected,
128
- **`Shift+↑↓` (or `PgUp`/`PgDn`) reorders** it, saved instantly.
112
+ - **ccx**: terminal natives, parallel-session runners, anyone burned by a config-wrecking switcher, "just switch the API" people
113
+ - **cc-switch**: GUI preference, all-in-one MCP + multi-CLI management
129
114
 
130
- - **Select a profile → Enter** for the action menu: **Use this session** / **Set default** / **Edit** /
131
- **Delete** (with confirm; keep "Official") / **Back**.
132
- - **New profile** — create an empty profile and open the edit form.
133
- - **Switch to 中文 / English** — instant language toggle, remembered in `lang` in `~/.cc-mini/providers.json`.
134
- - **Update check: off / notify** — see [Checking for updates](#checking-for-updates).
135
- - **Exit**.
115
+ ---
136
116
 
137
- ```text
138
- Profile: DeepSeek — work [Key set]
117
+ ## Design philosophy
139
118
 
140
- Session — this terminal only, launches Claude now (great for parallel terminals)
141
- Set default — used by bare claude in new terminals (running sessions unaffected)
142
- Edit
143
- Delete
144
- Back
119
+ > ccx cares more about boundaries than features.
145
120
 
146
- ↑↓ move · Enter select · q back
147
- ```
121
+ Claude Code already has its own config system, MCP ecosystem, and session state. ccx 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.
148
122
 
149
- **Edit form**: `↑↓` pick a field, `Enter` to change; "Save & back" / "Discard" at the bottom. Inside a
150
- field, **Enter = keep**, `-` = clear, `Esc` = cancel that field. The first field, **Provider**, is the key
151
- one: picking a provider (from the preset catalog) **auto-fills** the API URL, the three model mappings, and
152
- the auth field (providers with multiple URLs let you choose one first); "Note" is free text.
123
+ That 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, ccx avoids global files; if a choice matters, the user makes it explicitly. Doing less keeps the failure surface small.
153
124
 
154
- ```text
155
- Edit profile (↑↓ pick a field, Enter to edit; save/discard at bottom)
156
-
157
- ▶ Provider : DeepSeek
158
- Note : work
159
- API URL : https://api.deepseek.com/anthropic
160
- Auth field : AUTH_TOKEN
161
- API key : ********
162
- opus → model : deepseek-v4-pro
163
- sonnet→ model : deepseek-v4-pro
164
- haiku → model : deepseek-v4-flash
165
- effort level : max
166
-
167
- Show key in plaintext (now hidden)
168
-
169
- Save & back
170
- Discard
171
- ```
125
+ Issues / 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.
172
126
 
173
- ## Configuration reference
127
+ ---
128
+
129
+ ## Configuration
174
130
 
175
131
  ### Fields
176
132
 
177
133
  | Field | Environment variable | Notes |
178
134
  |---|---|---|
179
- | Provider | | Picked from the preset catalog; auto-fills URL/models/auth. Also the unique key; duplicates get " 2/3…" |
180
- | Note | — | Free text to tell apart multiple profiles of the same provider |
181
- | API URL | `ANTHROPIC_BASE_URL` | Third-party endpoint; empty for Official = use the logged-in session |
182
- | Auth field | — | Put the key in `AUTH_TOKEN` or `API_KEY` (see below) |
135
+ | API URL | `ANTHROPIC_BASE_URL` | Third-party endpoint; empty for Official = logged-in session |
136
+ | Auth field | — | `AUTH_TOKEN` (default) or `API_KEY`; **wrong one = 401** |
183
137
  | API key | `ANTHROPIC_AUTH_TOKEN` or `ANTHROPIC_API_KEY` | Value for the chosen auth field |
184
- | opus → model | `ANTHROPIC_DEFAULT_OPUS_MODEL` | Model the `opus` tier maps to |
185
- | sonnet → model | `ANTHROPIC_DEFAULT_SONNET_MODEL` | Model the `sonnet` tier maps to |
186
- | haiku → model | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Model the `haiku` tier maps to; **background tasks use it too** |
187
- | effort level | `CLAUDE_CODE_EFFORT_LEVEL` | Thinking depth, see below |
188
-
189
- > ccx **deliberately does not set** `ANTHROPIC_MODEL` or touch `model` in `settings.json`. You pick the tier
190
- > live with `/model opus\|sonnet\|haiku`, and the mapping translates it to the provider's real model.
191
-
192
- ### Model mapping & effort
193
-
194
- **Why third parties need model mapping:** their endpoints only know their own model names (e.g.
195
- `deepseek-v4-pro`), while Claude Code calls `claude-*` by default — without mapping it errors out. Background
196
- tasks use the `haiku` tier, so `haiku → model` **must be set too** (otherwise: "main chat works but errors
197
- now and then").
198
-
199
- **effort (thinking depth):** `low < medium < high < xhigh < max` — higher is smarter but slower and burns
200
- more tokens; `auto` = model default; empty = unset. Note **effort is a Claude-model feature; whether a third
201
- party honors it depends on their implementation**.
202
-
203
- Reference config per provider (defaults are pre-seeded):
204
-
205
- | Profile | BASE_URL | OPUS / SONNET | HAIKU (incl. background) | effort |
206
- |---|---|---|---|---|
207
- | Official | (empty = logged-in) | — | — | empty / `auto` |
208
- | DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-v4-pro` | `deepseek-v4-flash` | `max` (recommended) |
209
- | Zhipu GLM | `https://open.bigmodel.cn/api/anthropic` | `GLM-4.7` | `glm-4.5-air` | empty |
210
- | Xiaomi MiMo | `https://api.xiaomimimo.com/anthropic` (pay-as-you-go)<br>`https://token-plan-cn.xiaomimimo.com/anthropic` (TokenPlan) | `mimo-v2.5-pro` | `mimo-v2.5-pro` | empty |
138
+ | opus → model | `ANTHROPIC_DEFAULT_OPUS_MODEL` | Three-tier model mapping; haiku also covers background tasks — **must be set** |
139
+ | sonnet → model | `ANTHROPIC_DEFAULT_SONNET_MODEL` | |
140
+ | haiku → model | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | |
141
+ | effort level | `CLAUDE_CODE_EFFORT_LEVEL` | `low`–`max`; `auto` = model default; empty = unset. Third parties may not honor it |
211
142
 
212
- > Model names change as providers update; follow each provider's official docs.
143
+ > ccx **deliberately does not set** `ANTHROPIC_MODEL`. Use `/model opus|sonnet|haiku` in-session;
144
+ > the mapping table translates to the provider's real model name.
213
145
 
214
146
  ### Auth field: AUTH_TOKEN vs API_KEY
215
147
 
216
148
  | Option | Request header | Used by |
217
149
  |---|---|---|
218
- | `ANTHROPIC_AUTH_TOKEN` (default) | `Authorization: Bearer <key>` | Most third-party relays |
219
- | `ANTHROPIC_API_KEY` | `x-api-key: <key>` | The official API, and a few relays that only accept this |
220
-
221
- The wrong one yields 401. Switch it under "Auth field"; on switch ccx clears the other to avoid a leftover conflict.
222
-
223
- ## Multiple accounts & maintaining presets
224
-
225
- **Multiple accounts**: several keys for the same provider (personal / work)? Just create multiple profiles —
226
- the second one off the same provider auto-names to `DeepSeek 2`; use **Note** to label them, shown as
227
- "Provider — Note".
228
-
229
- **Maintaining the provider catalog**: `presets.json` (shipped with the tool) is the catalog the "Provider"
230
- picker reads. Add a provider to offer a new one — no code change:
231
-
232
- ```json
233
- [
234
- {
235
- "name": "DeepSeek",
236
- "auth": "AUTH_TOKEN",
237
- "effort": "max",
238
- "urls": [ { "label": "Anthropic-compatible", "url": "https://api.deepseek.com/anthropic" } ],
239
- "models": { "opus": "deepseek-v4-pro", "sonnet": "deepseek-v4-pro", "haiku": "deepseek-v4-flash" }
240
- }
241
- ]
242
- ```
150
+ | `AUTH_TOKEN` (default) | `Authorization: Bearer <key>` | Most third-party relays |
151
+ | `API_KEY` | `x-api-key: <key>` | The official API, and a few relays |
243
152
 
244
- - `urls` can hold **several** (e.g. API vs TokenPlan endpoints); you choose one when picking the provider.
245
- - `models` are the recommended three-tier mapping, auto-filled and still editable. `auth` / `effort` are optional.
246
- - You can also drop a custom catalog at `~/.cc-mini/presets.json` to override the shipped one (highest priority).
153
+ ### Pre-seeded profiles
247
154
 
248
- ## Checking for updates
249
-
250
- The **Update check** toggle in the main menu is **off by default**. Switch it to **notify** and ccx shows a
251
- one-line yellow notice atop the menu when a newer release exists, with the upgrade command (it never
252
- auto-downloads you decide when to upgrade).
253
-
254
- - No GitHub API; checks at most once a day, cached in `~/.cc-mini/update-check.json`; offline/failure is silent.
255
- - The check runs in the background and won't slow startup — a new version usually shows up on your **next** launch.
256
- - To upgrade, just re-run the install command (native: the one-liner under [Install](#install); npm:
257
- `npm i -g @cc-x/cc-x@latest`).
155
+ | Profile | BASE_URL | OPUS / SONNET | HAIKU (incl. background) | effort |
156
+ |---|---|---|---|---|
157
+ | Official | empty (logged-in) | | | |
158
+ | DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-v4-pro` | `deepseek-v4-flash` | `max` (recommended) |
159
+ | Zhipu GLM | `https://open.bigmodel.cn/api/anthropic` | `GLM-4.7` | `glm-4.5-air` | — |
160
+ | Xiaomi MiMo | `https://api.xiaomimimo.com/anthropic` | `mimo-v2.5-pro` | `mimo-v2.5-pro` | — |
258
161
 
259
- ## First run: skip login / onboarding
162
+ > Model names change as providers update. Xiaomi MiMo has both pay-as-you-go and TokenPlan
163
+ > endpoints; you pick one when selecting the provider.
260
164
 
261
- With a third-party API (token auth), Claude Code **may still show a login / onboarding screen on first
262
- launch** — because it hasn't recorded "onboarding done". One-time fix: in `~/.claude.json` (Windows:
263
- `C:\Users\<you>\.claude.json`), **add a single key** to the top-level `{ }` (keep everything else):
165
+ ### Advanced
264
166
 
265
- ```json
266
- {
267
- "hasCompletedOnboarding": true
268
- }
269
- ```
167
+ - **Multiple accounts**: create multiple profiles from the same provider — names auto-suffix
168
+ with ` 2`, ` 3`… Use **Note** to tell them apart, shown as "Provider — Note".
169
+ - **Custom providers**: `presets.json` is the provider catalog; add a JSON entry to offer a new
170
+ one, no code change. Drop `~/.cc-mini/presets.json` to override the shipped catalog.
171
+ - **First-launch login prompt**: third-party APIs may still show onboarding. Add
172
+ `"hasCompletedOnboarding": true` to `~/.claude.json` (**only this key** — don't overwrite
173
+ the file; it also holds your MCP config).
174
+ - **Update check**: toggle to "notify" in the menu — a yellow one-liner appears atop the menu
175
+ when a new release is out. At most one check per day; never auto-upgrades.
270
176
 
271
- > ⚠️ This file also holds your MCP config — **only add the key, never overwrite the whole file**. ccx
272
- > deliberately won't edit it for you; it's exactly the file a tool shouldn't touch.
177
+ ---
273
178
 
274
- ## Data & file locations
179
+ ## Data & files
275
180
 
276
- - **Profiles (plaintext keys, keep local)**: `~/.cc-mini/providers.json` (also holds `lang` and `update`).
277
- - **Provider catalog**: the shipped `presets.json`, or `~/.cc-mini/presets.json` to override.
278
- - **Update-check cache**: `~/.cc-mini/update-check.json`.
181
+ - **Profiles (plaintext keys, keep local)**: `~/.cc-mini/providers.json` (also holds `lang` and `update`)
182
+ - **Provider catalog**: shipped `presets.json`; override at `~/.cc-mini/presets.json`
279
183
  - **"Set default" writes user environment variables** (not Claude config files):
280
- - **Windows** → registry `HKCU\Environment` + one change broadcast;
281
- - **macOS / Linux** a `# >>> xx >>>` … `# <<< xx <<<` marker block in the shell startup file
282
- (idempotent rewrite, chosen by `$SHELL`).
283
- - Same semantics either way: **only affects new terminals**; switching to "Official" clears all managed vars.
284
- - **It modifies no Claude config file.**
184
+ - Windows → registry `HKCU\Environment` + one change broadcast
185
+ - Unix → `# >>> xx >>>` … `# <<< xx <<<` marker block in shell startup file (idempotent rewrite, chosen by `$SHELL`)
186
+ - Same semantics either way: **only affects new terminals**; switching to "Official" clears all managed vars
187
+ - **No Claude Code config file is ever modified.**
285
188
 
286
- ccx only ever touches these 7 "managed" variables (and clears the ones a target profile doesn't use):
189
+ ccx only touches these 7 "managed" variables (and clears the ones a target profile doesn't use):
287
190
  `ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, `ANTHROPIC_DEFAULT_OPUS_MODEL`,
288
191
  `ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `CLAUDE_CODE_EFFORT_LEVEL`.
289
192
 
290
- > 💡 To change `settings.json`, use Claude Code's own `/update-config` and describe what you want in natural
291
- > language (e.g. "allow npm commands") — safer than letting an external tool rewrite it.
193
+ > 💡 To change `settings.json`, use Claude Code's own `/update-config` and describe what you want
194
+ > in natural language (e.g. "allow npm commands") — safer than letting an external tool rewrite it.
195
+
196
+ ---
292
197
 
293
198
  ## FAQ
294
199
 
295
- **Does switching in one terminal affect another running one?** No. "Use this session" is process-level; "Set
296
- default" only affects **new** processes — running sessions froze their env at start.
200
+ **Does switching in one terminal affect another?** No. "Use this session" is process-scoped;
201
+ "Set default" only affects new terminals.
297
202
 
298
- **I "Set default" but bare `claude` here is still the old one?** Expected — this terminal has the old env.
299
- **Open a new terminal.**
203
+ **I set default but bare `claude` here is still the old one?** Expected — this terminal has
204
+ the old env. Open a new one.
300
205
 
301
- **Seeing `... cannot be parsed as a URL`?** A profile's API URL is an invalid value; Edit to fix or delete it.
206
+ **Seeing `cannot be parsed as a URL`?** A profile's API URL is invalid. Edit to fix or delete it.
302
207
 
303
- **Set effort on a third party but nothing happens?** effort is a Claude-model feature; third parties may not
304
- support it. DeepSeek recommends `max`; otherwise leave it empty.
208
+ **Set effort on a third party but nothing happens?** effort is a Claude-model feature; third
209
+ parties may not support it. DeepSeek recommends `max`; leave empty otherwise.
305
210
 
306
- **Are keys safe?** Stored in plaintext under your home dir, protected by your account. Don't commit
211
+ **Are keys safe?** Plaintext in your home dir, protected by your OS account. Don't commit
307
212
  `providers.json` to a repo.
308
213
 
214
+ **Can I choose the install directory?** Yes. The Windows installer supports `-InstallDir`;
215
+ macOS / Linux supports `CCX_INSTALL_DIR` or `--install-dir`. Most users should keep the default;
216
+ if you change it, pass the same directory when uninstalling.
217
+
218
+ **Can I download the binary manually?** Yes. Go to [GitHub Releases](https://github.com/becomeless/cc-x/releases/latest),
219
+ download the zip / tar.gz for your platform, extract it, and put `xx` / `xx.exe` somewhere on PATH.
220
+ For most users, the install command above is better: it picks the platform, verifies checksums, and handles PATH / uninstall.
221
+
222
+ ---
223
+
309
224
  ## Uninstall
310
225
 
311
- 1. **Clear env vars first**: run "Set default → Official" once in `xx` to clear all managed variables.
312
- 2. **Remove the binary**:
226
+ 1. Clear env vars: `xx` Official Set default
227
+ 2. Remove the binary:
313
228
  - Windows native:
314
229
  ```powershell
315
- powershell -NoProfile -ExecutionPolicy Bypass -Command "$s = irm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1; & ([scriptblock]::Create($s)) -Uninstall"
230
+ $s = irm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1
231
+ & ([scriptblock]::Create($s)) -Uninstall
316
232
  ```
233
+ This removes the installed files and automatically removes the matching user PATH entry.
317
234
  - macOS / Linux native:
318
235
  ```bash
319
236
  curl -fsSL https://github.com/becomeless/cc-x/releases/latest/download/install.sh | sh -s -- --uninstall
320
237
  ```
321
- - npm: `npm uninstall -g @cc-x/cc-x`.
322
- - macOS / Linux, if you used "Set default", also delete the `# >>> xx >>>` marker block in your shell startup file.
323
- 3. Delete the data dir `~/.cc-mini/`.
238
+ - npm: `npm uninstall -g @cc-x/cc-x`
239
+ 3. Delete data: `rm -rf ~/.cc-mini`
324
240
 
325
- ## Design principles
326
-
327
- ccx was born from friction I kept hitting with cc-switch — not a criticism; it's powerful, I just wanted a
328
- lighter path. So ccx holds one principle: **simpler is better.** Do one job (switch the API); touch as little
329
- as possible (above all, **never write a Claude Code config file**); before adding a feature, ask whether it
330
- can be left out.
331
-
332
- Issues / PRs welcome — but **changes that make it simpler are more welcome than ones that make it more
333
- powerful**, and anything that writes a Claude Code config file will not be accepted.
241
+ ---
334
242
 
335
243
  ## License
336
244
 
package/README.md CHANGED
@@ -1,319 +1,221 @@
1
1
  # ccx
2
2
 
3
+ > `xx` — Claude Code 多 API 切换,一个命令搞定。**不碰配置,不怕翻车。**
4
+ >
3
5
  > 简体中文 | [English](README.en.md)
4
6
 
5
- **Claude Code API 切换器**(终端命令 `xx`)。一个命令,在 Claude Code 官方账号与各家第三方
6
- Anthropic 兼容 API(DeepSeek、智谱 GLM、小米 MiMo…)之间来回切。
7
-
8
- 它和别的切换工具最大的不同——**绝不写任何 Claude Code 配置文件**,切换纯靠环境变量。所以:
9
-
10
- - 🛡️ **配置零风险**:不碰 `~/.claude/settings.json`,更不打开存放 MCP 的 `~/.claude.json`,
11
- 从设计上**不可能**弄丢你的 MCP / 插件 / hooks。
12
- - 🔀 **多终端并行**:每个终端可以各用各的 API,互不干扰(进程级隔离)。
13
- - ⚡ **一个命令**:`xx` 选一下,要么仅当前终端临时用,要么设为以后默认。
7
+ Claude Code 连第三方 API?每次手打环境变量太烦,换工具切又怕弄丢 MCP。
8
+ ccx 把这事儿做到了最简——切换只在环境变量层,**不读写任何 Claude Code 配置文件**。
9
+ 你的 MCP、插件、hooks,它碰都不会碰。
14
10
 
15
11
  ```text
16
- cc-x v0.4.4 · Claude Code API 切换器 (默认 = 新终端裸敲 claude 用的)
12
+ cc-x v0.4.6 · Claude Code API 切换器 (默认 = 新终端裸敲 claude 用的)
17
13
 
18
14
  ▶ 官方 (默认)[登录态]
19
15
  DeepSeek [密钥已设] — 公司
20
16
  智谱GLM [密钥未填]
21
17
  小米MiMo [密钥未填]
22
18
 
23
- 新增配置
24
- 切换到 English
25
- 更新检查:关闭
26
- 退出
19
+ 新增配置 · 切换到 English · 更新检查:关闭 · 退出
27
20
 
28
- ↑↓ 选择 · Enter 进入 · Shift+↑↓(或 PgUp/PgDn)排序 · q 退出
21
+ ↑↓ 选择 · Enter 进入 · Shift+↑↓ 排序 · q 退出
29
22
  ```
30
23
 
31
24
  > **两个版本**:推荐 **Go 原生版**——GitHub Release 提供轻量 `xx` / `xx.exe`,无需 Node.js,
32
- > 覆盖 Windows x64、macOS Intel / Apple Silicon、Linux x64 / arm64。偏好 npm 的用户可装
25
+ > 覆盖 Windows x64、macOS Intel / Apple Silicon、Linux x64 / arm64npm 用户可装
33
26
  > `@cc-x/cc-x`(命令仍是 `xx`)。两版功能一致。
34
27
 
35
28
  ---
36
29
 
37
- ## 和 cc-switch 怎么选
38
-
39
- cc-switch 是优秀的**全能型 GUI**;ccx 走相反的**极简路线**,两者定位不同:
40
-
41
- | | ccx(命令 `xx`) | cc-switch |
42
- |---|---|---|
43
- | 形态 | 终端命令(轻量) | 桌面 GUI(全能) |
44
- | 职责 | 只切 API,一件事做到位 | API + MCP + 多 CLI + 提示词… |
45
- | 改不改配置文件 | **完全不碰**(纯环境变量) | 以自有数据库为准,重写配置文件 |
46
- | 会不会弄丢 MCP / 插件 | **设计上不可能** | 有用户反馈被覆盖丢失 |
47
- | 多终端并行不同 API | **原生支持**(进程级隔离) | 全局切换,易相互影响 |
48
-
49
- - **更适合用 ccx**:命令行党、爱敲一下就切;常同时开多个终端各跑不同 API;被“切换把配置 / MCP
50
- 弄坏”坑过想要零风险;只想要“切 API”这一件事。
51
- - **更适合用 cc-switch**:想要图形界面、要在一个工具里统管 MCP 和多个 AI CLI、喜欢一站式。
52
-
53
30
  ## 安装
54
31
 
55
- > 需要先装好 **Claude Code**(`claude` 在 PATH 中)——「本次启用」会直接调用它。安装后请**新开一个终端**。
32
+ > 先装好 [Claude Code](https://claude.ai/code)(`claude` 在 PATH 中)。装完**新开一个终端**。
56
33
 
57
- **Windows 原生版(推荐)**
34
+ **Windows(推荐原生版)**
58
35
 
59
36
  ```powershell
60
37
  irm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1 | iex
61
38
  ```
62
39
 
63
- 装到 `%LOCALAPPDATA%\Programs\ccx` 并加入用户 PATH
40
+ 安装器会自动选择用户级目录并写入用户 PATH,无需管理员权限,也无需手动配置。
64
41
 
65
- **macOS / Linux 原生版(推荐)**
42
+ **macOS / Linux(推荐原生版)**
66
43
 
67
44
  ```bash
68
45
  curl -fsSL https://github.com/becomeless/cc-x/releases/latest/download/install.sh | sh
69
46
  ```
70
47
 
71
- 装到 `~/.local/bin`(可用 `CCX_INSTALL_DIR` 改目录),并校验 `checksums.txt`。若该目录不在 PATH,按提示加入。
48
+ 安装器会放到用户级命令目录;若该目录不在 PATH 中,会打印一行提示(Unix 版刻意不自动改 shell 配置)。
72
49
 
73
- **npm 全平台版**(需 Node.js ≥ 18
50
+ **npm(全平台,需 Node.js ≥ 18)**
74
51
 
75
52
  ```bash
76
53
  npm install -g @cc-x/cc-x
77
54
  ```
78
55
 
79
- 新开终端运行 `xx --version` 验证安装。
80
-
81
- ## 快速上手(60 秒)
82
-
83
- 1. 新开终端运行 `xx`。首次会在 `~/.cc-mini/providers.json` 生成 4 个默认配置
84
- (官方 + DeepSeek + 智谱GLM + 小米MiMo),**密钥为空**。
85
- 2. ↑↓ 选中要用的那家 → Enter → 「编辑」→ 选「API 密钥」填入你的 key(在本机操作)。
86
- 3. 配好后二选一:
87
- - **设为默认**:以后**新开**终端裸敲 `claude` 就用它。
88
- - **本次启用**:立刻在当前终端启动 Claude(临时、可多终端并行)。
89
-
90
- ## 两种启用方式(核心概念)
91
-
92
- 这是理解 ccx 的关键。Claude 用哪个 API 本质由**环境变量**决定,ccx 提供两种作用范围:
93
-
94
- | | 本次启用 | 设为默认 |
95
- |---|---|---|
96
- | 机制 | 只给**当前终端这一个进程**设环境变量并启动 `claude` | 把该 API 写成**用户环境变量** |
97
- | 作用范围 | 仅当前终端,**阅后即焚**(关掉就没了) | 之后**新开**的终端裸敲 `claude` 默认用它 |
98
- | 对运行中会话 | **零影响** | **零影响**(环境变量在进程启动时定型) |
99
- | 典型场景 | 多终端并行,各用各 API | 设定最常用的“主力 API” |
56
+ ---
100
57
 
101
- **并行示例**:同时开 4 个终端分别 `xx 官方 -s`、`xx DeepSeek -s`、`xx 智谱GLM -s`、`xx 小米MiMo -s`,
102
- 得到 4 个同时运行、各用各 API、互不干扰的 Claude。
58
+ ## 60 秒上手
103
59
 
104
- **为什么不用全局配置文件来切?** 因为 `settings.json` 全局共享,改它会波及**正在运行**的其它会话
105
- (典型表现:另一终端突然报 `... cannot be parsed as a URL`)。环境变量天然进程隔离,避开了这个坑。
60
+ 首次运行 `xx` 会在 `~/.cc-mini/providers.json` 生成 4 个预设配置(官方 + DeepSeek + 智谱GLM + 小米MiMo),**密钥为空**。
106
61
 
107
- ## 命令行用法
62
+ 1. `xx` → ↑↓ 选中要用的配置 → Enter → 「编辑」→「API 密钥」→ 填入你的 key
63
+ 2. 配好后二选一:
64
+ - **本次启用** — 即刻在当前终端启动 Claude(临时,多开互不干扰)
65
+ - **设为默认** — 以后新终端裸敲 `claude` 就用它
108
66
 
109
67
  ```bash
110
- xx # 打开交互菜单
111
- xx DeepSeek # 「设为默认」到名为 DeepSeek 的配置
112
- xx DeepSeek -s # 「本次启用」DeepSeek 并立即启动 Claude(--session 同义)
113
- xx -l # 列出所有配置及状态(--list 同义)
114
- xx --lang en # 本次界面用英文(zh / en)
115
- xx --help # 全部参数
68
+ xx # 打开菜单
69
+ xx DeepSeek # 设为默认
70
+ xx DeepSeek -s # 本次启用,立即启动 Claude(--session 同义)
71
+ xx -l # 列出所有配置及状态(--list 同义)
72
+ xx --help # 全部参数
116
73
  ```
117
74
 
118
- `xx <名称>` 默认是「设为默认」;加 `-s` / `--session` 改为「本次启用」。
75
+ ---
119
76
 
120
- ## 菜单与编辑
77
+ ## 两种模式(核心概念)
121
78
 
122
- 运行 `xx` 进入主菜单:`↑↓` 移动、`Enter` 选择、`q` / `Esc` 退出。选中某个配置时按
123
- **`Shift+↑↓`(或 `PgUp`/`PgDn`)可上下移动排序**,即时保存。
79
+ Claude 用哪个 API 由**环境变量**决定。ccx 提供两种作用范围:
124
80
 
125
- - **选中配置 Enter** 进入动作菜单:**本次启用** / **设为默认** / **编辑** / **删除**(二次确认,建议保留「官方」)/ **返回**。
126
- - **新增配置** — 新建空配置并进入编辑表单。
127
- - **切换到 English / 中文** 界面语言即时切换,记忆在 `~/.cc-mini/providers.json` 的 `lang`。
128
- - **更新检查:关闭 / 提醒** 见[检查新版本](#检查新版本)。
129
- - **退出**。
81
+ | | 本次启用 (`-s`) | 设为默认 |
82
+ |---|---|---|
83
+ | 机制 | 给当前进程设环境变量,启动 `claude` | 写入**用户环境变量** |
84
+ | 作用范围 | 仅当前终端,**关了就没** | 之后**新开**的终端默认用它 |
85
+ | 对正在跑的会话 | 零影响 | 零影响(进程启动时已定型) |
86
+ | 适合 | 多终端并行,各跑各的 API | 定好主力 API,不用老切 |
130
87
 
131
- ```text
132
- 配置:DeepSeek — 公司 [密钥已设]
88
+ **并行示例**:开 4 个终端分别 `xx 官方 -s`、`xx DeepSeek -s`、`xx 智谱GLM -s`、`xx 小米MiMo -s`——四个 Claude 同时干活、各用各的 API、互不打架。
133
89
 
134
- 本次启用 — 仅当前终端,立即启动 Claude(并行多终端推荐)
135
- 设为默认 — 新终端裸敲 claude 默认用它(不影响运行中会话)
136
- 编辑
137
- 删除
138
- 返回
90
+ **为什么不用配置文件?** `settings.json` 全局共享,改它会波及正在跑的会话(典型症状:另一终端突然报 `cannot be parsed as a URL`)。环境变量天然进程隔离,避开了这个坑。
139
91
 
140
- ↑↓ 选择 · Enter 确认 · q 返回
141
- ```
92
+ ---
142
93
 
143
- **编辑表单**:`↑↓` 选字段、`Enter` 改,最下方可「保存并返回」/「放弃修改」。进入某项后**回车 = 不改**、
144
- 输入 `-` = 清空、`Esc` = 取消该项。第一项**「供应商」**最关键:选一个供应商(来自预设目录)后会
145
- **自动填入** API 地址、三档模型映射、认证字段(多地址的供应商会先让你选一个);「备注」随你写。
94
+ ## cc-switch 怎么选
146
95
 
147
- ```text
148
- 编辑配置 (↑↓ 选要改的项,Enter 进入;↓到底可选保存/放弃)
149
-
150
- ▶ 供应商 : DeepSeek
151
- 备注 : 公司
152
- API 地址 : https://api.deepseek.com/anthropic
153
- 认证字段 : AUTH_TOKEN
154
- API 密钥 : ********
155
- opus → 模型 : deepseek-v4-pro
156
- sonnet→ 模型 : deepseek-v4-pro
157
- haiku → 模型 : deepseek-v4-flash
158
- effort 思考档 : max
159
-
160
- 显示密钥明文(当前隐藏)
161
-
162
- 保存并返回
163
- 放弃修改
164
- ```
96
+ cc-switch 是优秀的全能 GUI;ccx 走相反的极简路线。
165
97
 
166
- ## 配置详解
98
+ | | ccx (`xx`) | cc-switch |
99
+ |---|---|---|
100
+ | 形态 | 终端命令(轻量) | 桌面 GUI(全能) |
101
+ | 职责 | 只切 API | API + MCP + 多 CLI + 提示词… |
102
+ | 改配置文件? | **不碰**(纯环境变量) | 会重写 |
103
+ | 能弄丢 MCP? | **不可能** | 有用户反馈被覆盖 |
104
+ | 多终端并行 | **原生支持**(进程隔离) | 全局切换,容易互扰 |
167
105
 
168
- ### 字段
106
+ - → **ccx**:命令行党、常多开终端、被切配置坑过、只想要「切 API」一件事
107
+ - → **cc-switch**:要 GUI、要一站式管 MCP 和多 CLI
169
108
 
170
- | 字段 | 对应环境变量 | 说明 |
171
- |---|---|---|
172
- | 供应商 | — | 从预设目录选;选后自动带出地址/模型/认证字段。也是配置唯一标识,同名自动追加「 2/3…」 |
173
- | 备注 | — | 自己写,用于区分同供应商的多份配置 |
174
- | API 地址 | `ANTHROPIC_BASE_URL` | 第三方接入点;官方留空=走登录态 |
175
- | 认证字段 | — | 密钥放进 `AUTH_TOKEN` 还是 `API_KEY`(见下) |
176
- | API 密钥 | `ANTHROPIC_AUTH_TOKEN` 或 `ANTHROPIC_API_KEY` | 对应认证字段的值 |
177
- | opus → 模型 | `ANTHROPIC_DEFAULT_OPUS_MODEL` | `opus` 档映射到的模型 |
178
- | sonnet → 模型 | `ANTHROPIC_DEFAULT_SONNET_MODEL` | `sonnet` 档映射到的模型 |
179
- | haiku → 模型 | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | `haiku` 档映射到的模型;**后台任务也用它** |
180
- | effort 思考档 | `CLAUDE_CODE_EFFORT_LEVEL` | 思考深度,见下 |
109
+ ---
181
110
 
182
- > ccx **刻意不设** `ANTHROPIC_MODEL`、也不碰 `settings.json` 的 `model`。你在会话里用
183
- > `/model opus\|sonnet\|haiku` 现场选档,映射表负责把它翻译成对应供应商的模型。
111
+ ## 设计哲学
184
112
 
185
- ### 模型映射与 effort
113
+ > ccx 的边界比功能更重要。
186
114
 
187
- **为什么第三方必须配模型映射?** 第三方端点只认自己的模型名(如 `deepseek-v4-pro`),而 Claude Code
188
- 默认会叫 `claude-*`,不映射就报错。后台任务走 `haiku` 档,所以 `haiku → 模型` **也必须填**
189
- (否则表现为“主对话能用但时不时报错”)。
115
+ Claude Code 已经有自己的配置系统、MCP 生态和会话状态。ccx 不想再造一个“上层控制台”,也不想把用户的配置收编进自己的数据库。它只站在 Claude Code 进程启动前的那一小步:把 7 个受管环境变量准备好,然后让 Claude Code 自己工作。
190
116
 
191
- **effort(思考深度)**:`low < medium < high < xhigh < max`,越高越聪明但越慢越费 token;`auto` = 模型
192
- 默认;留空 = 不设。注意 **effort 是 Claude 模型特性,第三方是否生效取决于各家实现**。
117
+ 所以它的取舍是有意的:不写 Claude Code 配置文件,不接管 MCP,不做自动迁移,不做后台常驻管理。能用进程环境变量解决,就不碰全局文件;能让用户显式选择,就不替用户自动决定。少做一点,是为了把风险面压到足够小。
193
118
 
194
- 各家参考配置(默认已预置):
119
+ 欢迎 Issue / PR,但方向很明确:**让切换更稳、更清楚、更不打扰用户**,比堆更多管理能力更重要。任何会写 Claude Code 配置文件的改动都不会被接受。
195
120
 
196
- | 配置 | BASE_URL | OPUS / SONNET | HAIKU(含后台) | effort |
197
- |---|---|---|---|---|
198
- | 官方 | (留空=登录态) | — | — | 留空 / `auto` |
199
- | DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-v4-pro` | `deepseek-v4-flash` | `max`(官方推荐) |
200
- | 智谱GLM | `https://open.bigmodel.cn/api/anthropic` | `GLM-4.7` | `glm-4.5-air` | 留空 |
201
- | 小米MiMo | `https://api.xiaomimimo.com/anthropic`(按量付费)<br>`https://token-plan-cn.xiaomimimo.com/anthropic`(TokenPlan) | `mimo-v2.5-pro` | `mimo-v2.5-pro` | 留空 |
121
+ ---
202
122
 
203
- > 模型名会随各家更新而变,请以各供应商官方接入文档为准。
123
+ ## 配置说明
204
124
 
205
- ### 认证字段:AUTH_TOKEN vs API_KEY
125
+ ### 字段一览
206
126
 
207
- | 选项 | 实际请求头 | 谁用 |
127
+ | 字段 | 对应环境变量 | 说明 |
208
128
  |---|---|---|
209
- | `ANTHROPIC_AUTH_TOKEN`(默认) | `Authorization: Bearer <key>` | 绝大多数第三方中转 |
210
- | `ANTHROPIC_API_KEY` | `x-api-key: <key>` | 官方 API,及少数只认这种头的中转 |
129
+ | API 地址 | `ANTHROPIC_BASE_URL` | 第三方接入点;官方留空=登录态 |
130
+ | 认证字段 | | 密钥放 `AUTH_TOKEN`(默认)还是 `API_KEY`;**放错会 401** |
131
+ | API 密钥 | `ANTHROPIC_AUTH_TOKEN` 或 `ANTHROPIC_API_KEY` | 对应认证字段的值 |
132
+ | opus → 模型 | `ANTHROPIC_DEFAULT_OPUS_MODEL` | 三档模型映射;后台任务走 haiku 档,**必须填** |
133
+ | sonnet → 模型 | `ANTHROPIC_DEFAULT_SONNET_MODEL` | |
134
+ | haiku → 模型 | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | |
135
+ | effort 思考档 | `CLAUDE_CODE_EFFORT_LEVEL` | `low` ~ `max`;`auto`=模型默认;留空=不设。第三方不一定生效 |
211
136
 
212
- 放错会 401。编辑时可在「认证字段」切换;切换配置时 ccx 会自动清掉另一个,避免残留冲突。
137
+ > ccx **刻意不设** `ANTHROPIC_MODEL`。在会话里用 `/model opus|sonnet|haiku` 选档,映射表负责翻译成对应供应商的模型名。
213
138
 
214
- ## 多账号与维护预设
139
+ ### 认证字段:AUTH_TOKEN vs API_KEY
215
140
 
216
- **多账号**:同一家有多个 key(个人 / 公司),直接建多份配置——选同一供应商建第二份时名称自动变
217
- `DeepSeek 2`,再用**备注**写明区别,列表显示成「供应商 — 备注」,一眼可辨。
141
+ | 选项 | 实际请求头 | 谁用 |
142
+ |---|---|---|
143
+ | `AUTH_TOKEN`(默认) | `Authorization: Bearer <key>` | 绝大多数第三方中转 |
144
+ | `API_KEY` | `x-api-key: <key>` | 官方 API,及少数中转 |
218
145
 
219
- **维护供应商预设**:`presets.json`(随工具发布)是供应商目录,新增配置时选「供应商」就来自这里。
220
- 加一个供应商即多一个预设,无需改代码:
146
+ ### 预置配置
221
147
 
222
- ```json
223
- [
224
- {
225
- "name": "DeepSeek",
226
- "auth": "AUTH_TOKEN",
227
- "effort": "max",
228
- "urls": [ { "label": "Anthropic 兼容", "url": "https://api.deepseek.com/anthropic" } ],
229
- "models": { "opus": "deepseek-v4-pro", "sonnet": "deepseek-v4-pro", "haiku": "deepseek-v4-flash" }
230
- }
231
- ]
232
- ```
148
+ | 配置 | BASE_URL | OPUS / SONNET | HAIKU(含后台任务) | effort |
149
+ |---|---|---|---|---|
150
+ | 官方 | 留空=登录态 | — | — | — |
151
+ | DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-v4-pro` | `deepseek-v4-flash` | `max`(官方推荐) |
152
+ | 智谱GLM | `https://open.bigmodel.cn/api/anthropic` | `GLM-4.7` | `glm-4.5-air` | — |
153
+ | 小米MiMo | `https://api.xiaomimimo.com/anthropic` | `mimo-v2.5-pro` | `mimo-v2.5-pro` | — |
233
154
 
234
- - `urls` 可有**多个**(如 API 与 TokenPlan 不同地址),选该供应商时先挑一个。
235
- - `models` 是三档推荐映射,选供应商时自动填入,之后仍可手改。`auth` / `effort` 可选,一并带出。
236
- - 也可在 `~/.cc-mini/presets.json` 放一份自定义目录覆盖随工具发布的版本(优先级最高)。
155
+ > 模型名随各家更新而变,以供应商官方接入文档为准。小米有按量付费和 TokenPlan 两个地址,选供应商时会让你挑。
237
156
 
238
- ## 检查新版本
157
+ ### 进阶
239
158
 
240
- 主菜单的「**更新检查**」开关默认**关闭**。切到「提醒」后,ccx 会在有新版本时于菜单顶部显示一行
241
- 黄字提示,并给出升级命令(不会自动下载安装,你决定何时升)。
159
+ - **多账号**:同一家建多份配置,名称自动追加「 2」「 3」…用**备注**区分,列表显示为「供应商 — 备注」。
160
+ - **自定义供应商**:`presets.json` 是供应商目录,加一个 JSON 条目就多一个供应商,无需改代码。可在 `~/.cc-mini/presets.json` 放自定义版覆盖随工具发布的版本。
161
+ - **第三方首次弹登录**:在 `~/.claude.json` 最外层加 `"hasCompletedOnboarding": true`(**只加这个键**,别覆盖整个文件——里面还有你的 MCP 配置)。
162
+ - **更新检查**:主菜单可切「提醒」模式,新版本出现时菜单顶部黄字提示升级命令。每天最多查一次,不自动升级。
242
163
 
243
- - 不走 GitHub API,每天最多查一次,结果缓存在 `~/.cc-mini/update-check.json`;离线或失败都静默。
244
- - 检查在后台进行、不拖慢启动——新版本通常在**下次打开**时才提示。
245
- - 升级就是重新跑一次安装命令(原生版用[安装](#安装)里的一行命令,npm 版 `npm i -g @cc-x/cc-x@latest`)。
164
+ ---
246
165
 
247
- ## 首次使用:跳过登录 / 引导
166
+ ## 数据与文件
248
167
 
249
- 用第三方 API(token 鉴权)时,Claude Code **首次启动仍可能弹登录 / 引导**——因为它没记录“已完成引导”。
250
- 一次性修复:在 `~/.claude.json`(Windows `C:\Users\你的用户名\.claude.json`)的最外层 `{ }` 里
251
- **只加一个键**(其它内容原样保留):
168
+ - **配置(含明文密钥,勿外传)**:`~/.cc-mini/providers.json`(也存界面语言 `lang`、更新检查 `update`)
169
+ - **供应商目录**:随工具发布的 `presets.json`;`~/.cc-mini/presets.json` 可覆盖
170
+ - **「设为默认」写的是用户环境变量**(不是 Claude 配置文件):
171
+ - Windows → 注册表 `HKCU\Environment` + 广播一次变更
172
+ - Unix → shell 启动文件 `# >>> xx >>>` … `# <<< xx <<<` 标记块(幂等重写,按 `$SHELL` 选文件)
173
+ - 语义一致:**只影响新终端**;切到「官方」会清除全部受管变量
174
+ - **不修改任何 Claude Code 配置文件。**
252
175
 
253
- ```json
254
- {
255
- "hasCompletedOnboarding": true
256
- }
257
- ```
176
+ ccx 只动这 7 个「受管」环境变量,切换时清掉目标不用的:
177
+ `ANTHROPIC_BASE_URL`、`ANTHROPIC_AUTH_TOKEN`、`ANTHROPIC_API_KEY`、`ANTHROPIC_DEFAULT_OPUS_MODEL`、`ANTHROPIC_DEFAULT_SONNET_MODEL`、`ANTHROPIC_DEFAULT_HAIKU_MODEL`、`CLAUDE_CODE_EFFORT_LEVEL`。
258
178
 
259
- > ⚠️ 这个文件还存着你的 MCP 等配置,**务必只“加键”、不要整体覆盖**。ccx 刻意不替你改它——它正是
260
- > 最不该被工具乱动的地方。
179
+ > 💡 需要改 `settings.json`?直接用 Claude Code 的 `/update-config` 说需求(如"允许 npm 命令"),比让外部工具改可靠。
261
180
 
262
- ## 数据与文件位置
181
+ ---
263
182
 
264
- - **配置(含明文密钥,勿外传)**:`~/.cc-mini/providers.json`(含界面语言 `lang`、更新检查 `update`)。
265
- - **供应商目录**:随工具发布的 `presets.json`,或 `~/.cc-mini/presets.json`(自定义覆盖)。
266
- - **更新检查缓存**:`~/.cc-mini/update-check.json`。
267
- - **「设为默认」写的是用户环境变量**(不是 Claude 配置文件):
268
- - **Windows** → 注册表 `HKCU\Environment` + 广播一次变更;
269
- - **macOS / Linux** → shell 启动文件里的 `# >>> xx >>>` … `# <<< xx <<<` 标记块(幂等重写,按 `$SHELL` 选文件)。
270
- - 二者语义一致:**只影响新开终端**;切到「官方」会清除全部受管变量。
271
- - **不修改任何 Claude 配置文件。**
183
+ ## FAQ
272
184
 
273
- ccx 只动这 7 个“受管”环境变量,其它一律不碰,切换时还会清掉目标没用到的那些:
274
- `ANTHROPIC_BASE_URL`、`ANTHROPIC_AUTH_TOKEN`、`ANTHROPIC_API_KEY`、`ANTHROPIC_DEFAULT_OPUS_MODEL`、
275
- `ANTHROPIC_DEFAULT_SONNET_MODEL`、`ANTHROPIC_DEFAULT_HAIKU_MODEL`、`CLAUDE_CODE_EFFORT_LEVEL`。
185
+ **一个终端切了,影响另一个吗?** 不影响。「本次启用」进程级,「设为默认」只对新终端生效。
276
186
 
277
- > 💡 需要改 `settings.json` 时,直接用 Claude Code 官方的 `/update-config` 用自然语言说需求(如“允许运行
278
- > npm 命令”),比让外部工具乱改更可靠。
187
+ **设为默认了,当前终端敲 `claude` 还是旧的?** 正常——当前终端是旧环境,新开即可。
279
188
 
280
- ## 常见问题(FAQ)
189
+ **报 `cannot be parsed as a URL`?** 某配置的 API 地址填了无效值,编辑改正或删除。
281
190
 
282
- **在一个终端切换,会影响另一个正在运行的终端吗?** 不会。「本次启用」是进程级;「设为默认」只对**新开**
283
- 的进程生效,运行中的会话启动时已定型。
191
+ **第三方 effort 没效果?** effort 是 Claude 模型特性,第三方不一定支持。DeepSeek 推荐 `max`,其余留空。
284
192
 
285
- **“设为默认”了,但当前终端敲 `claude` 还是旧的?** 正常——当前终端是旧环境,请**新开终端**。
193
+ **密钥安全吗?** 明文存本机用户目录,受账户权限保护。别把 `providers.json` 提交到仓库。
286
194
 
287
- **出现 `... cannot be parsed as a URL`?** 某配置的 API 地址填成了无效值,进「编辑」改正或删除即可。
195
+ **能指定安装目录吗?** 可以。Windows 安装脚本支持 `-InstallDir`;macOS / Linux 可用 `CCX_INSTALL_DIR` `--install-dir`。只有少数用户需要改,默认安装最省心;如果改过目录,卸载时也传同一个目录。
288
196
 
289
- **第三方设了 effort 没反应?** effort Claude 模型特性,第三方未必支持。DeepSeek 推荐 `max`,其余留空即可。
197
+ **能手动下载二进制吗?** 可以,到 [GitHub Releases](https://github.com/becomeless/cc-x/releases/latest) 下载对应系统的 zip / tar.gz,解压后把 `xx` / `xx.exe` 放到 PATH 里的目录。普通用户建议用上面的安装命令:会自动选平台、做校验,并处理 PATH / 卸载。
290
198
 
291
- **密钥安全吗?** 明文存于本机用户目录、受账户权限保护。注意别把 `providers.json` 提交到仓库。
199
+ ---
292
200
 
293
201
  ## 卸载
294
202
 
295
- 1. **先清环境变量**:在 `xx` 里执行「设为默认 官方」一次,清除全部受管变量。
296
- 2. **卸载本体**:
203
+ 1. 先清环境变量:`xx` → 选「官方」→ 设为默认
204
+ 2. 卸载本体:
297
205
  - Windows 原生版:
298
206
  ```powershell
299
- powershell -NoProfile -ExecutionPolicy Bypass -Command "$s = irm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1; & ([scriptblock]::Create($s)) -Uninstall"
207
+ $s = irm https://github.com/becomeless/cc-x/releases/latest/download/install.ps1
208
+ & ([scriptblock]::Create($s)) -Uninstall
300
209
  ```
210
+ 会删除安装文件,并自动清理对应的用户 PATH 条目。
301
211
  - macOS / Linux 原生版:
302
212
  ```bash
303
213
  curl -fsSL https://github.com/becomeless/cc-x/releases/latest/download/install.sh | sh -s -- --uninstall
304
214
  ```
305
- - npm 版:`npm uninstall -g @cc-x/cc-x`。
306
- - macOS / Linux 若用过「设为默认」,顺手删掉 shell 启动文件里的 `# >>> xx >>>` 标记块。
307
- 3. 删除数据目录 `~/.cc-mini/`。
215
+ - npm:`npm uninstall -g @cc-x/cc-x`
216
+ 3. 删数据:`rm -rf ~/.cc-mini`
308
217
 
309
- ## 设计原则与初心
310
-
311
- ccx 源于我用 cc-switch 时反复遇到的不顺——不是批评,cc-switch 很强大,我只是想走一条更轻的路。
312
- 所以 ccx 只信奉一条:**越简单越好。** 只做“切 API”一件事;能不碰的就不碰(尤其**绝不写 Claude Code
313
- 配置文件**);每加一个功能前先问一句能不能不加。
314
-
315
- 欢迎 Issue / PR——但**让它更简单的改动,比让它更强大的改动更受欢迎**;任何会写 Claude Code 配置文件
316
- 的改动都不会被接受。
218
+ ---
317
219
 
318
220
  ## 许可
319
221
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-x/cc-x",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Claude Code API 切换器(命令 xx):在官方账号与第三方 Anthropic 兼容 API 间切换,纯环境变量、不碰 Claude Code 配置文件。",
5
5
  "keywords": [
6
6
  "claude",