yymaxapi 1.0.65 → 1.0.66

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 +14 -21
  2. package/package.json +1 -1
package/bin/yymaxapi.js CHANGED
@@ -634,8 +634,9 @@ function writeClaudeCodeSettings(baseUrl, apiKey) {
634
634
  // 写入 shell 环境变量
635
635
  if (process.platform === 'win32') {
636
636
  try {
637
+ const cleanUrl = baseUrl.replace(/\/+$/, '');
637
638
  execSync(
638
- `powershell -NoProfile -Command "[Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL','${baseUrl.replace(/\/+$/, '')}','User'); [Environment]::SetEnvironmentVariable('ANTHROPIC_AUTH_TOKEN','${apiKey}','User')"`,
639
+ `powershell -NoProfile -Command "[Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL','${cleanUrl}','User'); [Environment]::SetEnvironmentVariable('ANTHROPIC_AUTH_TOKEN','${apiKey}','User'); [Environment]::SetEnvironmentVariable('NODE_TLS_REJECT_UNAUTHORIZED','0','User')"`,
639
640
  { stdio: 'pipe' }
640
641
  );
641
642
  } catch { /* best-effort */ }
@@ -643,7 +644,14 @@ function writeClaudeCodeSettings(baseUrl, apiKey) {
643
644
  const marker = '# >>> yymaxapi claude >>>';
644
645
  const markerEnd = '# <<< yymaxapi claude <<<';
645
646
  const cleanUrl = baseUrl.replace(/\/+$/, '');
646
- const block = [marker, `export ANTHROPIC_BASE_URL="${cleanUrl}"`, `export ANTHROPIC_AUTH_TOKEN="${apiKey}"`, markerEnd].join('\n');
647
+ const block = [
648
+ marker,
649
+ `export ANTHROPIC_BASE_URL="${cleanUrl}"`,
650
+ `export ANTHROPIC_AUTH_TOKEN="${apiKey}"`,
651
+ '# 中转站证书校验放宽,避免 unknown certificate verification error',
652
+ 'export NODE_TLS_REJECT_UNAUTHORIZED=0',
653
+ markerEnd
654
+ ].join('\n');
647
655
 
648
656
  const shellEnv = process.env.SHELL || '';
649
657
  const rcFiles = [];
@@ -730,7 +738,6 @@ function writeOpencodeConfig(claudeBaseUrl, codexBaseUrl, apiKey, modelId) {
730
738
  }
731
739
  const cleanClaudeUrl = claudeBaseUrl.replace(/\/+$/, '');
732
740
  let cleanCodexUrl = (codexBaseUrl || '').replace(/\/+$/, '');
733
- if (cleanCodexUrl && !cleanCodexUrl.endsWith('/v1')) cleanCodexUrl += '/v1';
734
741
  if (!existing.provider) existing.provider = {};
735
742
  existing.provider.anthropic = {
736
743
  options: {
@@ -2778,6 +2785,8 @@ async function autoActivate(paths, args = {}) {
2778
2785
  console.log(chalk.gray(` 节点: ${selectedEndpoint.url} (${selectedEndpoint.name})`));
2779
2786
  console.log(chalk.gray(' API Key: 已设置'));
2780
2787
  if (extSynced.length > 0) console.log(chalk.gray(` 同步: ${extSynced.join(', ')}`));
2788
+ console.log(chalk.gray(' 若遇 certificate 报错,请新开终端或执行 source ~/.zshrc 后重试(已放宽 TLS 校验)'));
2789
+ console.log(chalk.gray(' 使用 OpenCode 时可在界面中切换 Claude Sonnet 4.6 / GPT 5.4;Codex 仅支持 GPT'));
2781
2790
 
2782
2791
  const gwPort = config.gateway?.port || 18789;
2783
2792
  const gwToken = config.gateway?.auth?.token;
@@ -3702,24 +3711,8 @@ async function testConnection(paths, args = {}) {
3702
3711
  // 检查当前激活的是哪个
3703
3712
  let primary = config.agents?.defaults?.model?.primary || '';
3704
3713
  if (!primary.includes('/')) {
3705
- // primary 未设置,尝试从已有 provider 自动选择
3706
- const providers = config.models?.providers || {};
3707
- const providerNames = Object.keys(providers);
3708
- if (providerNames.length === 0) {
3709
- console.log(chalk.yellow('⚠️ 请先设置主模型'));
3710
- return;
3711
- }
3712
- const preferOrder = ['maxapi', 'heibai', 'claude-yunyi', 'yunyi', 'maxapi-codex'];
3713
- const preferred = preferOrder.find(n => providerNames.includes(n));
3714
- const firstP = preferred || providerNames.find(n => n.includes('claude')) || providerNames[0];
3715
- const firstModels = providers[firstP]?.models || [];
3716
- if (firstModels.length > 0) {
3717
- primary = `${firstP}/${firstModels[0].id}`;
3718
- console.log(chalk.yellow(`⚠️ 主模型未设置,自动使用: ${primary}`));
3719
- } else {
3720
- console.log(chalk.yellow('⚠️ 请先设置主模型'));
3721
- return;
3722
- }
3714
+ console.log(chalk.yellow('⚠️ 主模型未设置,请先通过「切换模型」或「一键配置」设置主模型'));
3715
+ return;
3723
3716
  }
3724
3717
 
3725
3718
  const providerName = primary.split('/')[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yymaxapi",
3
- "version": "1.0.65",
3
+ "version": "1.0.66",
4
4
  "description": "跨平台 OpenClaw/Clawdbot 配置管理工具 - 管理中转地址、模型切换、API Keys、测速优化",
5
5
  "main": "bin/yymaxapi.js",
6
6
  "bin": {