Expand description
Model catalog — aliases with direct model pinning and optional discovery filters, dependency-tree config merge, and models cache lifecycle.
Model aliases map short names (opus, sonnet, codex) to concrete model IDs. Two modes:
- Pinned: explicit model ID, with optional
match/excludediscovery filters. - AutoResolve: pattern-based resolution against a cached model catalog.
Merge precedence: consumer > deps (declaration order).
Re-exports§
pub use availability::ModelAvailability;
Modules§
Structs§
- Cached
Model - A single model entry in the cache.
- Model
Alias - A model alias — either pinned to a specific model ID or auto-resolved against the models cache at resolution time.
- Models
Cache - Cached model catalog from external API.
- Resolved
Alias - Fully resolved model alias — everything a consumer needs to launch.
- Resolved
DepModels - Info about a resolved dependency’s model config.
Enums§
- Harness
Source - How the harness was determined.
- Model
Spec - How a model alias resolves to a concrete model ID.
- Refresh
Mode - Refresh
Outcome
Functions§
- auto_
resolve - Resolve an auto-resolve spec against the models cache.
- auto_
resolve_ all - Resolve an auto-resolve spec against the models cache.
- builtin_
aliases - Minimal builtin aliases so common model names work out of the box. No descriptions — packages layer those on top. Precedence: consumer > deps > builtins.
- ensure_
fresh - fetch_
models - Fetch models from the models.dev API.
- filter_
by_ visibility - Filter resolved aliases by visibility config.
- glob_
match - Simple glob matching:
*matches any sequence of characters. Everything else is literal. Case-sensitive. - infer_
provider_ from_ model_ id - Best-effort provider inference from model ID prefixes. Returns None for unrecognized patterns.
- is_
mars_ offline - load_
models_ cache_ ttl - matches_
visibility_ pattern - Match a visibility pattern against a resolved model identity.
- merge_
model_ config - Merge model aliases from dependency tree.
- now_
unix_ secs - now_
unix_ secs_ value - read_
cache - Read models cache from
.mars/models-cache.json. - resolve_
all - Resolve all aliases to concrete model IDs + harnesses.
- resolve_
one - Resolve a single alias and emit diagnostics only for that alias.
- resolve_
refresh_ mode - resolve_
with_ alias_ prefix - Resolve an input like
opus-4-6by matching it against alias filter candidates. - write_
cache - Write models cache to
.mars/models-cache.json(atomic via tmp+rename).