{# Mirrors governor_web/templates/settings/llm.html. Audit persists the API key to the loopback-only ~/.governor-audit/config.json (mode 0600); the GEMINI_API_KEY env var remains a fallback for headless / CI use. #} {% extends "settings/layout.html" %} {% block settings_content %}

AI / LLM

Configure the language model used for the best-practices review on the top-N most expensive jobs.

{% if errors and errors.get('_general') %}
{{ errors['_general'] }}
{% endif %} {% if saved %}
Settings saved.
{% endif %}
{# Provider - read-only display + persisted-or-env status #}

Provider

{% if api_key_set %}

Configured

{% else %}

Not configured

{% endif %}
{# API Key - persisted to config.json (0600). Env var still works as fallback. #}

API Key

{% if api_key_masked %}

Current key: {{ api_key_masked }}

{% endif %}

Stored in ~/.governor-audit/config.json (file mode 0600). Falls back to GEMINI_API_KEY when unset.

{# Model Configuration. Dropdowns are driven by ``llm_models`` (a provider → [model_ids] map served from chat/pricing.KNOWN_RATES). The inline script below filters options whenever the provider changes, and preserves any saved value that isn't in the current catalogue (e.g. a legacy pinned model) as a one-off option so the user's existing selection still renders. #}

Model Configuration

Used for generating best-practices findings.

Used for classification + lighter calls.

{# Provider → model catalogue. Rendered as JSON in a script tag so Jinja escaping is unambiguous; the filter script reads it via textContent + JSON.parse rather than embedding raw JS literals. #} {# Advanced settings — collapsed by default. Parameters and Review Scope are seldom changed after the first run, so they sit behind a click; the most-edited fields above stay above the fold. Native
/ means no JS surface for the toggle. #} {# Parameters #}

Parameters

{# Audit-specific scope: top N + min confidence #}

Review Scope

Bounds LLM cost per scan.

Findings below this score are dropped.

{% endblock %}