Built-in model metadata catalog used for context budgeting.
This is the default implementation of the Alloy.ModelCatalog behaviour.
It covers the native-provider families (Claude, GPT-5 and GPT-6, Gemini
2.5 and 3.x, and Grok) at the input limit each vendor documents. Anything
else, including models served through Alloy.Provider.OpenAICompat such as
Kimi, Qwen, GLM, Mistral or Gemma, and retired model ids, gets
default_context_window/0 (200,000 tokens).
For other models, implement Alloy.ModelCatalog (a static map, your own
service, or an adapter over llm_db) and
pass the module via the :model_catalog option. Per-run tweaks that don't
warrant a catalog module belong in :model_metadata_overrides; overrides
always win over any catalog.
Summary
Functions
Returns the known context window limit for a model name
(Alloy.ModelCatalog callback).
Returns the known context window limit for a model name, consulting
overrides ahead of the built-in catalog.
Returns the default fallback context window for unknown models.
Returns the context window for model_name from overrides alone,
ignoring the built-in catalog.
Types
@type override_entry() :: pos_integer() | %{ :limit => pos_integer(), optional(:suffix_patterns) => [String.t() | Regex.t()] }
@type overrides() :: %{optional(String.t()) => override_entry()} | [{String.t(), override_entry()}]
Functions
@spec context_window(String.t()) :: pos_integer() | nil
Returns the known context window limit for a model name
(Alloy.ModelCatalog callback).
Returns nil when the model is not in the built-in catalog.
@spec context_window(String.t(), overrides()) :: pos_integer() | nil
Returns the known context window limit for a model name, consulting
overrides ahead of the built-in catalog.
overrides may provide exact-model or family overrides as either:
%{"model-name" => 1_000_000}%{"model-name" => %{limit: 1_000_000, suffix_patterns: ["", ~r/^-+$/]}}
An override without :suffix_patterns on a model the catalog knows also
covers that model's dated snapshots (a suffix starting with a four-digit
stamp, such as -2026-03-05 or -20251001); on an unknown model it is
exact-match only.
Returns nil when the model is not in the current catalog or overrides.
@spec default_context_window() :: pos_integer()
Returns the default fallback context window for unknown models.
@spec override_window(String.t(), overrides()) :: pos_integer() | nil
Returns the context window for model_name from overrides alone,
ignoring the built-in catalog.
Used to apply :model_metadata_overrides ahead of any
Alloy.ModelCatalog implementation. Returns nil when no override
matches.