pub struct TurnCost {
pub at_ms: u64,
pub ctx: String,
pub prompt_tokens: Option<u64>,
pub completion_tokens: Option<u64>,
pub cached_tokens: Option<u64>,
pub ttft_ms: Option<u64>,
pub latency_ms: Option<u64>,
pub tokens_per_sec: Option<f64>,
pub window_tokens: Option<u64>,
}Expand description
What the last turn on a session cost, kept in the store so a row can be honest about a session nothing is running any more (#344).
The numbers are a snapshot of one turn, not a dimension of the session, which is why they
live in one JSON column rather than a column per counter: the counter set moves (a cache-write
field, reasoning tokens), and a sessions.db should not grow a migration every time the usage
struct does. A blob that will not parse reads as absent — the same thing the dashboard shows
for a session that never ran — so a corrupt record can never be mistaken for a measurement.
ctx is the server’s own string (eclipse_core::contextbar), rendered when the turn
finished. Storing the string rather than its inputs is the point: the dashboard paints what
the terminal prints, and neither surface recomputes a denominator (#264).
Fields§
§at_ms: u64Unix milliseconds, when the turn’s accounting was written.
ctx: Stringctx 121K/262K ██████░░░░│░ 46%, from the reader the CLI uses.
prompt_tokens: Option<u64>§completion_tokens: Option<u64>§cached_tokens: Option<u64>§ttft_ms: Option<u64>§latency_ms: Option<u64>§tokens_per_sec: Option<f64>Absent when the model counted nothing or the clock did not move.
window_tokens: Option<u64>The denominator that was in force for that turn — a fact about that model, not about the one selected now.