Skip to main content

Module models

Module models 

Source
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/exclude discovery filters.
  • AutoResolve: pattern-based resolution against a cached model catalog.

Merge precedence: consumer > deps (declaration order).

Re-exports§

pub use availability::ModelAvailability;

Modules§

availability
harness
harness_model
probes

Structs§

CachedModel
A single model entry in the cache.
ModelAlias
A model alias — either pinned to a specific model ID or auto-resolved against the models cache at resolution time.
ModelsCache
Cached model catalog from external API.
ModelsRefreshControl
Catalog + harness probe refresh intent from CLI flags.
ResolvedAlias
Fully resolved model alias — everything a consumer needs to launch.
ResolvedDepModels
Info about a resolved dependency’s model config.

Enums§

HarnessSource
How the harness was determined.
ModelSpec
How a model alias resolves to a concrete model ID.
RefreshMode
RefreshOutcome

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.
catalog_model_slugs
Provider/model slugs from the models.dev catalog for harness routing comparisons.
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_all_with_probe
resolve_model_id_for_alias
Resolve a concrete model id for one alias.
resolve_models_refresh_control
resolve_one
Resolve a single alias and emit diagnostics only for that alias.
resolve_one_with_probe
resolve_provider_for_alias
Resolve provider identity for one alias.
resolve_refresh_mode
resolve_with_alias_prefix
Resolve an input like opus-4-6 by matching it against alias filter candidates.
resolve_with_alias_prefix_with_probe
split_provider_constrained_model_token
Split a token shaped like provider/model into (model, provider_constraint).
write_cache
Write models cache to .mars/models-cache.json (atomic via tmp+rename).