feat(token-meter): project durable token usage

This commit is contained in:
Hypatia May
2026-07-29 14:35:24 +08:00
parent 741b760557
commit e37cb23336
9 changed files with 383 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
/**
* Pure client-safe token-usage projection vocabulary.
*
* @module @deepseek-ai/dsh-token-meter/projection
*/
/**
* Durable cumulative provider usage for a complete session log.
*
* The four buckets are disjoint. In particular, reasoning tokens are already
* included in `outputTokens` and are not accumulated again.
*/
export interface TokenUsageProjection {
uncachedInputTokens: number
outputTokens: number
cacheReadTokens: number
cacheWriteTokens: number
}
declare module '@deepseek-ai/dsh-session-projection/types' {
interface SessionProjectionMap {
/** Provider-reported usage accumulated across the complete durable log. */
tokenUsage: TokenUsageProjection
}
}