Model Aliases & Runtime Model Override
Define semantic model aliases (fast, smart, local) in a global config file and override models at runtime without editing role YAML files.
Quick start
- Create
~/.initrunner/models.yaml:
aliases:
fast: openai:gpt-4o-mini
smart: anthropic:claude-sonnet-4-6
local: ollama:llama3.2:latest
cheap: groq:llama-3.3-70b-versatile- Use aliases anywhere:
# CLI --model flag
initrunner run role.yaml -p "Summarize this" --model fast
initrunner run --model smart
initrunner run role.yaml --serve --model local
# Environment variable
export INITRUNNER_MODEL=fast
initrunner run role.yaml -p "Summarize this"Aliases are not resolved inside a role file's model block. In a role file, write model: openai:gpt-5-mini or set provider: explicitly. See Role YAML models.
Alias file format
The alias file lives at ~/.initrunner/models.yaml (or $INITRUNNER_HOME/models.yaml):
aliases:
<alias-name>: <provider>:<model-name>Each alias target must contain at least one : separator. Additional colons stay in the model name (e.g. ollama:llama3.2:latest is valid — provider is ollama, model is llama3.2:latest).
Invalid alias targets (missing :) are skipped with a warning.
If the file is missing, empty, or unparseable, no aliases are loaded and everything works via explicit provider:model strings as before.
Runtime model override
The --model flag (or INITRUNNER_MODEL env var) overrides the model defined in the role file. Available on these commands:
| Command | Flag | Env var |
|---|---|---|
run | --model | INITRUNNER_MODEL |
run --daemon | --model | INITRUNNER_MODEL |
run --serve | --model | INITRUNNER_MODEL |
test | --model | INITRUNNER_MODEL |
The flag accepts either an alias name or an explicit provider:model string:
# Alias
initrunner run role.yaml -p "hello" --model fast
# Explicit provider:model
initrunner run role.yaml -p "hello" --model openai:gpt-4oWhen the override is applied, temperature and max_tokens from the original role config are preserved. If the provider changes, base_url and api_key_env are cleared (since they're typically provider-specific).
Precedence
Model resolution follows this order (highest to lowest):
--modelCLI flag /INITRUNNER_MODELenv var- Role YAML
model(aprovider:modelstring, or a mapping with an explicitprovider; aliases are not resolved here) run.yamldefaults (ephemeral mode andnew/flow new/doctor)- API key env-var auto-detection
The --dry-run flag operates at a different layer: the agent is built with the real model (alias/override applied), then TestModel replaces it at runner execution time.
Role YAML models
Aliases are not resolved inside a role YAML model block. Use an alias with --model, INITRUNNER_MODEL, or run.yaml instead.
In a role file, write the model in one of the two forms the loader resolves:
# String shorthand containing a colon
model: openai:gpt-5-mini# Mapping with an explicit provider
model:
provider: openai
name: gpt-5-mini
temperature: 0.3A model mapping with no provider is treated as a partial config. The tuning fields (temperature, max_tokens, context_window, fallback, thinking) are kept, but name is dropped and the provider and model are auto-detected from INITRUNNER_MODEL, run.yaml, or an API key env var. Both of these silently ignore the model you named:
# Wrong: "fast" is dropped, the model is auto-detected
model:
name: fast# Wrong: a colon in "name" is not split when the block is a mapping
model:
name: openai:gpt-4o-miniTo use an alias with a role file, pass it at run time:
initrunner run role.yaml -p "hello" --model fastEphemeral mode aliases
The run command's --model flag and run.yaml model field both support aliases:
# CLI
initrunner run --model fast
# ~/.initrunner/run.yaml
model: fastWhen an alias resolves to provider:model, the provider is extracted automatically — you don't need to specify --provider separately.
Edge cases
| Scenario | Behavior |
|---|---|
Alias not found, no colon in name (--model / INITRUNNER_MODEL) | Error: "Could not resolve provider" |
Role YAML model mapping without provider | name is dropped; provider and model are auto-detected, tuning fields preserved |
--model + --dry-run | Agent built with override model, then TestModel used at execution |
--model openai:gpt-4o (explicit) | Parsed directly, no alias lookup |
--model ollama:llama3.2:latest | Split on first colon: provider=ollama, name=llama3.2:latest |
Role YAML name: fast with explicit provider: openai | Provider already set — no alias resolution, model named "fast" on OpenAI |
Missing/empty models.yaml | No aliases — everything works via explicit provider:model |
| Flow mode | Not affected — each agent uses its own role file |
| Alias-dependent role files | Machine-local; may fail on systems without matching models.yaml |