{# Plan 61/2b W2 — "Spend" tab body of /admin/llm. Hosts the legacy spend cockpit chrome (totals / by-provider / timeline / by-model / by-fleet / errors / live-tail) plus a new "By machine" sub-tab from per-machine-spend.md (D3). The sub-tab switcher mirrors the existing dashboard cards: By model / By fleet / By machine / By key. The first two stay rendered as the pre-existing tables; the new "By machine" panel hits a new endpoint and degrades gracefully when the W1 schema migration hasn't landed yet. #} {% from 'admin/components/ui.html' import card, page_header, tooltip, pagination %}

Spend cockpit

Server-wide ledger across all fleets. Auto-refreshes every 30s (live tail every 5s).

cached
{% include 'admin/components/spend/_totals_cards.html' %}
{% include 'admin/components/spend/_by_provider_chart.html' %}
{% include 'admin/components/spend/_timeline_chart.html' %}
{# Sub-tab switcher: model / fleet / machine / key. Plan 61/2b W2 — "machine" is new. "key" is a placeholder for a future drill-down (resolver attributes each request to a key id; the data is there, the UI isn't yet). #}
{% include 'admin/components/spend/_by_model_table.html' %}
{% include 'admin/components/spend/_by_fleet_table.html' %}
{% include 'admin/components/llm/_by_machine_table.html' %}

Per-key attribution is logged but the breakdown table is not yet wired. Filed as a follow-up in plan 61/2b.

{% include 'admin/components/spend/_errors_strip.html' %} {% include 'admin/components/spend/_live_tail.html' %}