@compilr-dev/agents 0.3.5 → 0.3.6

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.
@@ -83,6 +83,11 @@ export interface OpenAIStreamChunk {
83
83
  prompt_tokens: number;
84
84
  completion_tokens: number;
85
85
  total_tokens: number;
86
+ /** OpenAI prompt caching: details about cached tokens */
87
+ prompt_tokens_details?: {
88
+ cached_tokens?: number;
89
+ audio_tokens?: number;
90
+ };
86
91
  };
87
92
  }
88
93
  /**
@@ -141,6 +141,10 @@ export class OpenAICompatibleProvider {
141
141
  usage = {
142
142
  inputTokens: chunk.usage.prompt_tokens,
143
143
  outputTokens: chunk.usage.completion_tokens,
144
+ // OpenAI automatic prompt caching: capture cached tokens
145
+ ...(chunk.usage.prompt_tokens_details?.cached_tokens
146
+ ? { cacheReadTokens: chunk.usage.prompt_tokens_details.cached_tokens }
147
+ : {}),
144
148
  };
145
149
  }
146
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/agents",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Lightweight multi-LLM agent library for building CLI AI assistants",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",