Skip to main content

Module usage

Module usage 

Source
Expand description

What one provider call cost, and what the session has cost so far.

Two dialects report this, and both are worth reading because they say different things:

  • OpenAI puts usage: {prompt_tokens, completion_tokens, total_tokens}, and, when the server caches a prefix, usage.prompt_tokens_details.cached_tokens. It says nothing about time.
  • llama.cpp adds timings: {prompt_n, prompt_ms, predicted_n, predicted_ms, cache_n} — the prefill cost, the decode cost, and how many prompt tokens were reused from the KV cache. prompt_n counts only the tokens actually processed, so the prompt size is prompt_n + cache_n; that cache_n is the number the status line shows, because a warm cache is the difference between a 1 s and a 20 s turn on a local server.

Everything is optional on purpose. A server that reports nothing is normal, and the UI then shows -- rather than inventing a number.

Structs§

TurnUsage
What one provider call cost.
UsageTotals
Running totals for the whole process, so the status line can show more than the last turn.