Skip to main content

Module models

Module models 

Source
Expand description

Model catalog — two-mode aliases (pinned + auto-resolve), 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, no resolution needed.
  • AutoResolve: pattern-based resolution against a cached model catalog.

Merge precedence: consumer > deps (declaration order).

Modules§

harness

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.
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.
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.
is_mars_offline
load_models_cache_ttl
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_refresh_mode
write_cache
Write models cache to .mars/models-cache.json (atomic via tmp+rename).