Skip to content

Commit d9c68f8

Browse files
committed
docs: update desc
1 parent 0d52227 commit d9c68f8

File tree

8 files changed

+29
-22
lines changed

8 files changed

+29
-22
lines changed

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ ccapi -v
4444
# windows 默认settings.json路径在 C:\Users\Administrator\.claude\settings.json
4545
# mac 默认settings.json路径在 ~/.claude/settings.json
4646

47-
# 示例: mac同时设置两个路径
47+
# 1. 示例: mac同时设置两个路径
4848
ccapi set --settings ~/.claude/settings.json --api /Users/4xian/Desktop/api.json5
4949

50-
# 分别设置
50+
# 2. 分别设置
5151
ccapi set --settings ~/.claude/settings.json
5252
ccapi set --api /Users/4xian/Desktop/api.json5
5353

54-
# 直接在配置文件中修改路径
54+
# 3. 直接在配置文件中修改路径
5555
~/.ccapi-config.json 文件中(与.claude同级),有存储路径的变量,直接修改即可
5656
{
5757
"settingsPath": "~/.claude/settings.json",
@@ -302,24 +302,27 @@ ccapi test -c openrouter
302302

303303
**测试方式说明:**
304304

305-
- **默认方式**:使用接口模拟方式,直接模拟Claude CLI请求,速度快,准确性较高(部分厂商只允许在cli中调用,这种时候你可忽略结果,默认为成功)
305+
- **默认方式**:使用接口模拟方式,直接模拟Claude CLI请求,速度快,准确性较高(部分厂商只允许在cli中调用,会出现不允许调用的情况,这种时候你可忽略结果,默认为成功)
306306
- **CLI方式**(`-c` 选项):使用真实的Claude Code CLI环境,准确度最高,可能会出现调用各种mcp服务情况,速度较慢(1分钟左右)
307307

308308
**配置说明:**
309309

310310
- **ping测试超时时间**:默认为5秒,可在 ~/.ccapi-config.json 文件中新增变量控制超时,如:pingTimeout: 5000
311-
- **test测试超时时间**:默认为30秒(接口模拟方式)或60秒(CLI方式),可在 ~/.ccapi-config.json 文件中新增变量控制超时,如:testTimeout: 30000
312-
- **测试返回的结果**:默认不显示,由于厂商不同,返回结果仅供参考,可在 ~/.ccapi-config.json 文件中新增变量是否显示结果,如:testResponse: true
311+
- **test测试超时时间**:默认为30秒(接口模拟方式)或 100秒(CLI方式),可在 ~/.ccapi-config.json 文件中新增变量控制超时,如:testTimeout: 30000
312+
- **测试返回的结果**:默认显示,由于厂商不同,返回结果仅供参考,可在 ~/.ccapi-config.json 文件中新增变量是否显示结果,如:testResponse: true
313+
- **test cli模式测试并发**:默认为3,cli模式测试由于消耗性能较高,采用分批测试,若测试结果全部都超时,建议数值小点,超时时间拉长
313314

314315
```json5
315316
{
316317
"settingsPath": "~/.claude/settings.json",
317318
"apiConfigPath": "/Users/4xian/Desktop/api.json5",
318319
"pingTimeout": 5000,
319320
"testTimeout": 30000,
320-
"testResponse": false
321+
"testResponse": true,
322+
"testConcurrency": 3
321323
}
322324
```
325+
323326
- 对于数组格式的URL,会测试所有URL地址,数组配置的URL内部不会按延迟排序,保持原有的URL顺序
324327
- 配置按最佳延迟排序,延迟最低的配置排在前面
325328
- 显示每个配置的最优路线(最快的URL地址)
@@ -451,11 +454,11 @@ ccapi lang en
451454
# api配置文件路径
452455
"apiConfigPath": "/Users/4xian/Desktop/api.json5",
453456
# ping命令超时时间
454-
"pingTimeout": 5000,
457+
"pingTimeout": 30000,
455458
# test命令超时时间
456-
"testTimeout": 60000,
459+
"testTimeout": 100000,
457460
# ping、test命令返回结果显示
458-
"testResponse": false,
461+
"testResponse": true,
459462
# 是否需要更新提示
460463
"update": true,
461464
# 使用use命令时是否同步修改系统环境变量

README_EN.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,17 @@ ccapi test openrouter -t 2 # Use 2nd Token
314314

315315
- **ping test timeout**: Defaults to 5 seconds, can be controlled by adding timeout variable in ~/.ccapi-config.json file, e.g.: pingTimeout: 5000
316316
- **test timeout**: Defaults to 30 seconds (API mock method) or 60 seconds (CLI method), can be controlled by adding timeout variable in ~/.ccapi-config.json file, e.g.: testTimeout: 30000
317-
- **Test result response**: Not displayed by default. Since different providers return different results, response results are for reference only. Can enable result display by adding variable in ~/.ccapi-config.json file, e.g.: testResponse: true
317+
- **Test result response**: Displayed by default. Since different providers return different results, response results are for reference only. Can enable result display by adding variable in ~/.ccapi-config.json file, e.g.: testResponse: true
318+
- **Test concurrency in cli mode**: The default value is 3. Due to the high performance consumption of cli mode testing, batch testing is adopted. If all test results are timed out, it is recommended to set a smaller value and extend the timeout period.
318319

319320
```json5
320321
{
321322
"settingsPath": "~/.claude/settings.json",
322323
"apiConfigPath": "/Users/4xian/Desktop/api.json5",
323324
"pingTimeout": 5000,
324325
"testTimeout": 30000,
325-
"testResponse": false
326+
"testResponse": true,
327+
"testConcurrency": 3
326328
}
327329
```
328330
- For array format URLs, all URL addresses will be tested, array configuration URLs will not be sorted by latency internally, maintaining original URL order
@@ -460,7 +462,7 @@ This file is the configuration file used by ccapi, where you can configure optio
460462
# test command timeout (default 30s for API mock method, 60s for CLI method)
461463
"testTimeout": 30000,
462464
# ping, test command result display
463-
"testResponse": false,
465+
"testResponse": true,
464466
# whether update prompts are needed
465467
"update": true,
466468
# whether to synchronously modify system environment variables when using use command

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
},
5353
"updateLogs": [
5454
"1. Modify the test command to support both API mock and CLI. API testing is used by default.",
55-
"2. 调整ccapi test命令,支持API模拟和CLI两种测试方式,默认使用API测试(API测试快速,准确性较高[ccapi test];CLI测试准确较慢[ccapi test -c])"
55+
"2. 调整ccapi test有效性测试命令,支持API模拟和CLI两种测试方式,默认使用API测试(API测试快速,准确性较高[ccapi test];CLI测试准确较慢[ccapi test -c])"
5656
],
5757
"files": [
5858
"dist",

src/commands/ping.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ async function displayPingResults(sortedResults) {
193193

194194
// ping 命令的响应显示逻辑
195195
let responseDisplay = ''
196-
if (configData && configData.testResponse) {
196+
const show = configData.testResponse === void 0 ? true : !!configData.testResponse;
197+
if (show) {
197198
const responseText = result.error || 'Success'
198199
const finalResponse = responseText.length > maxText ? responseText.slice(0, maxText) + '...' : responseText
199200
responseDisplay = ` [Response: ${finalResponse}]`

src/commands/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ async function displaySimpleResults(sortedResults) {
754754
: result.response
755755
: result.error || 'Success'
756756

757-
const responseDisplay = configData.testResponse ? ` [Response: ${responseText}]` : ''
757+
const show = configData.testResponse === void 0 ? true : !!configData.testResponse;
758+
const responseDisplay = show ? ` [Response: ${responseText}]` : ''
758759

759760
console.log(` ${index + 1}.[${result.url}] ${status}(${color.bold(latencyText)})${responseDisplay}`)
760761
console.log()

src/i18n/en.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ module.exports = {
150150
CONFIG_FORMAT_ERROR: 'api configuration file format error',
151151
CONFIG_NOT_EXIST: 'Configuration "{0}" does not exist',
152152
TESTING_CONFIGS:
153-
'Testing {0} configurations URL for availability in Claude Code (may take a while, please be patient)...',
153+
'Testing URL for availability in Claude Code (may take a while, please be patient)...',
154154
TEST_COMPLETE: 'Validity test completed, this result shows whether it can be used in Claude Code!',
155155
TEST_FAILED: 'Validity test failed:',
156156
VALID: 'Valid',
@@ -206,7 +206,7 @@ module.exports = {
206206
BEST_ROUTE: 'Best route: {0}',
207207
CONFIG_NOT_EXIST: 'Configuration "{0}" does not exist',
208208
AVAILABLE_CONFIGS: 'Available configurations:',
209-
TESTING_CONFIGS: 'Testing URL latency for {0} configurations...',
209+
TESTING_CONFIGS: 'Testing URL latency...',
210210
LATENCY_TEST_COMPLETE: 'URL latency test complete! Success: {0}/{1}',
211211
LATENCY_TEST_FAILED: 'URL latency test failed:',
212212
CONFIG_FORMAT_ERROR: 'api configuration file format error'

src/i18n/zh.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module.exports = {
9292
success: {
9393
CONFIG_SAVED: '配置路径已保存',
9494
CONFIG_SWITCHED: '配置切换成功',
95-
RESTART_TERMINAL: '(提示: 重启Claude Code终端后配置生效!)',
95+
RESTART_TERMINAL: '(提示: [settings.json中环境变量 > 系统环境变量] & 重启Claude Code终端后配置生效!)',
9696
BACKUP_CREATED: 'settings文件已备份',
9797
ENV_SET_SUCCESS: '环境变量设置成功',
9898
ENV_CLEAR_SUCCESS: '环境变量清除成功',
@@ -145,7 +145,7 @@ module.exports = {
145145
BEST_ROUTE: '最优路线',
146146
CONFIG_FORMAT_ERROR: 'api配置文件格式不正确',
147147
CONFIG_NOT_EXIST: '配置 "{0}" 不存在',
148-
TESTING_CONFIGS: '正在测试{0}个配置URL在Claude Code中的有效性(时间可能稍长,请耐心等待)...',
148+
TESTING_CONFIGS: '正在测试配置URL在Claude Code中的有效性(时间可能稍长,请耐心等待)...',
149149
TEST_COMPLETE: '有效性测试完成, 此结果代表能否在Claude Code中使用!',
150150
TEST_FAILED: '有效性测试失败:',
151151
VALID: '有效',
@@ -201,7 +201,7 @@ module.exports = {
201201
BEST_ROUTE: '最优路线: {0}',
202202
CONFIG_NOT_EXIST: '配置 "{0}" 不存在',
203203
AVAILABLE_CONFIGS: '可用配置:',
204-
TESTING_CONFIGS: '正在测试{0}个配置的URL延迟...',
204+
TESTING_CONFIGS: '正在测试配置URL延迟...',
205205
LATENCY_TEST_COMPLETE: 'URL延迟测试完成! 成功: {0}/{1}',
206206
LATENCY_TEST_FAILED: 'URL延迟测试失败:',
207207
CONFIG_FORMAT_ERROR: 'api配置文件格式不正确'

0 commit comments

Comments
 (0)