{# P4-T12 / P4-T19 — LLM models registry list page. Mirrors the admin CRUD list shape (admin_users.html / admin_templates.html) and the "04.1 — ADMIN / LLM MODELS" mockup in html_docs/admin-ui-rebuild-plan.html: company / model_id / version / flag pills / prices / 30-day usage counts / status / edit CTA, plus a provider-pill filter row and a "+ add model" button. Inputs (see renderers/admin_llm_models.py): * rows — one dict per model with LlmModel columns plus ``stats`` (ModelUsageStats), ``pins`` (list of pin dicts), ``pin_summary``. * filter_provider / filter_status / filter_frontier_only / filter_reasoning_only — current filter state (for active pill + toggle hrefs). * just_created / just_updated / just_archived / just_restored — flash. Prices arrive as Decimal-stringified values ("15.000000") or None; the ``_price`` macro renders ``$15.00`` or an em-dash. The usage stats are computed once per request in the route (usage_stats_for_all_models) — no N+1 here. #} {% from 'partials/help_tooltip.html' import tip, tip_styles %} llm models — browser-recon admin {% include 'partials/admin_t55_styles.html' %} {{ tip_styles() }} {% include 'partials/admin_t55_chrome.html' %}
{%- set active_count = rows | selectattr('is_active') | list | length -%} {%- set archived_count = rows | rejectattr('is_active') | list | length -%} {# Bold the single most-used model (highest calls_30d, ties -> first). #} {%- set top_calls = (rows | map(attribute='stats.calls_30d') | list | max) if rows else 0 -%}
04.1 — admin / llm models

LLM Models registry.

{{ active_count }} active · {{ archived_count }} archived · {{ rows | length }} shown under the current filters

{% if just_created %}
[ok]// model {{ just_created }} created
{% endif %} {% if just_updated %}
[ok]// model {{ just_updated }} updated
{% endif %} {% if just_archived %}
[ok]// model {{ just_archived }} archived
{% endif %} {% if just_restored %}
[ok]// model {{ just_restored }} restored
{% endif %} {% if assigned %}
[ok]// model assignment updated for {{ assigned }}
{% endif %} {# ── FILTERS ──────────────────────────────────────────────── #} {%- macro flink(label, params, active) -%} {{ label }} {%- endmacro -%} {%- set ff = filter_frontier_only -%} {%- set fr = filter_reasoning_only -%} {# ── TABLE ────────────────────────────────────────────────── #} {%- macro price(value) -%} {%- if value is none or value == '' -%} {%- else -%} ${{ '%0.2f' % (value | float) }} {%- endif -%} {%- endmacro -%}
registry {{ rows | length }} rows
{% if not rows %}
// no models match the current filters.
{% else %} {% for row in rows %} {%- set s = row.stats -%} {%- set dim = not row.is_active -%} {% endfor %}
company {{ tip("Vendor / lab that ships the model. Display-only grouping.") }} model id {{ tip("SDK identifier (e.g. claude-opus-4-7). Unique; the join key the resolver and llm_calls use.") }} ver {{ tip("Human version label (e.g. 4.7 or 2025-01). Free text, optional.") }} flags {{ tip("F = frontier (top-tier capability). R = reasoning (extended thinking). — = neither.") }} in $/m {{ tip("Input price in USD per 1,000,000 input tokens.") }} out $/m {{ tip("Output price in USD per 1,000,000 output tokens.") }} cache r {{ tip("Cache-read price per 1M tokens. For Anthropic this is cache_read_price_per_million; OpenAI/xAI style cached_input shows here when set.") }} calls 30d {{ tip("Production llm_calls rows for this model in the last 30 days. The most-used model's count is bolded.") }} cost 30d {{ tip("Summed cost_usd from production llm_calls in the last 30 days.") }} tests 30d {{ tip("Admin sandbox experiments + side-by-side evals in the last 30 days.") }} status {{ tip("active = available for routing. discontinued = archived, not routed. pinned = an env var or DEFAULT_MODEL still points here; archive is blocked.") }}
{{ row.company }} {{ row.model_id }} {{ row.version or '—' }} {% if row.is_frontier %}F{% endif %} {% if row.is_reasoning %}R{% endif %} {% if not row.is_frontier and not row.is_reasoning %}{% endif %} {{ price(row.input_price_per_million) }} {{ price(row.output_price_per_million) }} {{ price(row.cache_read_price_per_million or row.cached_input_price_per_million) }} {% if s.calls_30d and s.calls_30d == top_calls %}{{ '{:,}'.format(s.calls_30d) }}{% else %}{{ '{:,}'.format(s.calls_30d) }}{% endif %} ${{ '%0.2f' % (s.cost_30d_usd | float) }} {{ '{:,}'.format(s.tests_30d) }} {% if row.is_discontinued or not row.is_active %} discontinued {% else %} active {% endif %} {% if row.pins %} pinned {% endif %} {% if is_super_admin %} edit {% else %} view {% endif %}
{% endif %}
F frontier R reasoning active available for routing discontinued archived · no longer routed
{# ── PROMPT -> MODEL ASSIGNMENT ───────────────────────────── #} {# One row per assignable pipeline prompt. ``assignments`` is the per-prompt cascade view (effective model + provenance + DB assignment); ``active_model_ids`` is the sorted active-registry list offered in each select. Each row is its own POST form so a single save touches one prompt. Read-only for non-super-admins. #} {%- macro provenance_pill(source) -%} {%- if source == 'assignment' -%} assignment {%- elif source == 'env_prompt' -%} env (per-prompt) {%- elif source == 'env_global' -%} env (global) {%- else -%} default {%- endif -%} {%- endmacro -%}
prompt -> model{{ tip("Which model each pipeline step runs on. Precedence, highest first: DB assignment (set here) -> per-prompt env var (BROWSER_RECON_LLM_MODEL_) -> global env var (BROWSER_RECON_LLM_MODEL) -> built-in default. A DB assignment always wins; the provenance pill shows which tier is currently in effect so a leftover env var overriding your intent is visible.") }} {{ assignments | length }} steps
{% if not assignments %}
// no assignable prompts.
{% else %} {% if is_super_admin %}{% endif %} {% for a in assignments %} {% if is_super_admin %} {% endif %} {% endfor %}
step {{ tip("The pipeline prompt step. The raw prompt_name (the resolver / assignment key) is shown in muted mono beneath the label.", position="bottom") }} effective model {{ tip("The model this step resolves to right now across the full cascade, with a pill showing where that choice came from.", position="bottom") }}assign {{ tip("Pick an active registry model to pin this step to (a DB assignment). Choose '— use env / default —' to clear the assignment and fall back to the env/default cascade.", position="bottom") }}
{{ a.label }} {% if a.legacy %}legacy{% endif %}
{{ a.prompt_name }}
{{ a.effective_model }} {{ provenance_pill(a.source) }}
{% endif %}
{{ provenance_pill('assignment') }} set here (DB) {{ provenance_pill('env_prompt') }} / {{ provenance_pill('env_global') }} from an env var {{ provenance_pill('default') }} built-in DEFAULT_MODEL {% if not is_super_admin %}// read-only · super_admin can assign{% endif %}