yymaxapi 1.0.78 → 1.0.79

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 +9 -24
  2. package/package.json +1 -1
package/bin/yymaxapi.js CHANGED
@@ -688,7 +688,7 @@ function writeCodexConfig(baseUrl, apiKey, modelId = 'gpt-5.4') {
688
688
  const markerEnd = '# <<< maxapi codex <<<';
689
689
  const topMarker = '# >>> maxapi codex top >>>';
690
690
  const topMarkerEnd = '# <<< maxapi codex top <<<';
691
- const providerKey = 'openclaw-relay';
691
+ const providerKey = 'yunyi-codex';
692
692
  // 确保 base_url 以 /v1 结尾(Codex CLI 要求)
693
693
  let normalizedUrl = baseUrl.replace(/\/+$/, '');
694
694
  if (!normalizedUrl.endsWith('/v1')) normalizedUrl += '/v1';
@@ -702,9 +702,11 @@ function writeCodexConfig(baseUrl, apiKey, modelId = 'gpt-5.4') {
702
702
  // 移除旧的 maxapi top-level block
703
703
  const topRe = new RegExp(`${topMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?${topMarkerEnd.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\n?`, 'g');
704
704
  existing = existing.replace(topRe, '');
705
- // 兼容旧版:移除散落在 section 内的旧 model/model_provider(来自旧版 marker block 残留)
705
+ // 兼容旧版:移除散落的 model/model_provider、旧 openclaw-relay、旧 yunyi opencode 标记块
706
706
  existing = existing.replace(/^model\s*=\s*"[^"]*"\s*$/gm, '');
707
707
  existing = existing.replace(/^model_provider\s*=\s*"[^"]*"\s*$/gm, '');
708
+ existing = existing.replace(/\[model_providers\.openclaw-relay\]\n(?:(?!\[)[^\n]*\n?)*/g, '');
709
+ existing = existing.replace(/# >>> yunyi opencode >>>[\s\S]*?# <<< yunyi opencode <<<\n?/g, '');
708
710
  existing = existing.replace(/\n{3,}/g, '\n\n').trim();
709
711
  }
710
712
 
@@ -720,7 +722,7 @@ function writeCodexConfig(baseUrl, apiKey, modelId = 'gpt-5.4') {
720
722
  const providerBlock = [
721
723
  marker,
722
724
  `[model_providers.${providerKey}]`,
723
- `name = "OpenClaw Relay"`,
725
+ `name = "云翼 Codex"`,
724
726
  `base_url = "${normalizedUrl}"`,
725
727
  `wire_api = "responses"`,
726
728
  `experimental_bearer_token = "${apiKey}"`,
@@ -819,31 +821,14 @@ function writeOpencodeConfig(claudeBaseUrl, codexBaseUrl, apiKey, modelId) {
819
821
  // 移除旧标记块(仅移除 yunyi opencode 自己的)
820
822
  content = content.replace(/# >>> yunyi opencode >>>[\s\S]*?# <<< yunyi opencode <<<\n?/g, '');
821
823
 
822
- // 移除旧的 yunyi model_providers 段落(包括 yunyi-cli 写入的 [model_providers.yunyi]
823
- content = content.replace(/\[model_providers\.yunyi[^\]]*\]\n(?:(?!\[)[^\n]*\n?)*/g, '');
824
-
825
- // 只追加 yunyi-codex provider(Claude 配置仅在 opencode.json 中,Codex CLI 不支持 wire_api=anthropic)
826
- const providers = [''];
827
- if (codexUrl) {
828
- providers.push(
829
- '# >>> yunyi opencode >>>',
830
- '[model_providers.yunyi-codex]',
831
- 'name = "云翼 Codex"',
832
- `base_url = "${codexUrl}"`,
833
- 'wire_api = "responses"',
834
- `experimental_bearer_token = "${apiKey}"`,
835
- 'requires_openai_auth = false',
836
- '# <<< yunyi opencode <<<'
837
- );
838
- }
824
+ // 移除旧版 yunyi-cli 写入的 [model_providers.yunyi] 和 [model_providers.yunyi-claude](不动 yunyi-codex,由 writeCodexConfig 管理)
825
+ content = content.replace(/\[model_providers\.yunyi\]\n(?:(?!\[)[^\n]*\n?)*/g, '');
826
+ content = content.replace(/\[model_providers\.yunyi-claude\]\n(?:(?!\[)[^\n]*\n?)*/g, '');
839
827
 
840
828
  // 清理多余空行
841
829
  content = content.replace(/\n{3,}/g, '\n\n').trim();
842
830
 
843
- // 追加 provider section
844
- if (providers.length > 1) {
845
- content += '\n\n' + providers.join('\n') + '\n';
846
- }
831
+ // yunyi-codex provider 由 writeCodexConfig 统一管理,此处不再重复写入
847
832
 
848
833
  fs.writeFileSync(codexConfigPath, content, 'utf8');
849
834
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yymaxapi",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
4
4
  "description": "跨平台 OpenClaw/Clawdbot 配置管理工具 - 管理中转地址、模型切换、API Keys、测速优化",
5
5
  "main": "bin/yymaxapi.js",
6
6
  "bin": {