@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.
- package/README.en.md +135 -227
- package/README.md +116 -214
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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.
|
|
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+↑↓
|
|
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
|
|
33
|
+
> Install [Claude Code](https://claude.ai/code) first (`claude` on PATH). **Open a new terminal** after installing.
|
|
59
34
|
|
|
60
|
-
**Windows native
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
75
|
-
|
|
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
|
|
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
|
-
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 60-second quick start
|
|
84
61
|
|
|
85
|
-
|
|
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
|
-
|
|
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
|
|
80
|
+
## Two modes (the key concept)
|
|
95
81
|
|
|
96
|
-
|
|
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
|
|
101
|
-
| Scope | This terminal only
|
|
102
|
-
|
|
|
103
|
-
|
|
|
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,
|
|
92
|
+
`xx 小米MiMo -s` — four Claudes running at once, each on its own API, zero interference.
|
|
107
93
|
|
|
108
|
-
**Why not
|
|
109
|
-
|
|
110
|
-
Environment variables are process-isolated
|
|
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
|
-
|
|
98
|
+
---
|
|
113
99
|
|
|
114
|
-
|
|
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
|
-
|
|
102
|
+
cc-switch is an excellent full-featured GUI; ccx takes the opposite, minimal approach.
|
|
124
103
|
|
|
125
|
-
|
|
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
|
-
|
|
128
|
-
|
|
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
|
-
|
|
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
|
-
|
|
138
|
-
Profile: DeepSeek — work [Key set]
|
|
117
|
+
## Design philosophy
|
|
139
118
|
|
|
140
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
174
130
|
|
|
175
131
|
### Fields
|
|
176
132
|
|
|
177
133
|
| Field | Environment variable | Notes |
|
|
178
134
|
|---|---|---|
|
|
179
|
-
|
|
|
180
|
-
|
|
|
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` |
|
|
185
|
-
| sonnet → model | `ANTHROPIC_DEFAULT_SONNET_MODEL` |
|
|
186
|
-
| haiku → model | `ANTHROPIC_DEFAULT_HAIKU_MODEL` |
|
|
187
|
-
| effort level | `CLAUDE_CODE_EFFORT_LEVEL` |
|
|
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
|
-
>
|
|
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
|
-
| `
|
|
219
|
-
| `
|
|
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
|
-
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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
|
-
|
|
272
|
-
> deliberately won't edit it for you; it's exactly the file a tool shouldn't touch.
|
|
177
|
+
---
|
|
273
178
|
|
|
274
|
-
## Data &
|
|
179
|
+
## Data & files
|
|
275
180
|
|
|
276
|
-
- **Profiles (plaintext keys, keep local)**: `~/.cc-mini/providers.json` (also holds `lang` and `update`)
|
|
277
|
-
- **Provider catalog**:
|
|
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
|
-
-
|
|
281
|
-
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
|
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
|
|
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
|
|
296
|
-
default" only affects
|
|
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
|
|
299
|
-
|
|
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
|
|
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
|
|
304
|
-
support it. DeepSeek recommends `max`;
|
|
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?**
|
|
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.
|
|
312
|
-
2.
|
|
226
|
+
1. Clear env vars: `xx` → Official → Set default
|
|
227
|
+
2. Remove the binary:
|
|
313
228
|
- Windows native:
|
|
314
229
|
```powershell
|
|
315
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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.
|
|
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
|
|
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
|
|
25
|
+
> 覆盖 Windows x64、macOS Intel / Apple Silicon、Linux x64 / arm64。npm 用户可装
|
|
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
|
-
>
|
|
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
|
-
|
|
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
|
-
|
|
48
|
+
安装器会放到用户级命令目录;若该目录不在 PATH 中,会打印一行提示(Unix 版刻意不自动改 shell 配置)。
|
|
72
49
|
|
|
73
|
-
**npm
|
|
50
|
+
**npm(全平台,需 Node.js ≥ 18)**
|
|
74
51
|
|
|
75
52
|
```bash
|
|
76
53
|
npm install -g @cc-x/cc-x
|
|
77
54
|
```
|
|
78
55
|
|
|
79
|
-
|
|
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
|
-
|
|
102
|
-
得到 4 个同时运行、各用各 API、互不干扰的 Claude。
|
|
58
|
+
## 60 秒上手
|
|
103
59
|
|
|
104
|
-
|
|
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
|
|
112
|
-
xx DeepSeek -s
|
|
113
|
-
xx -l
|
|
114
|
-
xx --
|
|
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
|
-
|
|
75
|
+
---
|
|
119
76
|
|
|
120
|
-
##
|
|
77
|
+
## 两种模式(核心概念)
|
|
121
78
|
|
|
122
|
-
|
|
123
|
-
**`Shift+↑↓`(或 `PgUp`/`PgDn`)可上下移动排序**,即时保存。
|
|
79
|
+
Claude 用哪个 API 由**环境变量**决定。ccx 提供两种作用范围:
|
|
124
80
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
81
|
+
| | 本次启用 (`-s`) | 设为默认 |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| 机制 | 给当前进程设环境变量,启动 `claude` | 写入**用户环境变量** |
|
|
84
|
+
| 作用范围 | 仅当前终端,**关了就没** | 之后**新开**的终端默认用它 |
|
|
85
|
+
| 对正在跑的会话 | 零影响 | 零影响(进程启动时已定型) |
|
|
86
|
+
| 适合 | 多终端并行,各跑各的 API | 定好主力 API,不用老切 |
|
|
130
87
|
|
|
131
|
-
|
|
132
|
-
配置:DeepSeek — 公司 [密钥已设]
|
|
88
|
+
**并行示例**:开 4 个终端分别 `xx 官方 -s`、`xx DeepSeek -s`、`xx 智谱GLM -s`、`xx 小米MiMo -s`——四个 Claude 同时干活、各用各的 API、互不打架。
|
|
133
89
|
|
|
134
|
-
|
|
135
|
-
设为默认 — 新终端裸敲 claude 默认用它(不影响运行中会话)
|
|
136
|
-
编辑
|
|
137
|
-
删除
|
|
138
|
-
返回
|
|
90
|
+
**为什么不用配置文件?** `settings.json` 全局共享,改它会波及正在跑的会话(典型症状:另一终端突然报 `cannot be parsed as a URL`)。环境变量天然进程隔离,避开了这个坑。
|
|
139
91
|
|
|
140
|
-
|
|
141
|
-
```
|
|
92
|
+
---
|
|
142
93
|
|
|
143
|
-
|
|
144
|
-
输入 `-` = 清空、`Esc` = 取消该项。第一项**「供应商」**最关键:选一个供应商(来自预设目录)后会
|
|
145
|
-
**自动填入** API 地址、三档模型映射、认证字段(多地址的供应商会先让你选一个);「备注」随你写。
|
|
94
|
+
## 和 cc-switch 怎么选
|
|
146
95
|
|
|
147
|
-
|
|
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
|
-
|
|
183
|
-
> `/model opus\|sonnet\|haiku` 现场选档,映射表负责把它翻译成对应供应商的模型。
|
|
111
|
+
## 设计哲学
|
|
184
112
|
|
|
185
|
-
|
|
113
|
+
> ccx 的边界比功能更重要。
|
|
186
114
|
|
|
187
|
-
|
|
188
|
-
默认会叫 `claude-*`,不映射就报错。后台任务走 `haiku` 档,所以 `haiku → 模型` **也必须填**
|
|
189
|
-
(否则表现为“主对话能用但时不时报错”)。
|
|
115
|
+
Claude Code 已经有自己的配置系统、MCP 生态和会话状态。ccx 不想再造一个“上层控制台”,也不想把用户的配置收编进自己的数据库。它只站在 Claude Code 进程启动前的那一小步:把 7 个受管环境变量准备好,然后让 Claude Code 自己工作。
|
|
190
116
|
|
|
191
|
-
|
|
192
|
-
默认;留空 = 不设。注意 **effort 是 Claude 模型特性,第三方是否生效取决于各家实现**。
|
|
117
|
+
所以它的取舍是有意的:不写 Claude Code 配置文件,不接管 MCP,不做自动迁移,不做后台常驻管理。能用进程环境变量解决,就不碰全局文件;能让用户显式选择,就不替用户自动决定。少做一点,是为了把风险面压到足够小。
|
|
193
118
|
|
|
194
|
-
|
|
119
|
+
欢迎 Issue / PR,但方向很明确:**让切换更稳、更清楚、更不打扰用户**,比堆更多管理能力更重要。任何会写 Claude Code 配置文件的改动都不会被接受。
|
|
195
120
|
|
|
196
|
-
|
|
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
|
-
###
|
|
125
|
+
### 字段一览
|
|
206
126
|
|
|
207
|
-
|
|
|
127
|
+
| 字段 | 对应环境变量 | 说明 |
|
|
208
128
|
|---|---|---|
|
|
209
|
-
|
|
|
210
|
-
|
|
|
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
|
-
|
|
137
|
+
> ccx **刻意不设** `ANTHROPIC_MODEL`。在会话里用 `/model opus|sonnet|haiku` 选档,映射表负责翻译成对应供应商的模型名。
|
|
213
138
|
|
|
214
|
-
|
|
139
|
+
### 认证字段:AUTH_TOKEN vs API_KEY
|
|
215
140
|
|
|
216
|
-
|
|
217
|
-
|
|
141
|
+
| 选项 | 实际请求头 | 谁用 |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| `AUTH_TOKEN`(默认) | `Authorization: Bearer <key>` | 绝大多数第三方中转 |
|
|
144
|
+
| `API_KEY` | `x-api-key: <key>` | 官方 API,及少数中转 |
|
|
218
145
|
|
|
219
|
-
|
|
220
|
-
加一个供应商即多一个预设,无需改代码:
|
|
146
|
+
### 预置配置
|
|
221
147
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
235
|
-
- `models` 是三档推荐映射,选供应商时自动填入,之后仍可手改。`auth` / `effort` 可选,一并带出。
|
|
236
|
-
- 也可在 `~/.cc-mini/presets.json` 放一份自定义目录覆盖随工具发布的版本(优先级最高)。
|
|
155
|
+
> 模型名随各家更新而变,以供应商官方接入文档为准。小米有按量付费和 TokenPlan 两个地址,选供应商时会让你挑。
|
|
237
156
|
|
|
238
|
-
|
|
157
|
+
### 进阶
|
|
239
158
|
|
|
240
|
-
|
|
241
|
-
|
|
159
|
+
- **多账号**:同一家建多份配置,名称自动追加「 2」「 3」…用**备注**区分,列表显示为「供应商 — 备注」。
|
|
160
|
+
- **自定义供应商**:`presets.json` 是供应商目录,加一个 JSON 条目就多一个供应商,无需改代码。可在 `~/.cc-mini/presets.json` 放自定义版覆盖随工具发布的版本。
|
|
161
|
+
- **第三方首次弹登录**:在 `~/.claude.json` 最外层加 `"hasCompletedOnboarding": true`(**只加这个键**,别覆盖整个文件——里面还有你的 MCP 配置)。
|
|
162
|
+
- **更新检查**:主菜单可切「提醒」模式,新版本出现时菜单顶部黄字提示升级命令。每天最多查一次,不自动升级。
|
|
242
163
|
|
|
243
|
-
|
|
244
|
-
- 检查在后台进行、不拖慢启动——新版本通常在**下次打开**时才提示。
|
|
245
|
-
- 升级就是重新跑一次安装命令(原生版用[安装](#安装)里的一行命令,npm 版 `npm i -g @cc-x/cc-x@latest`)。
|
|
164
|
+
---
|
|
246
165
|
|
|
247
|
-
##
|
|
166
|
+
## 数据与文件
|
|
248
167
|
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
|
|
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
|
-
>
|
|
260
|
-
> 最不该被工具乱动的地方。
|
|
179
|
+
> 💡 需要改 `settings.json`?直接用 Claude Code 的 `/update-config` 说需求(如"允许 npm 命令"),比让外部工具改可靠。
|
|
261
180
|
|
|
262
|
-
|
|
181
|
+
---
|
|
263
182
|
|
|
264
|
-
|
|
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
|
-
|
|
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
|
-
|
|
278
|
-
> npm 命令”),比让外部工具乱改更可靠。
|
|
187
|
+
**设为默认了,当前终端敲 `claude` 还是旧的?** 正常——当前终端是旧环境,新开即可。
|
|
279
188
|
|
|
280
|
-
|
|
189
|
+
**报 `cannot be parsed as a URL`?** 某配置的 API 地址填了无效值,编辑改正或删除。
|
|
281
190
|
|
|
282
|
-
|
|
283
|
-
的进程生效,运行中的会话启动时已定型。
|
|
191
|
+
**第三方 effort 没效果?** effort 是 Claude 模型特性,第三方不一定支持。DeepSeek 推荐 `max`,其余留空。
|
|
284
192
|
|
|
285
|
-
|
|
193
|
+
**密钥安全吗?** 明文存本机用户目录,受账户权限保护。别把 `providers.json` 提交到仓库。
|
|
286
194
|
|
|
287
|
-
|
|
195
|
+
**能指定安装目录吗?** 可以。Windows 安装脚本支持 `-InstallDir`;macOS / Linux 可用 `CCX_INSTALL_DIR` 或 `--install-dir`。只有少数用户需要改,默认安装最省心;如果改过目录,卸载时也传同一个目录。
|
|
288
196
|
|
|
289
|
-
|
|
197
|
+
**能手动下载二进制吗?** 可以,到 [GitHub Releases](https://github.com/becomeless/cc-x/releases/latest) 下载对应系统的 zip / tar.gz,解压后把 `xx` / `xx.exe` 放到 PATH 里的目录。普通用户建议用上面的安装命令:会自动选平台、做校验,并处理 PATH / 卸载。
|
|
290
198
|
|
|
291
|
-
|
|
199
|
+
---
|
|
292
200
|
|
|
293
201
|
## 卸载
|
|
294
202
|
|
|
295
|
-
1.
|
|
296
|
-
2.
|
|
203
|
+
1. 先清环境变量:`xx` → 选「官方」→ 设为默认
|
|
204
|
+
2. 卸载本体:
|
|
297
205
|
- Windows 原生版:
|
|
298
206
|
```powershell
|
|
299
|
-
|
|
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
|
|
306
|
-
|
|
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
|
|