cc-provider-switcher 0.1.0 → 0.2.1
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.md +94 -29
- package/dist/cli.js +76 -35
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -26,6 +26,14 @@ Or use without installing:
|
|
|
26
26
|
npx cc-provider-switcher deepseek
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
## Updating
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm install -g cc-provider-switcher@latest
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> `npm update` won't cross major versions — always use `@latest` to get the newest release.
|
|
36
|
+
|
|
29
37
|
---
|
|
30
38
|
|
|
31
39
|
## Quick start
|
|
@@ -37,6 +45,40 @@ npx cc-provider-switcher deepseek
|
|
|
37
45
|
|
|
38
46
|
---
|
|
39
47
|
|
|
48
|
+
## Thinking & effort support
|
|
49
|
+
|
|
50
|
+
ccs sets `ANTHROPIC_DEFAULT_*_MODEL_SUPPORTED_CAPABILITIES` so Claude Code knows which thinking features a provider supports. No extra steps needed after switching.
|
|
51
|
+
|
|
52
|
+
**Providers with effort control** (DeepSeek, GLM, Qwen, Kimi, StepFun):
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
ccs deepseek
|
|
56
|
+
# Claude Code now exposes /effort controls (low / medium / high)
|
|
57
|
+
# Use /effort high inside Claude Code — DeepSeek maps it to reasoning_effort internally
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
ccs glm
|
|
62
|
+
# Same, plus max_effort tier available
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**MiniMax — adaptive thinking:**
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
ccs minimax
|
|
69
|
+
# MiniMax decides when to think based on task complexity — nothing to configure
|
|
70
|
+
# Note shown: "Only adaptive/disabled thinking (enabled returns 400)"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Seed/Doubao — thinking on/off only:**
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
ccs seed
|
|
77
|
+
# Thinking is either on or off, no granular effort control
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
40
82
|
## Commands
|
|
41
83
|
|
|
42
84
|
| Command | Description |
|
|
@@ -59,17 +101,42 @@ npx cc-provider-switcher deepseek
|
|
|
59
101
|
|
|
60
102
|
## Providers
|
|
61
103
|
|
|
62
|
-
| Name | Key | Aliases | Regions |
|
|
63
|
-
|
|
64
|
-
| DeepSeek | `deepseek` | `ds` | global |
|
|
65
|
-
| MiniMax | `minimax` | `mm` | global, china |
|
|
66
|
-
| Kimi | `kimi` | `kimi2` | global, china |
|
|
67
|
-
| Qwen | `qwen` | — | global, china |
|
|
68
|
-
| GLM | `glm` | `glm5` | global, china |
|
|
69
|
-
| Seed/Doubao | `seed` | `doubao` | global |
|
|
70
|
-
| StepFun | `stepfun` | `sf` | global |
|
|
71
|
-
| OpenRouter | `openrouter` | `or` | global |
|
|
72
|
-
| Claude (Anthropic) | `claude` | `anthropic`, `sonnet` | global |
|
|
104
|
+
| Name | Key | Aliases | Thinking | Regions |
|
|
105
|
+
|------|-----|---------|----------|---------|
|
|
106
|
+
| DeepSeek | `deepseek` | `ds` | effort | global |
|
|
107
|
+
| MiniMax | `minimax` | `mm` | adaptive | global, china |
|
|
108
|
+
| Kimi | `kimi` | `kimi2` | effort | global, china |
|
|
109
|
+
| Qwen | `qwen` | — | effort | global, china |
|
|
110
|
+
| GLM | `glm` | `glm5` | effort | global, china |
|
|
111
|
+
| Seed/Doubao | `seed` | `doubao` | on/off | global |
|
|
112
|
+
| StepFun | `stepfun` | `sf` | effort | global |
|
|
113
|
+
| OpenRouter | `openrouter` | `or` | passthrough | global |
|
|
114
|
+
| Claude (Anthropic) | `claude` | `anthropic`, `sonnet` | native | global |
|
|
115
|
+
|
|
116
|
+
**Thinking column:**
|
|
117
|
+
- `effort` — reasoning_effort levels (low/medium/high)
|
|
118
|
+
- `adaptive` — adaptive thinking only (`enabled` causes 400 on this provider)
|
|
119
|
+
- `on/off` — thinking enabled/disabled, no effort control
|
|
120
|
+
- `native` — Claude Code's built-in detection applies
|
|
121
|
+
- `passthrough` — depends on the model routed through OpenRouter
|
|
122
|
+
|
|
123
|
+
### Model mapping
|
|
124
|
+
|
|
125
|
+
When Claude Code picks haiku/sonnet/opus, ccs maps them to the actual model IDs below:
|
|
126
|
+
|
|
127
|
+
| Provider | Haiku | Sonnet | Opus |
|
|
128
|
+
|----------|-------|--------|------|
|
|
129
|
+
| DeepSeek | `deepseek-v4-flash` | `deepseek-v4-flash` | `deepseek-v4-pro` |
|
|
130
|
+
| MiniMax | `MiniMax-M3` | `MiniMax-M3` | `MiniMax-M3` |
|
|
131
|
+
| Kimi | `kimi-k2.7-code-highspeed` | `kimi-k2.7-code-highspeed` | `kimi-k2.7-code` |
|
|
132
|
+
| Qwen | `qwen3.7-plus` | `qwen3.7-plus` | `qwen3.7-max` |
|
|
133
|
+
| GLM | `glm-5.2` | `glm-5.2` | `glm-5.2` |
|
|
134
|
+
| Seed/Doubao | `ark-code-latest` | `ark-code-latest` | `ark-code-latest` |
|
|
135
|
+
| StepFun | `step-3.7-flash` | `step-3.7-flash` | `step-3.7-flash` |
|
|
136
|
+
| OpenRouter | `anthropic/claude-haiku-4.5` | `anthropic/claude-sonnet-4.6` | `anthropic/claude-opus-4.8` |
|
|
137
|
+
| Claude (Anthropic) | `claude-haiku-4-5-20251001` | `claude-sonnet-4-6` | `claude-opus-4-8` |
|
|
138
|
+
|
|
139
|
+
Override any ID via `providerOverrides` in `~/.ccs/config.json` — see [Override model IDs](#override-model-ids).
|
|
73
140
|
|
|
74
141
|
---
|
|
75
142
|
|
|
@@ -125,11 +192,14 @@ ccs modifies only the `env` block in Claude Code settings. It never touches othe
|
|
|
125
192
|
"env": {
|
|
126
193
|
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
|
|
127
194
|
"ANTHROPIC_AUTH_TOKEN": "sk-...",
|
|
128
|
-
"ANTHROPIC_MODEL": "deepseek-
|
|
129
|
-
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-
|
|
130
|
-
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-
|
|
131
|
-
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-
|
|
132
|
-
"CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-
|
|
195
|
+
"ANTHROPIC_MODEL": "deepseek-v4-flash",
|
|
196
|
+
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-flash",
|
|
197
|
+
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
|
|
198
|
+
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
|
|
199
|
+
"CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-flash",
|
|
200
|
+
"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES": "effort,thinking",
|
|
201
|
+
"ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES": "effort,thinking",
|
|
202
|
+
"ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES": "effort,thinking"
|
|
133
203
|
},
|
|
134
204
|
"ccsManaged": true
|
|
135
205
|
}
|
|
@@ -169,23 +239,18 @@ Add an entry to `src/providers/providers.json` and submit a PR:
|
|
|
169
239
|
"sonnet": "my-model-v1",
|
|
170
240
|
"opus": "my-model-v1",
|
|
171
241
|
"haiku": "my-model-v1"
|
|
172
|
-
}
|
|
242
|
+
},
|
|
243
|
+
"supportedCapabilities": ["effort", "thinking"],
|
|
244
|
+
"thinkingNote": "Optional note shown after ccs switch"
|
|
173
245
|
}
|
|
174
246
|
}
|
|
175
247
|
```
|
|
176
248
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|--|--|--|
|
|
183
|
-
| Distribution | npm (no install script) | bash script |
|
|
184
|
-
| Provider definitions | JSON registry | hardcoded functions |
|
|
185
|
-
| Adding providers | JSON entry | copy-paste bash function |
|
|
186
|
-
| Model IDs | User-overridable | Hardcoded |
|
|
187
|
-
| Tests | Vitest suite | None |
|
|
188
|
-
| Settings method | Direct `settings.json` write | `eval` + env vars |
|
|
249
|
+
**Optional fields:**
|
|
250
|
+
- `supportedCapabilities` — Claude Code capability strings to declare (`effort`, `thinking`, `adaptive_thinking`, `max_effort`). Sets `ANTHROPIC_DEFAULT_*_MODEL_SUPPORTED_CAPABILITIES` env vars so Claude Code enables effort/thinking controls.
|
|
251
|
+
- `thinkingNote` — shown as an info line after switching, to warn about provider-specific limits.
|
|
252
|
+
- `regions` — map of region name → base URL.
|
|
253
|
+
- `optional` — if `true`, missing API key is not a fatal error (used for Claude native).
|
|
189
254
|
|
|
190
255
|
---
|
|
191
256
|
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { program } from "commander";
|
|
5
|
+
import { createRequire } from "module";
|
|
5
6
|
|
|
6
7
|
// src/types.ts
|
|
7
8
|
import { z } from "zod";
|
|
@@ -17,7 +18,9 @@ var ProviderSchema = z.object({
|
|
|
17
18
|
haiku: z.string()
|
|
18
19
|
}),
|
|
19
20
|
regions: z.record(z.string(), z.string()).optional(),
|
|
20
|
-
optional: z.boolean().optional()
|
|
21
|
+
optional: z.boolean().optional(),
|
|
22
|
+
supportedCapabilities: z.array(z.string()).optional(),
|
|
23
|
+
thinkingNote: z.string().optional()
|
|
21
24
|
});
|
|
22
25
|
var ProviderRegistrySchema = z.object({
|
|
23
26
|
providers: z.record(z.string(), ProviderSchema)
|
|
@@ -40,52 +43,57 @@ var providers_default = {
|
|
|
40
43
|
deepseek: {
|
|
41
44
|
name: "DeepSeek",
|
|
42
45
|
baseUrl: "https://api.deepseek.com/anthropic",
|
|
43
|
-
defaultModel: "deepseek-
|
|
46
|
+
defaultModel: "deepseek-v4-flash",
|
|
44
47
|
aliases: ["ds"],
|
|
45
48
|
keyEnvVar: "DEEPSEEK_API_KEY",
|
|
46
|
-
models: { sonnet: "deepseek-
|
|
49
|
+
models: { sonnet: "deepseek-v4-flash", opus: "deepseek-v4-pro", haiku: "deepseek-v4-flash" },
|
|
50
|
+
supportedCapabilities: ["effort", "thinking"],
|
|
51
|
+
thinkingNote: "budget_tokens ignored, uses reasoning_effort internally"
|
|
47
52
|
},
|
|
48
53
|
minimax: {
|
|
49
54
|
name: "MiniMax",
|
|
50
55
|
baseUrl: "https://api.minimax.io/anthropic",
|
|
51
|
-
defaultModel: "MiniMax-
|
|
56
|
+
defaultModel: "MiniMax-M3",
|
|
52
57
|
aliases: ["mm"],
|
|
53
58
|
keyEnvVar: "MINIMAX_API_KEY",
|
|
54
59
|
regions: {
|
|
55
60
|
global: "https://api.minimax.io/anthropic",
|
|
56
61
|
china: "https://api.minimaxi.com/anthropic"
|
|
57
62
|
},
|
|
58
|
-
models: { sonnet: "MiniMax-
|
|
63
|
+
models: { sonnet: "MiniMax-M3", opus: "MiniMax-M3", haiku: "MiniMax-M3" },
|
|
64
|
+
supportedCapabilities: ["adaptive_thinking"],
|
|
65
|
+
thinkingNote: "Only adaptive/disabled thinking (enabled returns 400)"
|
|
59
66
|
},
|
|
60
67
|
claude: {
|
|
61
68
|
name: "Claude (Anthropic)",
|
|
62
69
|
baseUrl: "https://api.anthropic.com/",
|
|
63
|
-
defaultModel: "claude-sonnet-4-
|
|
70
|
+
defaultModel: "claude-sonnet-4-6",
|
|
64
71
|
aliases: ["anthropic", "sonnet"],
|
|
65
72
|
keyEnvVar: "CLAUDE_API_KEY",
|
|
66
73
|
optional: true,
|
|
67
74
|
models: {
|
|
68
|
-
sonnet: "claude-sonnet-4-
|
|
69
|
-
opus: "claude-opus-4-
|
|
75
|
+
sonnet: "claude-sonnet-4-6",
|
|
76
|
+
opus: "claude-opus-4-8",
|
|
70
77
|
haiku: "claude-haiku-4-5-20251001"
|
|
71
78
|
}
|
|
72
79
|
},
|
|
73
80
|
kimi: {
|
|
74
81
|
name: "Kimi",
|
|
75
82
|
baseUrl: "https://api.moonshot.ai/anthropic",
|
|
76
|
-
defaultModel: "kimi-k2.
|
|
83
|
+
defaultModel: "kimi-k2.7-code",
|
|
77
84
|
aliases: ["kimi2"],
|
|
78
85
|
keyEnvVar: "KIMI_API_KEY",
|
|
79
86
|
regions: {
|
|
80
87
|
global: "https://api.moonshot.ai/anthropic",
|
|
81
88
|
china: "https://api.moonshot.cn/anthropic"
|
|
82
89
|
},
|
|
83
|
-
models: { sonnet: "kimi-k2.
|
|
90
|
+
models: { sonnet: "kimi-k2.7-code-highspeed", opus: "kimi-k2.7-code", haiku: "kimi-k2.7-code-highspeed" },
|
|
91
|
+
supportedCapabilities: ["effort", "thinking"]
|
|
84
92
|
},
|
|
85
93
|
qwen: {
|
|
86
94
|
name: "Qwen",
|
|
87
95
|
baseUrl: "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",
|
|
88
|
-
defaultModel: "qwen3-max
|
|
96
|
+
defaultModel: "qwen3.7-max",
|
|
89
97
|
aliases: [],
|
|
90
98
|
keyEnvVar: "QWEN_API_KEY",
|
|
91
99
|
regions: {
|
|
@@ -93,22 +101,26 @@ var providers_default = {
|
|
|
93
101
|
china: "https://coding.dashscope.aliyuncs.com/apps/anthropic"
|
|
94
102
|
},
|
|
95
103
|
models: {
|
|
96
|
-
sonnet: "qwen3-
|
|
97
|
-
opus: "qwen3-max
|
|
98
|
-
haiku: "qwen3-
|
|
99
|
-
}
|
|
104
|
+
sonnet: "qwen3.7-plus",
|
|
105
|
+
opus: "qwen3.7-max",
|
|
106
|
+
haiku: "qwen3.7-plus"
|
|
107
|
+
},
|
|
108
|
+
supportedCapabilities: ["effort", "thinking"],
|
|
109
|
+
thinkingNote: "Supports thinking_budget for token-level control"
|
|
100
110
|
},
|
|
101
111
|
glm: {
|
|
102
112
|
name: "GLM",
|
|
103
113
|
baseUrl: "https://api.z.ai/api/anthropic",
|
|
104
|
-
defaultModel: "glm-5",
|
|
114
|
+
defaultModel: "glm-5.2",
|
|
105
115
|
aliases: ["glm5"],
|
|
106
116
|
keyEnvVar: "GLM_API_KEY",
|
|
107
117
|
regions: {
|
|
108
118
|
global: "https://api.z.ai/api/anthropic",
|
|
109
119
|
china: "https://open.bigmodel.cn/api/anthropic"
|
|
110
120
|
},
|
|
111
|
-
models: { sonnet: "glm-5", opus: "glm-5", haiku: "glm-5" }
|
|
121
|
+
models: { sonnet: "glm-5.2", opus: "glm-5.2", haiku: "glm-5.2" },
|
|
122
|
+
supportedCapabilities: ["effort", "max_effort", "thinking"],
|
|
123
|
+
thinkingNote: "Two-tier effort: high and max"
|
|
112
124
|
},
|
|
113
125
|
seed: {
|
|
114
126
|
name: "Seed/Doubao",
|
|
@@ -120,29 +132,33 @@ var providers_default = {
|
|
|
120
132
|
sonnet: "ark-code-latest",
|
|
121
133
|
opus: "ark-code-latest",
|
|
122
134
|
haiku: "ark-code-latest"
|
|
123
|
-
}
|
|
135
|
+
},
|
|
136
|
+
supportedCapabilities: ["thinking"],
|
|
137
|
+
thinkingNote: "Thinking on/off only, no effort levels"
|
|
124
138
|
},
|
|
125
139
|
stepfun: {
|
|
126
140
|
name: "StepFun",
|
|
127
141
|
baseUrl: "https://api.stepfun.ai/v1/anthropic",
|
|
128
|
-
defaultModel: "step-3.
|
|
142
|
+
defaultModel: "step-3.7-flash",
|
|
129
143
|
aliases: ["sf"],
|
|
130
144
|
keyEnvVar: "STEPFUN_API_KEY",
|
|
131
145
|
models: {
|
|
132
|
-
sonnet: "step-3.
|
|
133
|
-
opus: "step-3.
|
|
134
|
-
haiku: "step-3.
|
|
135
|
-
}
|
|
146
|
+
sonnet: "step-3.7-flash",
|
|
147
|
+
opus: "step-3.7-flash",
|
|
148
|
+
haiku: "step-3.7-flash"
|
|
149
|
+
},
|
|
150
|
+
supportedCapabilities: ["effort", "thinking"],
|
|
151
|
+
thinkingNote: "Effort levels: none/low/medium/high"
|
|
136
152
|
},
|
|
137
153
|
openrouter: {
|
|
138
154
|
name: "OpenRouter",
|
|
139
155
|
baseUrl: "https://openrouter.ai/api",
|
|
140
|
-
defaultModel: "anthropic/claude-sonnet-4.
|
|
156
|
+
defaultModel: "anthropic/claude-sonnet-4.6",
|
|
141
157
|
aliases: ["or"],
|
|
142
158
|
keyEnvVar: "OPENROUTER_API_KEY",
|
|
143
159
|
models: {
|
|
144
|
-
sonnet: "anthropic/claude-sonnet-4.
|
|
145
|
-
opus: "anthropic/claude-opus-4.
|
|
160
|
+
sonnet: "anthropic/claude-sonnet-4.6",
|
|
161
|
+
opus: "anthropic/claude-opus-4.8",
|
|
146
162
|
haiku: "anthropic/claude-haiku-4.5"
|
|
147
163
|
}
|
|
148
164
|
}
|
|
@@ -279,7 +295,10 @@ var ENV_KEYS = [
|
|
|
279
295
|
"ANTHROPIC_DEFAULT_SONNET_MODEL",
|
|
280
296
|
"ANTHROPIC_DEFAULT_OPUS_MODEL",
|
|
281
297
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL",
|
|
282
|
-
"CLAUDE_CODE_SUBAGENT_MODEL"
|
|
298
|
+
"CLAUDE_CODE_SUBAGENT_MODEL",
|
|
299
|
+
"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES",
|
|
300
|
+
"ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES",
|
|
301
|
+
"ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES"
|
|
283
302
|
];
|
|
284
303
|
async function readSettings(filePath) {
|
|
285
304
|
try {
|
|
@@ -301,7 +320,11 @@ async function applyEnvBlock(filePath, envBlock) {
|
|
|
301
320
|
const settings = await readSettings(filePath);
|
|
302
321
|
const env = { ...settings.env ?? {} };
|
|
303
322
|
for (const [k, v] of Object.entries(envBlock)) {
|
|
304
|
-
if (v
|
|
323
|
+
if (v === "") {
|
|
324
|
+
delete env[k];
|
|
325
|
+
} else if (v !== void 0) {
|
|
326
|
+
env[k] = v;
|
|
327
|
+
}
|
|
305
328
|
}
|
|
306
329
|
settings.env = env;
|
|
307
330
|
settings[CCS_MANAGED_KEY] = true;
|
|
@@ -366,6 +389,7 @@ async function doSwitch(providerName, region, scope) {
|
|
|
366
389
|
);
|
|
367
390
|
process.exit(1);
|
|
368
391
|
}
|
|
392
|
+
const caps = provider.supportedCapabilities?.join(",") ?? "";
|
|
369
393
|
const envBlock = {
|
|
370
394
|
ANTHROPIC_BASE_URL: baseUrl,
|
|
371
395
|
ANTHROPIC_AUTH_TOKEN: apiKey ?? "",
|
|
@@ -373,7 +397,10 @@ async function doSwitch(providerName, region, scope) {
|
|
|
373
397
|
ANTHROPIC_DEFAULT_SONNET_MODEL: provider.models.sonnet,
|
|
374
398
|
ANTHROPIC_DEFAULT_OPUS_MODEL: provider.models.opus,
|
|
375
399
|
ANTHROPIC_DEFAULT_HAIKU_MODEL: provider.models.haiku,
|
|
376
|
-
CLAUDE_CODE_SUBAGENT_MODEL: provider.models.sonnet
|
|
400
|
+
CLAUDE_CODE_SUBAGENT_MODEL: provider.models.sonnet,
|
|
401
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES: caps,
|
|
402
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES: caps,
|
|
403
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES: caps
|
|
377
404
|
};
|
|
378
405
|
if (scope === "project") {
|
|
379
406
|
await writeProjectSettings(envBlock);
|
|
@@ -385,6 +412,7 @@ async function doSwitch(providerName, region, scope) {
|
|
|
385
412
|
info(`Base URL: ${baseUrl}`);
|
|
386
413
|
info(`Model: ${provider.defaultModel}`);
|
|
387
414
|
if (apiKey) info(`Key: ${maskKey2(apiKey)}`);
|
|
415
|
+
if (provider.thinkingNote) info(`Thinking: ${provider.thinkingNote}`);
|
|
388
416
|
}
|
|
389
417
|
function registerSwitchCommand(program2) {
|
|
390
418
|
program2.argument("<provider>", "Provider name or alias").argument("[region]", "Optional region (global, china, etc.)").action(async (provider, region) => {
|
|
@@ -418,12 +446,15 @@ function registerStatusCommand(program2) {
|
|
|
418
446
|
const key = env["ANTHROPIC_AUTH_TOKEN"] ?? "";
|
|
419
447
|
console.log(`
|
|
420
448
|
${scope} settings:`);
|
|
421
|
-
|
|
449
|
+
const caps = env["ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES"];
|
|
450
|
+
const rows = [
|
|
422
451
|
["Provider", providerName],
|
|
423
452
|
["Base URL", baseUrl],
|
|
424
453
|
["Model", model],
|
|
425
454
|
["API Key", key ? maskKey2(key) : "(not set)"]
|
|
426
|
-
]
|
|
455
|
+
];
|
|
456
|
+
if (caps) rows.push(["Capabilities", caps]);
|
|
457
|
+
table(rows);
|
|
427
458
|
}
|
|
428
459
|
const hasAny = userSettings.env?.["ANTHROPIC_BASE_URL"] || projectSettings.env?.["ANTHROPIC_BASE_URL"];
|
|
429
460
|
if (!hasAny) {
|
|
@@ -434,6 +465,13 @@ ${scope} settings:`);
|
|
|
434
465
|
|
|
435
466
|
// src/commands/list.ts
|
|
436
467
|
import chalk2 from "chalk";
|
|
468
|
+
function thinkingIndicator(key, caps) {
|
|
469
|
+
if (!caps) return key === "claude" ? "native" : key === "openrouter" ? "passthrough" : "";
|
|
470
|
+
if (caps.includes("adaptive_thinking")) return "adaptive";
|
|
471
|
+
if (caps.includes("thinking") && caps.includes("effort")) return "effort";
|
|
472
|
+
if (caps.includes("thinking")) return "on/off";
|
|
473
|
+
return "";
|
|
474
|
+
}
|
|
437
475
|
function registerListCommand(program2) {
|
|
438
476
|
program2.command("list").description("List all available providers").action(() => {
|
|
439
477
|
const registry = loadRegistry();
|
|
@@ -441,15 +479,16 @@ function registerListCommand(program2) {
|
|
|
441
479
|
console.log(chalk2.bold("\nAvailable providers:\n"));
|
|
442
480
|
console.log(
|
|
443
481
|
chalk2.dim(
|
|
444
|
-
"Name".padEnd(14) + "Aliases".padEnd(18) + "Default Model".padEnd(32) + "Regions"
|
|
482
|
+
"Name".padEnd(14) + "Aliases".padEnd(18) + "Default Model".padEnd(32) + "Thinking".padEnd(12) + "Regions"
|
|
445
483
|
)
|
|
446
484
|
);
|
|
447
|
-
console.log(chalk2.dim("\u2500".repeat(
|
|
485
|
+
console.log(chalk2.dim("\u2500".repeat(90)));
|
|
448
486
|
for (const [key, provider] of providers) {
|
|
449
487
|
const aliases = [key, ...provider.aliases].join(", ");
|
|
450
488
|
const regions = provider.regions ? Object.keys(provider.regions).join(", ") : "global";
|
|
489
|
+
const thinking = thinkingIndicator(key, provider.supportedCapabilities);
|
|
451
490
|
console.log(
|
|
452
|
-
chalk2.green(provider.name.padEnd(14)) + aliases.padEnd(18) + provider.defaultModel.padEnd(32) + chalk2.dim(regions)
|
|
491
|
+
chalk2.green(provider.name.padEnd(14)) + aliases.padEnd(18) + provider.defaultModel.padEnd(32) + chalk2.cyan(thinking.padEnd(12)) + chalk2.dim(regions)
|
|
453
492
|
);
|
|
454
493
|
}
|
|
455
494
|
console.log();
|
|
@@ -658,7 +697,9 @@ function confirm2(prompt) {
|
|
|
658
697
|
}
|
|
659
698
|
|
|
660
699
|
// src/cli.ts
|
|
661
|
-
|
|
700
|
+
var require2 = createRequire(import.meta.url);
|
|
701
|
+
var { version } = require2("../package.json");
|
|
702
|
+
program.name("ccs").description("Switch Claude Code between AI providers").version(version);
|
|
662
703
|
registerListCommand(program);
|
|
663
704
|
registerStatusCommand(program);
|
|
664
705
|
registerConfigCommand(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-provider-switcher",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Switch Claude Code between AI providers with one command",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"switcher",
|
|
34
34
|
"cli"
|
|
35
35
|
],
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/yagizdo/cc-provider-switcher.git"
|
|
39
|
+
},
|
|
36
40
|
"license": "MIT",
|
|
37
41
|
"dependencies": {
|
|
38
42
|
"chalk": "^5.6.2",
|