{% from "components/card.html" import stat_card %}
{{ stat_card( label="Input Tokens", value=(tokens.input_tokens|default(0)|format_compact), subtitle="New (non-cached)", icon='' ) }} {{ stat_card( label="Output Tokens", value=(tokens.output_tokens|default(0)|format_compact), icon='' ) }} {{ stat_card( label="Total Input*", value=((tokens.input_tokens|default(0) + tokens.cache_creation_tokens|default(0) + tokens.cache_read_tokens|default(0))|format_compact), subtitle="Incl. cache (Portkey)", icon='' ) }} {{ stat_card( label="Cache Reads", value=(tokens.cache_read_tokens|default(0)|format_compact), subtitle=tokens.cache_hit_rate|default(0)|float|round(1)|string + "% hit rate", icon='' ) }} {{ stat_card( label="Total Cost", value="$" + (tokens.total_cost|default(0.0)|float|round(2)|string), subtitle="Saved $" + (tokens.cache_savings|default(0.0)|float|round(2)|string), icon='' ) }}

Pricing note: Costs are calculated using each model's official API pricing. Unrecognized model IDs default to Claude Sonnet 4.5 rates.

{% if models and models.models %}

Usage by Model

Hover columns for details
{% for model in models.models %} {% endfor %}
Model Input Output Cache Write Cache Read Total Input* All Tokens Cost %
{{ model.model_name }}
{{ model.input_tokens|default(0)|format_compact }} {{ model.output_tokens|default(0)|format_compact }} {{ model.cache_creation_tokens|default(0)|format_compact }} {{ model.cache_read_tokens|default(0)|format_compact }} {{ (model.input_tokens|default(0) + model.cache_creation_tokens|default(0) + model.cache_read_tokens|default(0))|format_compact }} {{ model.total_tokens|default(0)|format_compact }} ${{ model.cost|default(0.0)|float|round(2) }}
{{ model.cost_percentage|default(0)|float|round(1) }}%
* Total Input = Input + Cache Write + Cache Read tokens. This metric matches how Portkey and other LLM observability tools typically count input tokens.
{% endif %}

Cost Breakdown

Input Cost ${{ tokens.input_cost|default(0.0)|float|round(4) }}
Output Cost ${{ tokens.output_cost|default(0.0)|float|round(4) }}
Cache Creation Cost ${{ tokens.cache_creation_cost|default(0.0)|float|round(4) }}
Cache Read Cost ${{ tokens.cache_read_cost|default(0.0)|float|round(4) }}
Total Cost ${{ tokens.total_cost|default(0.0)|float|round(2) }}

Token Details

Cache Creation {{ tokens.cache_creation_tokens|default(0)|int }}
Cache Reads {{ tokens.cache_read_tokens|default(0)|int }}
Cache Hit Rate {{ tokens.cache_hit_rate|default(0)|float|round(1) }}%
Cache Savings ${{ tokens.cache_savings|default(0.0)|float|round(2) }}