{# P4-T13 / P4-T19 — LLM model create + edit form (one template, two modes). Mirrors the admin CRUD form shape (admin_templates.html "add new" card). Inputs (see renderers/admin_llm_models.render_admin_llm_model_edit): * is_edit — True for edit (pre-filled, posts to .../{id}), False for create (empty, posts to /admin/llm-models). * model — column dict (empty {} on create). Prices are Decimal-stringified ("15.000000") or None; dates are ISO strings or None. * stats — ModelUsageStats on edit (read-only impact panel). * pins / is_pinned / pin_summary — archive safeguard (P4-T18): a pinned model's Archive button is disabled with a tooltip listing the pins. * provider_choices — known provider keys for the
identity
pricing usd per 1M tokens

All prices are USD per 1,000,000 tokens. Leave a field blank to store NULL (renders as — on the list). Two cache shapes coexist: OpenAI / xAI use a single auto-discounted cached_input; Anthropic uses explicit cache_read + cache_write. Populate only the keys the vendor actually bills.

capabilities & flags
{# Each box pairs a hidden "0" companion placed AFTER the checkbox. The form parser keeps the FIRST value per key, so when the box is checked the "1" wins; when unchecked only the hidden "0" submits. Net: unchecking a box on edit persists as False instead of "leave unchanged". #}
{% if is_edit %} {% else %} {% endif %} cancel
{% if is_edit %}
archive
{% if is_pinned %}
// archive blocked — this model is pinned by: {{ pin_summary }}. Unset the env var(s) (or change DEFAULT_MODEL) before archiving, otherwise downstream callers would break.
{{ tip("Archive is disabled while a pin holds this model: " ~ pin_summary ~ ". The list page also shows a 'pinned' pill.") }} {% else %}

Archiving sets is_active=false + is_discontinued=true + discontinued_at=today. The row stays in the DB (historical llm_calls still join); it just stops being routed. Restore from the list.

{% endif %}
{% endif %}