ltcraft-ai-auto 1.6.2 → 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 +56 -22
- package/package.json +1 -1
- package//346/225/231/347/250/213.txt +22 -14
package/bin/index.js
CHANGED
|
@@ -188,28 +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
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 },
|
|
203
|
-
{ "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
|
-
{ "id": "gemini-3-flash", "name": "Gemini 3 Flash", "reasoning": false, "input": ["text", "image"], "cost": { "input": 0.5, "output": 3, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "maxTokens": 8192 },
|
|
205
|
-
{ "id": "gemini-3-pro", "name": "Gemini 3 Pro", "reasoning": false, "input": ["text", "image"], "cost": { "input": 2, "output": 12, "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 }
|
|
206
213
|
]
|
|
207
214
|
}
|
|
208
215
|
}
|
|
209
216
|
},
|
|
210
217
|
"agents": {
|
|
211
218
|
"defaults": {
|
|
212
|
-
"model": { "primary": "
|
|
219
|
+
"model": { "primary": "LTCraft-Anthropic/claude-sonnet-4-6" }
|
|
213
220
|
}
|
|
214
221
|
}
|
|
215
222
|
};
|
|
@@ -218,8 +225,9 @@ function configureOpenClaw(apiKey) {
|
|
|
218
225
|
console.log(`✓ 已配置: ${configPath}`);
|
|
219
226
|
console.log('\n🎉 OpenClaw 配置完成!');
|
|
220
227
|
console.log('\n📖 使用提示:');
|
|
221
|
-
console.log(' /models
|
|
222
|
-
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)');
|
|
223
231
|
console.log('\n⚠️ 配置后需要重启 gateway 才能生效: openclaw gateway restart');
|
|
224
232
|
}
|
|
225
233
|
|
|
@@ -463,27 +471,53 @@ function checkOpenClaw() {
|
|
|
463
471
|
printFileStatus('全局配置', configPath, fileExists(configPath));
|
|
464
472
|
|
|
465
473
|
const config = readJsonFile(configPath);
|
|
466
|
-
const
|
|
474
|
+
const anthropicProvider = config?.models?.providers?.['LTCraft-Anthropic'];
|
|
475
|
+
const openaiProvider = config?.models?.providers?.['LTCraft-Openai'];
|
|
467
476
|
|
|
468
|
-
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
|
+
}
|
|
469
484
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
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
|
+
}
|
|
473
492
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
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'));
|
|
477
499
|
} else {
|
|
478
|
-
if (
|
|
479
|
-
console.log(colorize(` ✗ baseUrl
|
|
500
|
+
if (anthropicProvider.baseUrl !== API_BASE_URL) {
|
|
501
|
+
console.log(colorize(` ✗ LTCraft-Anthropic baseUrl 不正确 (当前: ${anthropicProvider.baseUrl || '未设置'})`, 'red'));
|
|
480
502
|
}
|
|
481
|
-
if (!
|
|
482
|
-
console.log(colorize(' ✗ apiKey 未设置', 'red'));
|
|
503
|
+
if (!anthropicProvider.apiKey) {
|
|
504
|
+
console.log(colorize(' ✗ LTCraft-Anthropic apiKey 未设置', 'red'));
|
|
483
505
|
}
|
|
484
506
|
}
|
|
507
|
+
}
|
|
508
|
+
if (openaiProvider?.baseUrl === `${API_BASE_URL}/v1` && openaiProvider?.apiKey) {
|
|
509
|
+
console.log(colorize(' ✓ LTCraft-Openai 已正确配置', 'green'));
|
|
485
510
|
} else {
|
|
486
|
-
|
|
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
|
+
}
|
|
487
521
|
}
|
|
488
522
|
}
|
|
489
523
|
|
package/package.json
CHANGED
|
@@ -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
|
|