yymaxapi 1.0.123 → 1.0.124

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 +13 -4
  2. package/package.json +1 -1
package/bin/yymaxapi.js CHANGED
@@ -3070,21 +3070,30 @@ function applyManagedYunyiOpenClawLayout(config, options = {}) {
3070
3070
  ensureConfigStructure(config);
3071
3071
 
3072
3072
  const endpointUrl = inferManagedYunyiEndpointUrl(config, options.endpointUrl);
3073
- const apiKey = inferManagedYunyiApiKey(config, options.apiKey);
3073
+ const sharedApiKey = String(options.apiKey || '').trim();
3074
+ const fallbackApiKey = inferManagedYunyiApiKey(config, sharedApiKey);
3074
3075
  if (!endpointUrl) {
3075
3076
  return { changed: false, applied: false, claudeAgentId: null, preservedMain: false };
3076
3077
  }
3077
3078
 
3078
3079
  let changed = false;
3079
3080
  const providers = config.models.providers;
3080
-
3081
- const nextClaudeProvider = buildManagedYunyiProviderConfig('claude', endpointUrl, apiKey, providers[YYMAXAPI_OPENCLAW_CLAUDE_PROVIDER] || {});
3081
+ const claudeApiKey = sharedApiKey
3082
+ || String(options.claudeApiKey || options.claudeKey || '').trim()
3083
+ || String(providers[YYMAXAPI_OPENCLAW_CLAUDE_PROVIDER]?.apiKey || '').trim()
3084
+ || fallbackApiKey;
3085
+ const gptApiKey = sharedApiKey
3086
+ || String(options.codexApiKey || options.codexKey || options.gptApiKey || options.gptKey || '').trim()
3087
+ || String(providers[YYMAXAPI_OPENCLAW_GPT_PROVIDER]?.apiKey || '').trim()
3088
+ || fallbackApiKey;
3089
+
3090
+ const nextClaudeProvider = buildManagedYunyiProviderConfig('claude', endpointUrl, claudeApiKey, providers[YYMAXAPI_OPENCLAW_CLAUDE_PROVIDER] || {});
3082
3091
  if (JSON.stringify(nextClaudeProvider) !== JSON.stringify(providers[YYMAXAPI_OPENCLAW_CLAUDE_PROVIDER] || {})) {
3083
3092
  providers[YYMAXAPI_OPENCLAW_CLAUDE_PROVIDER] = nextClaudeProvider;
3084
3093
  changed = true;
3085
3094
  }
3086
3095
 
3087
- const nextGptProvider = buildManagedYunyiProviderConfig('codex', endpointUrl, apiKey, providers[YYMAXAPI_OPENCLAW_GPT_PROVIDER] || {});
3096
+ const nextGptProvider = buildManagedYunyiProviderConfig('codex', endpointUrl, gptApiKey, providers[YYMAXAPI_OPENCLAW_GPT_PROVIDER] || {});
3088
3097
  if (JSON.stringify(nextGptProvider) !== JSON.stringify(providers[YYMAXAPI_OPENCLAW_GPT_PROVIDER] || {})) {
3089
3098
  providers[YYMAXAPI_OPENCLAW_GPT_PROVIDER] = nextGptProvider;
3090
3099
  changed = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yymaxapi",
3
- "version": "1.0.123",
3
+ "version": "1.0.124",
4
4
  "description": "跨平台 OpenClaw/Clawdbot 配置管理工具 - 管理中转地址、模型切换、API Keys、测速优化",
5
5
  "main": "bin/yymaxapi.js",
6
6
  "bin": {