aihezu 2.8.10 → 2.8.11

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/commands/usage.js +17 -7
  2. package/package.json +1 -1
package/commands/usage.js CHANGED
@@ -296,17 +296,27 @@ function usageHint(current, limit) {
296
296
  }
297
297
 
298
298
  function getUsageApiBase(baseUrl) {
299
- // 去掉路径中的 /openai 后缀(Codex base_url 常见格式 https://xxx/openai;
300
- // Claude base_url 不会带,等价于 no-op)
299
+ // 去掉路径中的 /openai /api 后缀
300
+ // - Codex base_url 常见格式 https://xxx/openai
301
+ // - 部分用户 base_url 为 https://xxx/api
302
+ // - Claude 默认 base_url 不带后缀,等价于 no-op
303
+ const stripSuffix = (pathname) => {
304
+ let p = pathname.replace(/\/+$/, '');
305
+ const lower = p.toLowerCase();
306
+ if (lower.endsWith('/openai')) {
307
+ p = p.slice(0, -'/openai'.length);
308
+ } else if (lower.endsWith('/api')) {
309
+ p = p.slice(0, -'/api'.length);
310
+ }
311
+ return p;
312
+ };
313
+
301
314
  try {
302
315
  const url = new URL(baseUrl);
303
- let pathname = url.pathname.replace(/\/+$/, '');
304
- if (pathname.toLowerCase().endsWith('/openai')) {
305
- pathname = pathname.slice(0, -'/openai'.length);
306
- }
316
+ const pathname = stripSuffix(url.pathname);
307
317
  return `${url.origin}${pathname}`;
308
318
  } catch (error) {
309
- return baseUrl.replace(/\/+$/, '').replace(/\/openai$/i, '');
319
+ return stripSuffix(baseUrl.replace(/\/+$/, ''));
310
320
  }
311
321
  }
312
322
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aihezu",
3
- "version": "2.8.10",
3
+ "version": "2.8.11",
4
4
  "description": "AI 开发环境配置工具 - 支持 Claude Code, Codex, Google Gemini 的本地化配置、代理设置与缓存清理",
5
5
  "main": "bin/aihezu.js",
6
6
  "bin": {