| Name | Type |
|---|---|
| default_model | str | None |
| recent_model | str | None |
| providers | Mapping[str, ProviderConfig] |
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().
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.
Check whether a provider should appear in the model switcher.
A provider is disabled when its config explicitly sets
enabled = false. Providers not present in the config file are
always considered enabled.
Get all models as (model_name, provider_name) tuples.
Returns raw config data — does not filter by is_provider_enabled.
For the filtered set shown in the model switcher, use
get_available_models().
Find the provider that contains this model.
Returns raw config data — does not filter by is_provider_enabled.
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 the configured base URL for a provider.
Resolution order (first match wins):
base_url in the provider's config.toml section.resolve_env_var, so
DEEPAGENTS_CODE_{VAR} beats the plain {VAR} — mirroring how API
keys resolve. This also surfaces the value apply_stored_credentials
bridged in from a /auth credential, and the gateway-provisioned
URL in the default (no-override) case./auth credential. This is the source
for providers that have no base-URL env var (e.g. an OpenAI-
compatible provider like OpenRouter, Groq, or Baseten): step 2 has
no name to read, so the stored endpoint is taken directly. It then
reaches the model as the base_url constructor kwarg via
_get_provider_kwargs, the same path a config.toml literal uses.
For providers that do have an env var, the stored endpoint already
arrives via step 2 (it was bridged onto the env var), so this step
is a redundant — and consistent — fallback.This function only resolves the endpoint; whether it takes effect is a
separate contract owned by the provider's LangChain class. The value is
delivered as the base_url kwarg (see _get_provider_kwargs), which the
OpenAI/Anthropic-compatible classes accept via a Pydantic base_url
alias. A class that names the field differently may silently
ignore base_url — Pydantic models default to extra="ignore" — so for
those the endpoint must be set via params.
A corrupt credential store is treated as "no stored endpoint" rather than propagating, so endpoint resolution never newly raises.
Get the environment variable name for a provider's API key.
Get the environment variable name for a provider's base URL.
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).
Get profile overrides for a provider.
Reads the profile 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).