ltcraft-ai-auto 1.6.1 → 1.7.0
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/bin/index.js +57 -21
- package/package.json +6 -1
- package//346/225/231/347/250/213.txt +22 -14
- package/.claude/settings.local.json +0 -6
- package/.mcp.json +0 -8
- package/tmp_test.txt +0 -10
package/bin/index.js
CHANGED
|
@@ -188,26 +188,35 @@ function configureOpenClaw(apiKey) {
|
|
|
188
188
|
const configPath = path.join(homeDir, '.openclaw', 'openclaw.json');
|
|
189
189
|
backupFile(configPath);
|
|
190
190
|
const existing = readJsonFile(configPath);
|
|
191
|
+
const modelClaude = [
|
|
192
|
+
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6", "reasoning": false, "input": ["text", "image"], "cost": { "input": 3, "output": 15, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 },
|
|
193
|
+
{ "id": "claude-opus-4-6", "name": "Claude Opus 4.6", "reasoning": false, "input": ["text", "image"], "cost": { "input": 5, "output": 25, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 }
|
|
194
|
+
];
|
|
191
195
|
const apiConfig = {
|
|
192
196
|
"models": {
|
|
193
197
|
"providers": {
|
|
194
|
-
"
|
|
198
|
+
"LTCraft-Anthropic": {
|
|
199
|
+
"baseUrl": API_BASE_URL,
|
|
200
|
+
"apiKey": apiKey,
|
|
201
|
+
"api": "anthropic-messages",
|
|
202
|
+
"models": modelClaude
|
|
203
|
+
},
|
|
204
|
+
"LTCraft-Openai": {
|
|
195
205
|
"baseUrl": `${API_BASE_URL}/v1`,
|
|
196
206
|
"apiKey": apiKey,
|
|
197
207
|
"api": "openai-completions",
|
|
198
208
|
"models": [
|
|
199
|
-
|
|
200
|
-
{ "id": "claude-opus-4-6", "name": "Claude Opus 4.6", "reasoning": false, "input": ["text", "image"], "cost": { "input": 5.0, "output": 25.0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 },
|
|
209
|
+
...modelClaude,
|
|
201
210
|
{ "id": "gpt-5.2", "name": "GPT-5.2", "reasoning": false, "input": ["text", "image"], "cost": { "input": 1.7, "output": 14, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 },
|
|
202
|
-
{ "id": "
|
|
203
|
-
{ "id": "
|
|
211
|
+
{ "id": "gpt-5.3-codex", "name": "GPT-5.3-codex", "reasoning": false, "input": ["text", "image"], "cost": { "input": 1.7, "output": 14, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 },
|
|
212
|
+
{ "id": "gpt-5.4", "name": "GPT-5.4", "reasoning": false, "input": ["text", "image"], "cost": { "input": 2.5, "output": 20, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 }
|
|
204
213
|
]
|
|
205
214
|
}
|
|
206
215
|
}
|
|
207
216
|
},
|
|
208
217
|
"agents": {
|
|
209
218
|
"defaults": {
|
|
210
|
-
"model": { "primary": "
|
|
219
|
+
"model": { "primary": "LTCraft-Anthropic/claude-sonnet-4-6" }
|
|
211
220
|
}
|
|
212
221
|
}
|
|
213
222
|
};
|
|
@@ -216,8 +225,9 @@ function configureOpenClaw(apiKey) {
|
|
|
216
225
|
console.log(`✓ 已配置: ${configPath}`);
|
|
217
226
|
console.log('\n🎉 OpenClaw 配置完成!');
|
|
218
227
|
console.log('\n📖 使用提示:');
|
|
219
|
-
console.log(' /models
|
|
220
|
-
console.log(' /
|
|
228
|
+
console.log(' /models LTCraft-Openai 查看 OpenAI 兼容模型');
|
|
229
|
+
console.log(' /models LTCraft-Anthropic 查看 Anthropic 模型');
|
|
230
|
+
console.log(' /model LTCraft-Anthropic/xxx 切换模型 (如 /model LTCraft-Anthropic/claude-opus-4-6)');
|
|
221
231
|
console.log('\n⚠️ 配置后需要重启 gateway 才能生效: openclaw gateway restart');
|
|
222
232
|
}
|
|
223
233
|
|
|
@@ -461,27 +471,53 @@ function checkOpenClaw() {
|
|
|
461
471
|
printFileStatus('全局配置', configPath, fileExists(configPath));
|
|
462
472
|
|
|
463
473
|
const config = readJsonFile(configPath);
|
|
464
|
-
const
|
|
474
|
+
const anthropicProvider = config?.models?.providers?.['LTCraft-Anthropic'];
|
|
475
|
+
const openaiProvider = config?.models?.providers?.['LTCraft-Openai'];
|
|
465
476
|
|
|
466
|
-
console.log(colorize('\n🔧 LTCraft Provider 配置:', 'blue'));
|
|
477
|
+
console.log(colorize('\n🔧 LTCraft-Anthropic Provider 配置:', 'blue'));
|
|
478
|
+
if (anthropicProvider) {
|
|
479
|
+
printConfigItem('baseUrl', anthropicProvider.baseUrl, '全局配置');
|
|
480
|
+
printConfigItem('apiKey', anthropicProvider.apiKey, '全局配置');
|
|
481
|
+
} else {
|
|
482
|
+
console.log(colorize(' ✗ LTCraft-Anthropic provider 未配置', 'red'));
|
|
483
|
+
}
|
|
467
484
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
printConfigItem('
|
|
485
|
+
console.log(colorize('\n🔧 LTCraft-Openai Provider 配置:', 'blue'));
|
|
486
|
+
if (openaiProvider) {
|
|
487
|
+
printConfigItem('baseUrl', openaiProvider.baseUrl, '全局配置');
|
|
488
|
+
printConfigItem('apiKey', openaiProvider.apiKey, '全局配置');
|
|
489
|
+
} else {
|
|
490
|
+
console.log(colorize(' ✗ LTCraft-Openai provider 未配置', 'red'));
|
|
491
|
+
}
|
|
471
492
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
493
|
+
console.log(colorize('\n🎯 LTCraft API 配置状态:', 'blue'));
|
|
494
|
+
if (anthropicProvider?.baseUrl === API_BASE_URL && anthropicProvider?.apiKey) {
|
|
495
|
+
console.log(colorize(' ✓ LTCraft-Anthropic 已正确配置', 'green'));
|
|
496
|
+
} else {
|
|
497
|
+
if (!anthropicProvider) {
|
|
498
|
+
console.log(colorize(' ✗ LTCraft-Anthropic provider 未配置', 'red'));
|
|
475
499
|
} else {
|
|
476
|
-
if (
|
|
477
|
-
console.log(colorize(` ✗ baseUrl
|
|
500
|
+
if (anthropicProvider.baseUrl !== API_BASE_URL) {
|
|
501
|
+
console.log(colorize(` ✗ LTCraft-Anthropic baseUrl 不正确 (当前: ${anthropicProvider.baseUrl || '未设置'})`, 'red'));
|
|
478
502
|
}
|
|
479
|
-
if (!
|
|
480
|
-
console.log(colorize(' ✗ apiKey 未设置', 'red'));
|
|
503
|
+
if (!anthropicProvider.apiKey) {
|
|
504
|
+
console.log(colorize(' ✗ LTCraft-Anthropic apiKey 未设置', 'red'));
|
|
481
505
|
}
|
|
482
506
|
}
|
|
507
|
+
}
|
|
508
|
+
if (openaiProvider?.baseUrl === `${API_BASE_URL}/v1` && openaiProvider?.apiKey) {
|
|
509
|
+
console.log(colorize(' ✓ LTCraft-Openai 已正确配置', 'green'));
|
|
483
510
|
} else {
|
|
484
|
-
|
|
511
|
+
if (!openaiProvider) {
|
|
512
|
+
console.log(colorize(' ✗ LTCraft-Openai provider 未配置', 'red'));
|
|
513
|
+
} else {
|
|
514
|
+
if (openaiProvider.baseUrl !== `${API_BASE_URL}/v1`) {
|
|
515
|
+
console.log(colorize(` ✗ LTCraft-Openai baseUrl 不正确 (当前: ${openaiProvider.baseUrl || '未设置'})`, 'red'));
|
|
516
|
+
}
|
|
517
|
+
if (!openaiProvider.apiKey) {
|
|
518
|
+
console.log(colorize(' ✗ LTCraft-Openai apiKey 未设置', 'red'));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
485
521
|
}
|
|
486
522
|
}
|
|
487
523
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ltcraft-ai-auto",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "一键配置 Claude Code / OpenCode / OpenClaw 的 API 密钥工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"ltcraft-ai-auto": "./bin/index.js"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/index.js",
|
|
12
|
+
"README.md",
|
|
13
|
+
"教程.txt"
|
|
14
|
+
],
|
|
10
15
|
"scripts": {
|
|
11
16
|
"start": "node bin/index.js"
|
|
12
17
|
},
|
|
@@ -71,24 +71,30 @@ OpenClaw 配置文件教程(仅配置文件)
|
|
|
71
71
|
说明:OpenClaw 配置文件为 JSON(支持注释、尾逗号)。
|
|
72
72
|
|
|
73
73
|
2) 配置文件示例(自定义 Provider + 设置默认模型)
|
|
74
|
-
创建或编辑 openclaw.json,填入以下内容(将
|
|
74
|
+
创建或编辑 openclaw.json,填入以下内容(将 apiKey 替换为你的密钥):
|
|
75
75
|
{
|
|
76
76
|
//...
|
|
77
77
|
"models": {
|
|
78
78
|
"providers": {
|
|
79
|
-
"
|
|
79
|
+
"LTCraft-Anthropic": {
|
|
80
80
|
"baseUrl": "https://ai.ltcraft.cn:12000",
|
|
81
81
|
"apiKey": "${你的apikey}",
|
|
82
82
|
"api": "anthropic-messages",
|
|
83
83
|
"models": [
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192 },
|
|
85
|
+
{ "id": "claude-opus-4-6", "name": "Claude Opus 4.6", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192 }
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"LTCraft-Openai": {
|
|
89
|
+
"baseUrl": "https://ai.ltcraft.cn:12000/v1",
|
|
90
|
+
"apiKey": "${你的apikey}",
|
|
91
|
+
"api": "openai-completions",
|
|
92
|
+
"models": [
|
|
93
|
+
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192 },
|
|
94
|
+
{ "id": "claude-opus-4-6", "name": "Claude Opus 4.6", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192 },
|
|
95
|
+
{ "id": "gpt-5.2", "name": "GPT-5.2", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192 },
|
|
96
|
+
{ "id": "gpt-5.3-codex", "name": "GPT-5.3-codex", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192 },
|
|
97
|
+
{ "id": "gpt-5.4", "name": "GPT-5.4", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192 }
|
|
92
98
|
]
|
|
93
99
|
}
|
|
94
100
|
}
|
|
@@ -96,14 +102,16 @@ OpenClaw 配置文件教程(仅配置文件)
|
|
|
96
102
|
"agents": {
|
|
97
103
|
"defaults": {
|
|
98
104
|
"model": {
|
|
99
|
-
"primary": "
|
|
100
|
-
},
|
|
101
|
-
"models": {
|
|
102
|
-
"ltcraft/claude-sonnet-4-5-20250929": {}
|
|
105
|
+
"primary": "LTCraft-Anthropic/claude-sonnet-4-6"
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
//...
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
使用提示:
|
|
113
|
+
/models LTCraft-Openai 查看 OpenAI 兼容模型
|
|
114
|
+
/models LTCraft-Anthropic 查看 Anthropic 模型
|
|
115
|
+
/model LTCraft-Anthropic/xxx 切换模型
|
|
116
|
+
|
|
109
117
|
|
package/.mcp.json
DELETED