22
33English | [ 中文] ( ./README.md )
44
5- Claude Code settings.json key auto-configuration tool for easy API_KEY and AUTH_TOKEN configuration switching
5+ Claude Code settings.json key auto-configuration tool for easy API_KEY and AUTH_TOKEN and multimodel configuration switching
66
77## Features
88
@@ -40,6 +40,9 @@ ccapi set --settings /Users/4xian/Desktop/settings.json --api /Users/4xian/Deskt
4040# Or set them separately
4141ccapi set --settings /Users/4xian/Desktop/settings.json
4242ccapi set --api /Users/4xian/Desktop/api.json
43+
44+ # Or get current path
45+ ccapi set
4346```
4447
4548### 3. Custom API Configuration File Format
@@ -56,10 +59,18 @@ Create an `api.json` file with the following format:
5659 "timeout" : 120000 ,
5760 "tokens" : 20000
5861 },
59- "anyrouter" : {
60- "url" : " xxx" ,
61- "key" : " you-api-key" ,
62- "model" : " claude-sonnet-4-20250514"
62+ "multimodel" : {
63+ "url" : " https://api.example.com" ,
64+ "key" : " your-api-key" ,
65+ "model" : [
66+ " claude-sonnet-4-20250514" ,
67+ " claude-3-5-haiku-20241022" ,
68+ " claude-3-opus-20240229"
69+ ],
70+ "fast" : [
71+ " claude-3-5-haiku-20241022" ,
72+ " claude-3-haiku-20240307"
73+ ]
6374 }
6475}
6576```
@@ -72,24 +83,83 @@ Create an `api.json` file with the following format:
7283- ` key ` : API_KEY (at least one of key or token is required)
7384- ` token ` : AUTH_TOKEN (at least one of key or token is required)
7485- ` model ` : Model name (optional, default: claude-sonnet-4-20250514)
86+ - ** String format** : Directly specify a single model
87+ - ** Array format** : Specify multiple models, supports switching via index
7588- ` fast ` : Fast model name (optional, default: claude-3-5-haiku-20241022)
89+ - ** String format** : Directly specify a single fast model
90+ - ** Array format** : Specify multiple fast models, supports switching via index
7691- ` timeout ` : Request timeout in milliseconds (optional, default: 600000ms)
7792- ` tokens ` : Maximum output tokens (optional, default: 25000)
93+ - ` http ` : Custom HTTP Proxy Settings (optional)
94+ - ` https ` : Custom HTTPS Proxy Settings (optional)
7895
7996### 4. List Available Configurations
8097
8198``` bash
8299ccapi ls or ccapi list
83100```
84101
85- > Configurations marked with ` * ` indicate currently active configuration
102+ Display example:
103+
104+ ``` text
105+ Available API Configurations:
106+
107+ 【openrouter】
108+ URL: https://api.openrouter.ai
109+ Model: claude-sonnet-4-20250514
110+ Fast: claude-3-5-haiku-20241022
111+ Key: sk-or123...
112+
113+ * 【multimodel】
114+ URL: https://api.example.com
115+ Model:
116+ * - 1: claude-sonnet-4-20250514
117+ - 2: claude-3-5-haiku-20241022
118+ - 3: claude-3-opus-20240229
119+ Fast:
120+ - 1: claude-3-5-haiku-20241022
121+ * - 2: claude-3-haiku-20240307
122+ Key: sk-abc123...
123+ ```
124+
125+ ** Display Description:**
126+
127+ - Configurations marked with ` * ` indicate currently active configuration
128+ - For array format model/fast, index numbers are displayed
129+ - Currently used model index is also marked with ` * `
86130
87131### 5. Switch Configuration (Remember to restart Claude terminal after successful switch!!!)
88132
133+ #### Basic Switching
134+
89135``` bash
136+ # Switch to specified configuration (using default model)
90137ccapi use openrouter
138+
139+ # For string format model/fast, direct switching
140+ ccapi use anyrouter
91141```
92142
143+ #### Advanced Switching (for Array Format)
144+
145+ ``` bash
146+ # Switch to multimodel config's 2nd model and 1st fast model
147+ ccapi use multimodel -m 2 -f 1
148+
149+ # Only specify standard model index, fast model uses default (1st)
150+ ccapi use multimodel -m 3
151+
152+ # Only specify fast model index, model uses default (1st)
153+ ccapi use multimodel -f 2
154+ ```
155+
156+ ** Parameter Description:**
157+
158+ - ` -m <index> ` : Specify model index to use (counting from 1)
159+ - ` -f <index> ` : Specify fast model index to use (counting from 1)
160+ - For string format configurations, index parameters are automatically ignored
161+ - When no index is specified, defaults to the first element of the array
162+
93163## System Requirements
94164
95165- Node.js >= 14.0.0
0 commit comments