Parsed model configuration from config.toml.
Instances are immutable once constructed. The providers mapping is
wrapped in MappingProxyType to prevent accidental mutation of the
globally cached singleton returned by load().
ModelConfig(
self,
default_model: str | None = None,
recent_model: str | None = None,
providers: Mapping[str, ProviderConfig] = dict()
)| Name | Type |
|---|---|
| default_model | str | None |
| recent_model | str | None |
| providers | Mapping[str, ProviderConfig] |
The user's intentional default model (from config file [models].default).
The most recently switched-to model (from config file [models].recent).
Read-only mapping of provider names to their configurations.
Load config from file.
When called with the default path, results are cached for the
lifetime of the process. Use clear_caches() to reset.
Get all models as (model_name, provider_name) tuples.
Find the provider that contains this model.
Check if credentials are available for a provider.
This is the config-file-driven credential check, supporting custom
providers (e.g., local Ollama with no key required). For the hardcoded
PROVIDER_API_KEY_ENV-based check used in the hot-swap path, see the
module-level has_provider_credentials().
Get custom base URL.
Get the environment variable name for a provider's API key.
Get the custom class path for a provider.
Get extra constructor kwargs for a provider.
Reads the params table from the provider config. Flat keys are
provider-wide defaults; model-keyed sub-tables are per-model
overrides that shallow-merge on top (model wins on conflict).