@zenmux/rosetta-ai 1.0.35 → 1.0.37

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.
@@ -661,12 +661,16 @@ class ChatCompletionToResponsesConverter {
661
661
  }
662
662
  }
663
663
  convertUsage(usage, webSearchCount = 0) {
664
+ const cacheWriteTokens = usage.input_tokens_details?.cache_write_tokens;
664
665
  return {
665
666
  prompt_tokens: usage.input_tokens,
666
667
  completion_tokens: usage.output_tokens,
667
668
  total_tokens: usage.total_tokens,
668
669
  prompt_tokens_details: {
669
670
  cached_tokens: usage.input_tokens_details?.cached_tokens ?? 0,
671
+ ...(cacheWriteTokens != null ? { cache_write_tokens: cacheWriteTokens } : {}),
672
+ // @ts-expect-error Preserve cache-write details not yet declared by the SDK.
673
+ cache_write_tokens_details: usage.input_tokens_details?.cache_write_tokens_details,
670
674
  ...(webSearchCount > 0 ? { web_search: webSearchCount } : {}),
671
675
  },
672
676
  completion_tokens_details: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenmux/rosetta-ai",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "Universal translator between AI provider protocols",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -60,4 +60,4 @@
60
60
  "typescript": "^6.0.2",
61
61
  "typescript-eslint": "^8.58.2"
62
62
  }
63
- }
63
+ }