ltcraft-ai-auto 1.8.0 → 1.9.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/README.md CHANGED
@@ -36,4 +36,4 @@ ltcraft-ai-auto
36
36
 
37
37
  ## API 地址
38
38
 
39
- 所有工具统一使用: `https://ai.ltcraft.cn`
39
+ 所有工具统一使用: `https://ai.lt4net.org`
package/bin/index.js CHANGED
@@ -5,7 +5,7 @@ import fs from 'fs';
5
5
  import path from 'path';
6
6
  import os from 'os';
7
7
 
8
- const API_BASE_URL = 'https://ai.ltcraft.cn';
8
+ const API_BASE_URL = 'https://ai.lt4net.org';
9
9
 
10
10
  const colors = {
11
11
  reset: '\x1b[0m',
@@ -104,9 +104,9 @@ function readTomlValue(content, key) {
104
104
  return match ? match[1] : null;
105
105
  }
106
106
 
107
- function mergeTomlConfig(existing, name, baseUrl, apiKey) {
107
+ function mergeTomlConfig(existing, name, baseUrl) {
108
108
  let content = existing || '';
109
- const newSection = `[model_providers.ltcraftai]\nname = "${name}"\nbase_url = "${baseUrl}"\napi_key = "${apiKey}"`;
109
+ const newSection = `[model_providers.ltcraftai]\nname = "${name}"\nbase_url = "${baseUrl}"`;
110
110
 
111
111
  // 更新或插入顶层 model_provider
112
112
  if (/^model_provider\s*=/m.test(content)) {
@@ -141,7 +141,7 @@ function configureCodex(apiKey) {
141
141
  ensureDir(codexDir);
142
142
 
143
143
  const existingToml = fs.existsSync(configPath) ? fs.readFileSync(configPath, 'utf-8') : '';
144
- const merged = mergeTomlConfig(existingToml, 'LTCraftAI', `${API_BASE_URL}/v1`, apiKey);
144
+ const merged = mergeTomlConfig(existingToml, 'LTCraftAI', `${API_BASE_URL}/v1`);
145
145
  fs.writeFileSync(configPath, merged, 'utf-8');
146
146
  console.log(`✓ 已配置: ${configPath}`);
147
147
 
@@ -558,15 +558,13 @@ function checkCodex() {
558
558
  // 从 TOML 中提取值
559
559
  const globalProvider = readTomlValue(globalToml, 'model_provider');
560
560
  const globalBaseUrl = readTomlValue(globalToml, 'base_url');
561
- const globalApiKeyToml = readTomlValue(globalToml, 'api_key');
562
561
  const projectProvider = readTomlValue(projectToml, 'model_provider');
563
562
  const projectBaseUrl = readTomlValue(projectToml, 'base_url');
564
- const projectApiKeyToml = readTomlValue(projectToml, 'api_key');
565
563
 
566
564
  const effectiveBaseUrl = envBaseUrl || projectBaseUrl || globalBaseUrl;
567
- const effectiveApiKey = envApiKey || projectAuth.OPENAI_API_KEY || globalAuth.OPENAI_API_KEY || projectApiKeyToml || globalApiKeyToml;
565
+ const effectiveApiKey = envApiKey || projectAuth.OPENAI_API_KEY || globalAuth.OPENAI_API_KEY;
568
566
  const baseUrlSource = envBaseUrl ? '环境变量' : (projectBaseUrl ? '项目配置' : (globalBaseUrl ? '全局配置' : null));
569
- const apiKeySource = envApiKey ? '环境变量' : (projectAuth.OPENAI_API_KEY ? '项目auth.json' : (globalAuth.OPENAI_API_KEY ? '全局auth.json' : (projectApiKeyToml ? '项目config.toml' : (globalApiKeyToml ? '全局config.toml' : null))));
567
+ const apiKeySource = envApiKey ? '环境变量' : (projectAuth.OPENAI_API_KEY ? '项目auth.json' : (globalAuth.OPENAI_API_KEY ? '全局auth.json' : null));
570
568
 
571
569
  console.log(colorize('\n🔧 关键配置项 (按优先级合并后):', 'blue'));
572
570
  printConfigItem('model_provider', effectiveBaseUrl ? (projectProvider || globalProvider) : null, baseUrlSource ? '配置文件' : null);
@@ -584,7 +582,6 @@ function checkCodex() {
584
582
  if (fileExists(projectConfigPath)) {
585
583
  console.log(` model_provider: ${projectProvider ? colorize(projectProvider, 'green') : colorize('未设置', 'gray')}`);
586
584
  console.log(` base_url: ${projectBaseUrl ? colorize(projectBaseUrl, 'green') : colorize('未设置', 'gray')}`);
587
- console.log(` api_key: ${projectApiKeyToml ? colorize(maskSecret(projectApiKeyToml), 'green') : colorize('未设置', 'gray')}`);
588
585
  } else {
589
586
  console.log(colorize(' (文件不存在)', 'gray'));
590
587
  }
@@ -602,7 +599,6 @@ function checkCodex() {
602
599
  if (fileExists(globalConfigPath)) {
603
600
  console.log(` model_provider: ${globalProvider ? colorize(globalProvider, 'green') : colorize('未设置', 'gray')}`);
604
601
  console.log(` base_url: ${globalBaseUrl ? colorize(globalBaseUrl, 'green') : colorize('未设置', 'gray')}`);
605
- console.log(` api_key: ${globalApiKeyToml ? colorize(maskSecret(globalApiKeyToml), 'green') : colorize('未设置', 'gray')}`);
606
602
  } else {
607
603
  console.log(colorize(' (文件不存在)', 'gray'));
608
604
  }
@@ -680,7 +676,7 @@ async function runCheck() {
680
676
  async function main() {
681
677
  console.log('╔════════════════════════════════════════╗');
682
678
  console.log('║ LTCraft AI 配置工具 ║');
683
- console.log('║ API: https://ai.ltcraft.cn ║');
679
+ console.log('║ API: https://ai.lt4net.org ║');
684
680
  console.log('╚════════════════════════════════════════╝\n');
685
681
 
686
682
  const tool = await select({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ltcraft-ai-auto",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "一键配置 Claude Code / OpenCode / OpenClaw 的 API 密钥工具",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -21,7 +21,7 @@ Claude Code 会按以下优先级读取配置(文件名通常为 settings.json
21
21
  JSON
22
22
  {
23
23
  "env": {
24
- "ANTHROPIC_BASE_URL": "https://ai.ltcraft.cn",
24
+ "ANTHROPIC_BASE_URL": "https://ai.lt4net.org",
25
25
  "API_TIMEOUT_MS": 3000000,
26
26
  "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxxxxxxxxxx"
27
27
  }
@@ -49,7 +49,7 @@ C:\Users<用户名>.config\opencode\opencode.json
49
49
  "provider": {
50
50
  "anthropic": {
51
51
  "options": {
52
- "baseURL": "https://ai.ltcraft.cn/v1"
52
+ "baseURL": "https://ai.lt4net.org/v1"
53
53
  }
54
54
  }
55
55
  }
@@ -77,7 +77,7 @@ OpenClaw 配置文件教程(仅配置文件)
77
77
  "models": {
78
78
  "providers": {
79
79
  "LTCraft-Anthropic": {
80
- "baseUrl": "https://ai.ltcraft.cn",
80
+ "baseUrl": "https://ai.lt4net.org",
81
81
  "apiKey": "${你的apikey}",
82
82
  "api": "anthropic-messages",
83
83
  "models": [
@@ -86,7 +86,7 @@ OpenClaw 配置文件教程(仅配置文件)
86
86
  ]
87
87
  },
88
88
  "LTCraft-Openai": {
89
- "baseUrl": "https://ai.ltcraft.cn/v1",
89
+ "baseUrl": "https://ai.lt4net.org/v1",
90
90
  "apiKey": "${你的apikey}",
91
91
  "api": "openai-completions",
92
92
  "models": [