@molecule/api-ai-zhipu 1.3.0 → 1.3.2

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.
package/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-16T23:28:48.730Z
6
+ Generated: 2026-11-13T19:22:15.430Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-zhipu
@@ -158,7 +158,7 @@ export function setupAiZhipu(): void {
158
158
 
159
159
  Peer dependencies:
160
160
 
161
- - `@molecule/api-ai` ^1.0.1
161
+ - `@molecule/api-ai` ^1.6.0
162
162
  - `@molecule/api-bond` ^1.0.1
163
163
  - `@molecule/api-i18n` ^1.0.1
164
164
  - `@molecule/api-secrets` ^1.0.1
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EACV,UAAU,EASX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AA4xB7C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,CAE/D"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EACV,UAAU,EASX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAsyB7C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,CAE/D"}
package/dist/provider.js CHANGED
@@ -491,12 +491,14 @@ class ZhipuAIProvider {
491
491
  // prompt_tokens INCLUDES cached tokens on OpenAI-compatible APIs — report
492
492
  // the cached portion separately (cacheReadPricePerMTok) and only the fresh
493
493
  // remainder as inputTokens, matching the other bonds' semantics.
494
+ const reasoning = usage?.completion_tokens_details?.reasoning_tokens;
494
495
  const cachedTokens = usage?.prompt_tokens_details?.cached_tokens ?? 0;
495
496
  yield {
496
497
  type: 'done',
497
498
  usage: {
498
499
  inputTokens: Math.max(0, (usage?.prompt_tokens ?? 0) - cachedTokens),
499
500
  outputTokens: usage?.completion_tokens ?? 0,
501
+ ...(typeof reasoning === 'number' ? { reasoningOutputTokens: reasoning } : {}),
500
502
  ...(cachedTokens ? { cacheReadInputTokens: cachedTokens } : {}),
501
503
  ...(carriesSearchResults(data) ? { webSearchRequests: 1 } : {}),
502
504
  },
@@ -589,6 +591,9 @@ class ZhipuAIProvider {
589
591
  usage: {
590
592
  inputTokens: Math.max(0, state.inputTokens - state.cacheReadTokens),
591
593
  outputTokens: state.outputTokens,
594
+ ...(state.reasoningOutputTokens !== undefined
595
+ ? { reasoningOutputTokens: state.reasoningOutputTokens }
596
+ : {}),
592
597
  ...(state.cacheReadTokens ? { cacheReadInputTokens: state.cacheReadTokens } : {}),
593
598
  ...(state.searched ? { webSearchRequests: 1 } : {}),
594
599
  },
@@ -668,6 +673,9 @@ class ZhipuAIProvider {
668
673
  // Usage info (may appear in the final chunk)
669
674
  const usage = event.usage;
670
675
  if (usage) {
676
+ const reasoning = usage.completion_tokens_details?.reasoning_tokens;
677
+ if (typeof reasoning === 'number')
678
+ state.reasoningOutputTokens = reasoning;
671
679
  if (usage.prompt_tokens)
672
680
  state.inputTokens = usage.prompt_tokens;
673
681
  if (usage.completion_tokens)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-zhipu",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Zhipu GLM AI provider for molecule.dev",
5
5
  "homepage": "https://www.molecule.dev/packages/api-ai-zhipu",
6
6
  "type": "module",
@@ -34,14 +34,14 @@
34
34
  "directory": "packages/api/bonds/ai/zhipu"
35
35
  },
36
36
  "devDependencies": {
37
- "@molecule/api-ai": "1.5.0",
37
+ "@molecule/api-ai": "1.6.1",
38
38
  "@molecule/api-bond": "1.0.4",
39
39
  "@types/node": "26.6.5",
40
40
  "typescript": "6.0.3",
41
41
  "vitest": "4.1.12"
42
42
  },
43
43
  "peerDependencies": {
44
- "@molecule/api-ai": "^1.0.1",
44
+ "@molecule/api-ai": "^1.6.0",
45
45
  "@molecule/api-bond": "^1.0.1",
46
46
  "@molecule/api-i18n": "^1.0.1",
47
47
  "@molecule/api-secrets": "^1.0.1"