🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@askalf/dario

Package Overview
Dependencies
Maintainers
1
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@askalf/dario - npm Package Compare versions

Comparing version
5.2.2
to
5.2.3
+24
-0
dist/analytics.d.ts

@@ -67,2 +67,26 @@ /**

/**
* One-line per-request usage summary for verbose (-v / -vv) logs.
*
* dario already parses `input_tokens` / `cache_read_input_tokens` /
* `cache_creation_input_tokens` off every response into analytics and the
* `--log-file`, but never printed them to the console — so anyone debugging
* subscription burn (dario#678) only ever saw the request body and the
* billing *bucket*, never the cache accounting that actually governs cost.
* This surfaces it next to the existing `billing:` line so a plain `-vv`
* capture is self-diagnosing.
*
* `cachedPct` = cache_read / (input + cache_read + cache_create): the share of
* *prompt* tokens served from cache rather than freshly billed. On a repeated
* prompt a LOW value means the prefix is being re-created (a >5-minute gap
* expired the 5m TTL, or the cached prefix changed) — the exact signal the
* cache-TTL discussion turns on. Output tokens are excluded from the ratio
* (they are never cacheable). Pure + total-zero-safe for unit testing.
*/
export declare function formatUsageLogLine(requestCount: number, u: {
inputTokens?: number;
outputTokens?: number;
cacheReadTokens?: number;
cacheCreateTokens?: number;
}): string;
/**
* The sentinel `claim` dario assigns when a response carried no rate-limit

@@ -69,0 +93,0 @@ * header at all (non-200s, stream aborts, early rejects — see `pool.ts`

@@ -66,2 +66,29 @@ /**

/**
* One-line per-request usage summary for verbose (-v / -vv) logs.
*
* dario already parses `input_tokens` / `cache_read_input_tokens` /
* `cache_creation_input_tokens` off every response into analytics and the
* `--log-file`, but never printed them to the console — so anyone debugging
* subscription burn (dario#678) only ever saw the request body and the
* billing *bucket*, never the cache accounting that actually governs cost.
* This surfaces it next to the existing `billing:` line so a plain `-vv`
* capture is self-diagnosing.
*
* `cachedPct` = cache_read / (input + cache_read + cache_create): the share of
* *prompt* tokens served from cache rather than freshly billed. On a repeated
* prompt a LOW value means the prefix is being re-created (a >5-minute gap
* expired the 5m TTL, or the cached prefix changed) — the exact signal the
* cache-TTL discussion turns on. Output tokens are excluded from the ratio
* (they are never cacheable). Pure + total-zero-safe for unit testing.
*/
export function formatUsageLogLine(requestCount, u) {
const inp = u.inputTokens ?? 0;
const out = u.outputTokens ?? 0;
const cr = u.cacheReadTokens ?? 0;
const cc = u.cacheCreateTokens ?? 0;
const promptTotal = inp + cr + cc;
const pct = promptTotal > 0 ? Math.round((cr / promptTotal) * 100) : 0;
return `[dario] #${requestCount} usage: in=${inp} out=${out} cache_read=${cr} cache_create=${cc} (${pct}% of prompt from cache)`;
}
/**
* The sentinel `claim` dario assigns when a response carried no rate-limit

@@ -68,0 +95,0 @@ * header at all (non-200s, stream aborts, early rejects — see `pool.ts`

+1
-1
{
"name": "@askalf/dario",
"version": "5.2.2",
"version": "5.2.3",
"description": "Use your Claude Pro/Max subscription in any tool — Cursor, Cline, Aider, the Agent SDK, your scripts — at subscription pricing, not per-token API bills. One local Anthropic + OpenAI-compatible endpoint.",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is too big to display