codeep 2.13.1 → 2.13.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.
@@ -1095,6 +1095,8 @@ export function startAcpServer() {
1095
1095
  provider: entry.provider,
1096
1096
  inputTokens: entry.promptTokens || undefined,
1097
1097
  outputTokens: entry.completionTokens || undefined,
1098
+ cacheCreationTokens: entry.cacheCreationTokens || undefined,
1099
+ cacheReadTokens: entry.cacheReadTokens || undefined,
1098
1100
  estimatedCost: entry.estimatedCost || undefined,
1099
1101
  });
1100
1102
  }
@@ -398,6 +398,8 @@ export async function executeAgentTask(task, dryRun, ctx) {
398
398
  provider: entry.provider,
399
399
  inputTokens: entry.promptTokens || undefined,
400
400
  outputTokens: entry.completionTokens || undefined,
401
+ cacheCreationTokens: entry.cacheCreationTokens || undefined,
402
+ cacheReadTokens: entry.cacheReadTokens || undefined,
401
403
  estimatedCost: entry.estimatedCost || undefined,
402
404
  });
403
405
  }
@@ -203,6 +203,8 @@ async function handleSubmit(message) {
203
203
  provider: entry.provider,
204
204
  inputTokens: entry.promptTokens || undefined,
205
205
  outputTokens: entry.completionTokens || undefined,
206
+ cacheCreationTokens: entry.cacheCreationTokens || undefined,
207
+ cacheReadTokens: entry.cacheReadTokens || undefined,
206
208
  estimatedCost: entry.estimatedCost || undefined,
207
209
  });
208
210
  }
@@ -888,6 +890,8 @@ async function gracefulShutdown() {
888
890
  projectId,
889
891
  inputTokens: tokenStats.totalPromptTokens || undefined,
890
892
  outputTokens: tokenStats.totalCompletionTokens || undefined,
893
+ cacheCreationTokens: tokenStats.totalCacheCreationTokens || undefined,
894
+ cacheReadTokens: tokenStats.totalCacheReadTokens || undefined,
891
895
  estimatedCost: tokenStats.estimatedCost || undefined,
892
896
  }),
893
897
  ]);
@@ -25,6 +25,12 @@ export interface StatsPayload {
25
25
  isGit?: boolean;
26
26
  inputTokens?: number;
27
27
  outputTokens?: number;
28
+ /** Anthropic prompt caching: tokens written to cache (billed ~1.25× input).
29
+ * Undefined for providers that don't report caching. */
30
+ cacheCreationTokens?: number;
31
+ /** Anthropic prompt caching: tokens read from cache (billed ~0.1× input).
32
+ * Undefined for providers that don't report caching. */
33
+ cacheReadTokens?: number;
28
34
  estimatedCost?: number;
29
35
  }
30
36
  /**
@@ -19,6 +19,10 @@ export interface SessionTokenStats {
19
19
  totalTokens: number;
20
20
  requestCount: number;
21
21
  estimatedCost: number;
22
+ /** Anthropic prompt caching: total tokens written to cache this session. */
23
+ totalCacheCreationTokens: number;
24
+ /** Anthropic prompt caching: total tokens read from cache this session. */
25
+ totalCacheReadTokens: number;
22
26
  }
23
27
  interface TokenRecord {
24
28
  timestamp: number;
@@ -63,6 +67,12 @@ export interface ProviderCostBreakdown {
63
67
  model: string;
64
68
  promptTokens: number;
65
69
  completionTokens: number;
70
+ /** Anthropic prompt caching: tokens written to cache (billed ~1.25× input).
71
+ * 0 for providers that don't report caching. */
72
+ cacheCreationTokens: number;
73
+ /** Anthropic prompt caching: tokens read from cache (billed ~0.1× input).
74
+ * 0 for providers that don't report caching. */
75
+ cacheReadTokens: number;
66
76
  estimatedCost: number;
67
77
  }
68
78
  /**
@@ -167,9 +167,11 @@ export function getCostBreakdown() {
167
167
  const grouped = new Map();
168
168
  for (const record of records) {
169
169
  const key = `${record.provider}/${record.model}`;
170
- const existing = grouped.get(key) ?? { provider: record.provider, model: record.model, promptTokens: 0, completionTokens: 0, estimatedCost: 0 };
170
+ const existing = grouped.get(key) ?? { provider: record.provider, model: record.model, promptTokens: 0, completionTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0, estimatedCost: 0 };
171
171
  existing.promptTokens += record.promptTokens;
172
172
  existing.completionTokens += record.completionTokens;
173
+ existing.cacheCreationTokens += record.cacheCreationTokens ?? 0;
174
+ existing.cacheReadTokens += record.cacheReadTokens ?? 0;
173
175
  // Cost source priority:
174
176
  // 1. Provider-reported USD (OpenRouter, MaxiCloud, etc.) — most accurate.
175
177
  // 2. Our MODEL_PRICING table — for built-in providers we maintain rates for.
@@ -223,10 +225,14 @@ export function getSessionStats() {
223
225
  let totalPromptTokens = 0;
224
226
  let totalCompletionTokens = 0;
225
227
  let totalTokens = 0;
228
+ let totalCacheCreationTokens = 0;
229
+ let totalCacheReadTokens = 0;
226
230
  for (const record of records) {
227
231
  totalPromptTokens += record.promptTokens;
228
232
  totalCompletionTokens += record.completionTokens;
229
233
  totalTokens += record.totalTokens;
234
+ totalCacheCreationTokens += record.cacheCreationTokens ?? 0;
235
+ totalCacheReadTokens += record.cacheReadTokens ?? 0;
230
236
  }
231
237
  const estimatedCost = getCostBreakdown().reduce((s, b) => s + b.estimatedCost, 0);
232
238
  return {
@@ -235,6 +241,8 @@ export function getSessionStats() {
235
241
  totalTokens,
236
242
  requestCount: records.length,
237
243
  estimatedCost,
244
+ totalCacheCreationTokens,
245
+ totalCacheReadTokens,
238
246
  };
239
247
  }
240
248
  /**
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "2.13.1";
1
+ export declare const VERSION = "2.13.2";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
2
2
  // Baked from package.json at build time so the bun-compiled binary reports
3
3
  // the right version (it has no package.json on disk to read at runtime).
4
- export const VERSION = '2.13.1';
4
+ export const VERSION = '2.13.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "2.13.1",
3
+ "version": "2.13.2",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",