lynkr 9.14.16 → 9.14.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lynkr",
3
- "version": "9.14.16",
3
+ "version": "9.14.17",
4
4
  "files": [
5
5
  "index.js",
6
6
  "install.sh",
@@ -2879,14 +2879,22 @@ function convertOpenAIToAnthropic(response) {
2879
2879
  model: response.model,
2880
2880
  stop_reason: stopReason,
2881
2881
  stop_sequence: null,
2882
- usage: {
2883
- input_tokens: response.usage?.prompt_tokens || 0,
2884
- output_tokens: response.usage?.completion_tokens || 0,
2885
- // Provider-side prompt-cache hits — telemetry reads this field name.
2886
- cache_read_input_tokens: response.usage?.cache_read_input_tokens
2882
+ usage: (() => {
2883
+ // Anthropic semantics: input_tokens EXCLUDES cache reads. OpenAI's
2884
+ // prompt_tokens INCLUDES them, so subtract here — downstream rebuilders
2885
+ // (openai-format.js finalUsage/convertUsage) add cache_read back when
2886
+ // emitting OpenAI shape. Copying prompt_tokens verbatim double-counted
2887
+ // cached tokens (2× reported prompt, cache % halved — exp2 2026-09-29).
2888
+ const cacheRead = response.usage?.cache_read_input_tokens
2887
2889
  ?? response.usage?.prompt_tokens_details?.cached_tokens
2888
- ?? null,
2889
- }
2890
+ ?? null;
2891
+ return {
2892
+ input_tokens: Math.max(0, (response.usage?.prompt_tokens || 0) - (cacheRead || 0)),
2893
+ output_tokens: response.usage?.completion_tokens || 0,
2894
+ // Provider-side prompt-cache hits — telemetry reads this field name.
2895
+ cache_read_input_tokens: cacheRead,
2896
+ };
2897
+ })()
2890
2898
  };
2891
2899
  }
2892
2900