pub struct Model {
pub id: String,
pub default: bool,
pub context_window: Option<u32>,
pub max_output_tokens: Option<u32>,
pub display_name: Option<String>,
}Expand description
One available model, the canonical projection of a provider list entry (§3).
Ordered position in the returned Vec IS the provider’s suggested order — the
single source the heuristics read, so there is no rank field. default is
CARRIED, not invented: a dialect that flags one sets it; today none does, so it
is false and §4’s first-in-list rule governs — the seam stays so a provider
that DOES flag one needs no code change.
The three metadata fields are the provider-reported facts a harness would else
hand-mirror (model-discovery §3): context_window (input token limit),
max_output_tokens (output limit), display_name (human label). Each is
OPTION-SHAPED and CARRIED, never fabricated — absent stays None (the Usage
zero-vs-unknown principle, AGENTS.md): Google serves all three on its list GET,
Anthropic only display_name, and OpenAI/Ollama none (so those rows stay None;
the empty-set rule — a harness hand-configures only what no provider serves). The
fields are ADDITIVE with serde(default) + skip_serializing_if: an older cache
(id + default only) reads clean to None, and a metadata-less model serializes
byte-identically to the pre-metadata {id,default} shape — the v=1 grows-only
discipline, so --json/the on-disk cache both extend without a version break.
Fields§
§id: String§default: bool§context_window: Option<u32>§max_output_tokens: Option<u32>§display_name: Option<String>