@molecule/api-ai-moonshot 1.3.1 → 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/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +8 -0
- package/package.json +2 -2
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,UAAU,EAQX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,UAAU,EAQX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AA2zBhD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAElE"}
|
package/dist/provider.js
CHANGED
|
@@ -514,12 +514,14 @@ class MoonshotAIProvider {
|
|
|
514
514
|
// prompt_tokens INCLUDES cached tokens on OpenAI-compatible APIs — report
|
|
515
515
|
// the cached portion separately (cacheReadPricePerMTok) and only the fresh
|
|
516
516
|
// remainder as inputTokens, matching the other bonds' semantics.
|
|
517
|
+
const reasoning = usage?.completion_tokens_details?.reasoning_tokens;
|
|
517
518
|
const cachedTokens = usage?.prompt_tokens_details?.cached_tokens ?? 0;
|
|
518
519
|
yield {
|
|
519
520
|
type: 'done',
|
|
520
521
|
usage: {
|
|
521
522
|
inputTokens: Math.max(0, (usage?.prompt_tokens ?? 0) - cachedTokens),
|
|
522
523
|
outputTokens: usage?.completion_tokens ?? 0,
|
|
524
|
+
...(typeof reasoning === 'number' ? { reasoningOutputTokens: reasoning } : {}),
|
|
523
525
|
...(cachedTokens ? { cacheReadInputTokens: cachedTokens } : {}),
|
|
524
526
|
},
|
|
525
527
|
};
|
|
@@ -601,6 +603,9 @@ class MoonshotAIProvider {
|
|
|
601
603
|
usage: {
|
|
602
604
|
inputTokens: Math.max(0, state.inputTokens - state.cacheReadTokens),
|
|
603
605
|
outputTokens: state.outputTokens,
|
|
606
|
+
...(state.reasoningOutputTokens !== undefined
|
|
607
|
+
? { reasoningOutputTokens: state.reasoningOutputTokens }
|
|
608
|
+
: {}),
|
|
604
609
|
...(state.cacheReadTokens ? { cacheReadInputTokens: state.cacheReadTokens } : {}),
|
|
605
610
|
},
|
|
606
611
|
provider: call.meta,
|
|
@@ -677,6 +682,9 @@ class MoonshotAIProvider {
|
|
|
677
682
|
// Usage info (may appear in the final chunk)
|
|
678
683
|
const usage = event.usage;
|
|
679
684
|
if (usage) {
|
|
685
|
+
const reasoning = usage.completion_tokens_details?.reasoning_tokens;
|
|
686
|
+
if (typeof reasoning === 'number')
|
|
687
|
+
state.reasoningOutputTokens = reasoning;
|
|
680
688
|
if (usage.prompt_tokens)
|
|
681
689
|
state.inputTokens = usage.prompt_tokens;
|
|
682
690
|
if (usage.completion_tokens)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-ai-moonshot",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Moonshot (Kimi) AI provider for molecule.dev",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/api-ai-moonshot",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"directory": "packages/api/bonds/ai/moonshot"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@molecule/api-ai": "1.6.
|
|
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",
|