gitlab-ai-provider 6.7.0 → 6.7.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
4
4
 
5
+ ## <small>6.7.1 (2026-05-26)</small>
6
+
7
+ - Merge branch 'fix/anthropic-cache-token-counting' into 'main' ([298e2d0](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/298e2d0))
8
+ - build: regenerate dist for anthropic cache token fix ([627d6f7](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/627d6f7))
9
+ - test(anthropic): add streaming test for cache token handling ([6033350](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/6033350))
10
+ - fix(anthropic): include cache tokens in input token total ([699af0a](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/699af0a))
11
+
5
12
  ## 6.7.0 (2026-05-18)
6
13
 
7
14
  - Merge branch 'feat/add-gpt-5-5-model-mapping' into 'main' ([10e84d1](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/10e84d1))
package/dist/index.js CHANGED
@@ -474,14 +474,15 @@ ${message.content}` : message.content;
474
474
  return { unified, raw: stopReason ?? void 0 };
475
475
  }
476
476
  createUsage(params) {
477
- const inputTotal = params?.inputTotal;
477
+ const inputNoCache = params?.inputTotal;
478
478
  const outputTotal = params?.outputTotal;
479
479
  const cacheRead = params?.cacheRead;
480
480
  const cacheWrite = params?.cacheWrite;
481
+ const inputTotal = inputNoCache != null ? inputNoCache + (cacheRead ?? 0) + (cacheWrite ?? 0) : void 0;
481
482
  return {
482
483
  inputTokens: {
483
484
  total: inputTotal,
484
- noCache: inputTotal == null ? void 0 : Math.max(0, inputTotal - (cacheRead ?? 0) - (cacheWrite ?? 0)),
485
+ noCache: inputNoCache,
485
486
  cacheRead,
486
487
  cacheWrite
487
488
  },
@@ -609,12 +610,13 @@ ${message.content}` : message.content;
609
610
  switch (event.type) {
610
611
  case "message_start":
611
612
  if (event.message.usage) {
613
+ const msgUsage = event.message.usage;
612
614
  usage = self.createUsage({
613
- inputTotal: event.message.usage.input_tokens,
615
+ inputTotal: msgUsage.input_tokens,
614
616
  outputTotal: usage.outputTokens.total,
615
617
  outputReasoning: usage.outputTokens.reasoning,
616
- cacheRead: usage.inputTokens.cacheRead,
617
- cacheWrite: usage.inputTokens.cacheWrite,
618
+ cacheRead: msgUsage.cache_read_input_tokens,
619
+ cacheWrite: msgUsage.cache_creation_input_tokens,
618
620
  raw: usage.raw
619
621
  });
620
622
  }
@@ -688,12 +690,13 @@ ${message.content}` : message.content;
688
690
  }
689
691
  case "message_delta":
690
692
  if (event.usage) {
693
+ const deltaUsage = event.usage;
691
694
  usage = self.createUsage({
692
- inputTotal: usage.inputTokens.total,
693
- outputTotal: event.usage.output_tokens,
695
+ inputTotal: usage.inputTokens.noCache,
696
+ outputTotal: deltaUsage.output_tokens,
694
697
  outputReasoning: usage.outputTokens.reasoning,
695
- cacheRead: usage.inputTokens.cacheRead,
696
- cacheWrite: usage.inputTokens.cacheWrite,
698
+ cacheRead: deltaUsage.cache_read_input_tokens ?? usage.inputTokens.cacheRead,
699
+ cacheWrite: deltaUsage.cache_creation_input_tokens ?? usage.inputTokens.cacheWrite,
697
700
  raw: usage.raw
698
701
  });
699
702
  }
@@ -1681,7 +1684,7 @@ var GitLabOpenAILanguageModel = class {
1681
1684
  var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
1682
1685
 
1683
1686
  // src/version.ts
1684
- var VERSION = true ? "6.6.0" : "0.0.0-dev";
1687
+ var VERSION = true ? "6.7.0" : "0.0.0-dev";
1685
1688
 
1686
1689
  // src/gitlab-workflow-types.ts
1687
1690
  var WorkflowType = /* @__PURE__ */ ((WorkflowType2) => {