{# What `/usage` shows. Two different numbers, deliberately kept apart. **Used** is how full the window is right now -- one reply's prompt plus its completion, which is what decides when compaction fires. **Spent** is everything this conversation has cost end to end, which is larger and grows forever: a three-round reply pays for its prompt three times but only ever occupies the window once. Anything derived from an estimate wears a `~`, because `services/tokens.py` counts four characters to a token when an endpoint reports nothing, and a precise-looking figure that is a guess is worse than an obvious guess. #} {% if not metrics.context_limit %} {# Unknown is not zero. Nobody has said how big this model's window is, so the percentage is omitted rather than computed, and automatic compaction never fires. #} {% endif %} {% if cost %} {# What the replies cost, as stored on each when it was written. #} {% endif %} {% if metrics.tokens_per_second %} {% endif %} {% if chat.compact_summary %} {% endif %}
{{ t("In the window now") }} {% if metrics.context_tokens %} {% set used = ('~' if metrics.estimated else '') ~ '{:,}'.format(metrics.context_tokens) %} {% if metrics.percent %} {{ t("%(n)s tokens — %(percent)s%% of %(limit)s", n=used, percent=metrics.percent, limit='{:,}'.format(metrics.context_limit)) }} {% else %} {{ t("%(n)s tokens", n=used) }} {% endif %} {% else %} {{ t("Nothing yet.") }} {% endif %}
{{ t("Window size") }} {% if model %} {{ t("Not recorded for %(model)s, so there is no percentage and this chat will never compact itself.", model=model.label) }} {% else %} {{ t("Not recorded for this model, so there is no percentage and this chat will never compact itself.") }} {% endif %} {% if user.is_admin %} {{ tm('Set it under Models.') }} {% endif %}
{{ t("Spent in total") }} {% set spent = ('~' if estimated else '') ~ '{:,}'.format(totals.total) %} {{ t("%(n)s tokens across %(replies)s reply", n=spent, replies=replies) if replies == 1 else t("%(n)s tokens across %(replies)s replies", n=spent, replies=replies) }}
{{ t("Of which sent") }} {{ t("%(n)s tokens", n=('~' if estimated else '') ~ '{:,}'.format(totals.prompt)) }}
{{ t("Of which written") }} {{ t("%(n)s tokens", n=('~' if estimated else '') ~ '{:,}'.format(totals.completion)) }}
{{ t("Cost") }} {{ cost.money }}
{{ t("Last reply") }} {{ t("%(n)s tokens/second", n='%.1f'|format(metrics.tokens_per_second)) }}
{{ t("Compacted") }} {{ t("Earlier turns are summarised. They are still in the transcript; they just stop being sent.") }}