yymaxapi 1.0.110 → 1.0.111

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.
Files changed (2) hide show
  1. package/bin/yymaxapi.js +10 -1
  2. package/package.json +1 -1
package/bin/yymaxapi.js CHANGED
@@ -1039,10 +1039,18 @@ function writeClaudeCodeSettings(baseUrl, apiKey, modelId = getDefaultClaudeMode
1039
1039
  try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch { settings = {}; }
1040
1040
  }
1041
1041
  const normalizedBaseUrl = baseUrl.replace(/\/+$/, '');
1042
+ const normalizedModelId = String(modelId || getDefaultClaudeModel().id).trim() || getDefaultClaudeModel().id;
1043
+ const pinnedOpusModel = (CLAUDE_MODELS.find(model => /opus/i.test(model.id)) || {}).id || 'claude-opus-4-7';
1044
+ const pinnedSonnetModel = (CLAUDE_MODELS.find(model => /sonnet/i.test(model.id)) || {}).id || 'claude-sonnet-4-6';
1045
+ const pinnedHaikuModel = (CLAUDE_MODELS.find(model => /haiku/i.test(model.id)) || {}).id || 'claude-haiku-4-5';
1042
1046
  settings.apiBaseUrl = normalizedBaseUrl;
1047
+ settings.model = normalizedModelId;
1043
1048
  if (!settings.env) settings.env = {};
1044
1049
  settings.env.ANTHROPIC_API_KEY = apiKey;
1045
1050
  settings.env.ANTHROPIC_BASE_URL = normalizedBaseUrl;
1051
+ settings.env.ANTHROPIC_DEFAULT_OPUS_MODEL = pinnedOpusModel;
1052
+ settings.env.ANTHROPIC_DEFAULT_SONNET_MODEL = pinnedSonnetModel;
1053
+ settings.env.ANTHROPIC_DEFAULT_HAIKU_MODEL = pinnedHaikuModel;
1046
1054
  delete settings.env.ANTHROPIC_AUTH_TOKEN;
1047
1055
  delete settings.availableModels;
1048
1056
  delete settings.env.ANTHROPIC_MODEL;
@@ -5435,7 +5443,8 @@ async function activateClaudeCode(paths, args = {}) {
5435
5443
  console.log(chalk.gray(' API Key: 已设置'));
5436
5444
  console.log(chalk.gray('\n 已写入:'));
5437
5445
  console.log(chalk.gray(' • ~/.claude/settings.json'));
5438
- console.log(chalk.gray(' • 最小字段: apiBaseUrl + env.ANTHROPIC_API_KEY + env.ANTHROPIC_BASE_URL'));
5446
+ console.log(chalk.gray(' • 关键字段: apiBaseUrl + model + env.ANTHROPIC_API_KEY + env.ANTHROPIC_BASE_URL'));
5447
+ console.log(chalk.gray(' • 已钉住 Claude alias 默认版本,避免第三方中转回落到官方旧别名'));
5439
5448
  console.log(chalk.yellow('\n 提示: 如果 Claude Code 已在运行,重新打开一个会话即可读取新配置'));
5440
5449
 
5441
5450
  if (await confirmImmediateTest(args, '是否立即测试 Claude Code CLI 连接?')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yymaxapi",
3
- "version": "1.0.110",
3
+ "version": "1.0.111",
4
4
  "description": "跨平台 OpenClaw/Clawdbot 配置管理工具 - 管理中转地址、模型切换、API Keys、测速优化",
5
5
  "main": "bin/yymaxapi.js",
6
6
  "bin": {