(...values: any[])
| 33 | } |
| 34 | |
| 35 | function tokenCount(...values: any[]): number { |
| 36 | for (const value of values) { |
| 37 | if (typeof value === 'number' && Number.isFinite(value)) return value; |
| 38 | } |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | /** Extract cached token count from common OpenAI-compatible usage shapes. */ |
| 43 | export function extractCachedTokens(usage: any): number { |
no outgoing calls
no test coverage detected