Expand description
Static vendor preset catalog, embedded at compile time.
Structs§
- Model
Pricing Spec - Per-million-token pricing embedded in a provider preset model entry. USD.
- Model
Spec - A single model entry within a provider preset.
- Provider
Preset - Written
Preset - Result of writing a user override preset — returned to the caller so
recursive initandrecursive providers addcan show the user exactly where the file landed and what was written.
Functions§
- additional_
presets - User-supplied presets loaded from
<user_data_dir>/providers.d/*.toml. Returned in stable order (lexicographic by file name so unit tests can pin a specific order). - all_
presets - all_
presets_ dynamic - All presets: bundled + user overrides from
providers.d/. Returns an ownedVecbecause user overrides are loaded at runtime, not at compile time, so we cannot hand back&'staticreferences. Usefind_preset_extendedwhen you only need to look one up. - all_
presets_ effective - All presets: remote cache + bundled +
providers.d/. Returns an ownedVecbecause the cache and user overrides are loaded at runtime. Usefind_preset_effective/find_model_pricing_effectivewhen you only need to look one up. - bundled_
presets - Bundled presets only. Same data as
all_presets— kept as a separate function so call sites that need only the compile-time catalog can spell that intent out and avoid the disk-touchingadditional_presetswork. Implemented as a thin alias so the OnceLock /expectsite stays inall_presets(its pre-Goal-254 home) and does not show up as a newexpectin the Goal 254 diff. - find_
model_ pricing - Look up pricing for a model name across all presets.
Returns
Noneif the model is not listed or has no pricing field. - find_
model_ pricing_ effective - Look up pricing for a model name across the effective catalog
(remote cache + bundled +
providers.d/). This is the path used bypricing_forso per-token cost reflects upstream catalog refreshes, not just the compile-timeproviders.toml. Owned result. - find_
preset - find_
preset_ by_ api_ base - Look up a preset by its API base URL. Used to recover the preset id
from a config file that only stores
api_base(e.g.recursive config show) and to pick sensible defaults in the manual branch ofrecursive initinstead of guessing the model from URL substrings. - find_
preset_ effective - Look up a preset by id in the effective catalog (remote cache +
bundled +
providers.d/). Owned result, since the effective catalog is a runtime-mergedVec. - find_
preset_ extended - Look up a preset by id in the extended catalog (bundled +
user overrides). Preserves the strict, compiled-catalog-only
semantics of
find_presetfor callers that depend on it (e.g.Config::from_envrejecting unknown preset ids at startup). - write_
user_ preset - Serialize
presetto TOML and write it to<user_data_dir>/providers.d/<id>.toml. Creates the directory if missing. Used byrecursive init’s “save as reusable preset?” path (init.rs) and byrecursive providers addso the persistence surface lives in one place rather than being reimplemented at each caller.