pub struct ModelProviders {Show 64 fields
pub openai: HashMap<String, OpenAIModelProviderConfig>,
pub azure: HashMap<String, AzureModelProviderConfig>,
pub anthropic: HashMap<String, AnthropicModelProviderConfig>,
pub moonshot: HashMap<String, MoonshotModelProviderConfig>,
pub qwen: HashMap<String, QwenModelProviderConfig>,
pub glm: HashMap<String, GlmModelProviderConfig>,
pub minimax: HashMap<String, MinimaxModelProviderConfig>,
pub zai: HashMap<String, ZaiModelProviderConfig>,
pub doubao: HashMap<String, DoubaoModelProviderConfig>,
pub yi: HashMap<String, YiModelProviderConfig>,
pub hunyuan: HashMap<String, HunyuanModelProviderConfig>,
pub qianfan: HashMap<String, QianfanModelProviderConfig>,
pub baichuan: HashMap<String, BaichuanModelProviderConfig>,
pub openrouter: HashMap<String, OpenRouterModelProviderConfig>,
pub ollama: HashMap<String, OllamaModelProviderConfig>,
pub gemini: HashMap<String, GeminiModelProviderConfig>,
pub gemini_cli: HashMap<String, GeminiCliModelProviderConfig>,
pub bedrock: HashMap<String, BedrockModelProviderConfig>,
pub telnyx: HashMap<String, TelnyxModelProviderConfig>,
pub together: HashMap<String, TogetherModelProviderConfig>,
pub fireworks: HashMap<String, FireworksModelProviderConfig>,
pub groq: HashMap<String, GroqModelProviderConfig>,
pub mistral: HashMap<String, MistralModelProviderConfig>,
pub deepseek: HashMap<String, DeepseekModelProviderConfig>,
pub atomic_chat: HashMap<String, AtomicChatModelProviderConfig>,
pub cohere: HashMap<String, CohereModelProviderConfig>,
pub perplexity: HashMap<String, PerplexityModelProviderConfig>,
pub xai: HashMap<String, XaiModelProviderConfig>,
pub cerebras: HashMap<String, CerebrasModelProviderConfig>,
pub sambanova: HashMap<String, SambanovaModelProviderConfig>,
pub hyperbolic: HashMap<String, HyperbolicModelProviderConfig>,
pub deepinfra: HashMap<String, DeepinfraModelProviderConfig>,
pub huggingface: HashMap<String, HuggingfaceModelProviderConfig>,
pub ai21: HashMap<String, Ai21ModelProviderConfig>,
pub reka: HashMap<String, RekaModelProviderConfig>,
pub baseten: HashMap<String, BasetenModelProviderConfig>,
pub nscale: HashMap<String, NscaleModelProviderConfig>,
pub anyscale: HashMap<String, AnyscaleModelProviderConfig>,
pub nebius: HashMap<String, NebiusModelProviderConfig>,
pub friendli: HashMap<String, FriendliModelProviderConfig>,
pub stepfun: HashMap<String, StepfunModelProviderConfig>,
pub aihubmix: HashMap<String, AihubmixModelProviderConfig>,
pub siliconflow: HashMap<String, SiliconflowModelProviderConfig>,
pub astrai: HashMap<String, AstraiModelProviderConfig>,
pub avian: HashMap<String, AvianModelProviderConfig>,
pub deepmyst: HashMap<String, DeepmystModelProviderConfig>,
pub venice: HashMap<String, VeniceModelProviderConfig>,
pub novita: HashMap<String, NovitaModelProviderConfig>,
pub nvidia: HashMap<String, NvidiaModelProviderConfig>,
pub vercel: HashMap<String, VercelModelProviderConfig>,
pub cloudflare: HashMap<String, CloudflareModelProviderConfig>,
pub ovh: HashMap<String, OvhModelProviderConfig>,
pub copilot: HashMap<String, CopilotModelProviderConfig>,
pub lmstudio: HashMap<String, LmstudioModelProviderConfig>,
pub llamacpp: HashMap<String, LlamacppModelProviderConfig>,
pub sglang: HashMap<String, SglangModelProviderConfig>,
pub vllm: HashMap<String, VllmModelProviderConfig>,
pub osaurus: HashMap<String, OsaurusModelProviderConfig>,
pub litellm: HashMap<String, LitellmModelProviderConfig>,
pub lepton: HashMap<String, LeptonModelProviderConfig>,
pub synthetic: HashMap<String, SyntheticModelProviderConfig>,
pub opencode: HashMap<String, OpencodeModelProviderConfig>,
pub kilocli: HashMap<String, KiloCliModelProviderConfig>,
pub custom: HashMap<String, CustomModelProviderConfig>,
}Expand description
Typed model provider container — one slot per canonical model_provider type.
Replaces the HashMap<String, HashMap<String, ModelProviderConfig>>
with a typed struct so each family’s per-alias map carries its own
typed config (with the family’s *Endpoint enum and family-specific
extras visible at the type level).
TOML shape is preserved byte-identical: each named field deserializes
from the same [model_providers.<type>.<alias>] block as before.
Adding a new model_provider family means: define the typed config in
schema.rs, then add one row to for_each_model_provider_slot! —
every helper picks up the new slot automatically.
Fields§
§openai: HashMap<String, OpenAIModelProviderConfig>§azure: HashMap<String, AzureModelProviderConfig>§anthropic: HashMap<String, AnthropicModelProviderConfig>§moonshot: HashMap<String, MoonshotModelProviderConfig>§qwen: HashMap<String, QwenModelProviderConfig>§glm: HashMap<String, GlmModelProviderConfig>§minimax: HashMap<String, MinimaxModelProviderConfig>§zai: HashMap<String, ZaiModelProviderConfig>§doubao: HashMap<String, DoubaoModelProviderConfig>§yi: HashMap<String, YiModelProviderConfig>§hunyuan: HashMap<String, HunyuanModelProviderConfig>§qianfan: HashMap<String, QianfanModelProviderConfig>§baichuan: HashMap<String, BaichuanModelProviderConfig>§openrouter: HashMap<String, OpenRouterModelProviderConfig>§ollama: HashMap<String, OllamaModelProviderConfig>§gemini: HashMap<String, GeminiModelProviderConfig>§gemini_cli: HashMap<String, GeminiCliModelProviderConfig>§bedrock: HashMap<String, BedrockModelProviderConfig>§telnyx: HashMap<String, TelnyxModelProviderConfig>§together: HashMap<String, TogetherModelProviderConfig>§fireworks: HashMap<String, FireworksModelProviderConfig>§groq: HashMap<String, GroqModelProviderConfig>§mistral: HashMap<String, MistralModelProviderConfig>§deepseek: HashMap<String, DeepseekModelProviderConfig>§atomic_chat: HashMap<String, AtomicChatModelProviderConfig>§cohere: HashMap<String, CohereModelProviderConfig>§perplexity: HashMap<String, PerplexityModelProviderConfig>§xai: HashMap<String, XaiModelProviderConfig>§cerebras: HashMap<String, CerebrasModelProviderConfig>§sambanova: HashMap<String, SambanovaModelProviderConfig>§hyperbolic: HashMap<String, HyperbolicModelProviderConfig>§deepinfra: HashMap<String, DeepinfraModelProviderConfig>§huggingface: HashMap<String, HuggingfaceModelProviderConfig>§ai21: HashMap<String, Ai21ModelProviderConfig>§reka: HashMap<String, RekaModelProviderConfig>§baseten: HashMap<String, BasetenModelProviderConfig>§nscale: HashMap<String, NscaleModelProviderConfig>§anyscale: HashMap<String, AnyscaleModelProviderConfig>§nebius: HashMap<String, NebiusModelProviderConfig>§friendli: HashMap<String, FriendliModelProviderConfig>§stepfun: HashMap<String, StepfunModelProviderConfig>§aihubmix: HashMap<String, AihubmixModelProviderConfig>§siliconflow: HashMap<String, SiliconflowModelProviderConfig>§astrai: HashMap<String, AstraiModelProviderConfig>§avian: HashMap<String, AvianModelProviderConfig>§deepmyst: HashMap<String, DeepmystModelProviderConfig>§venice: HashMap<String, VeniceModelProviderConfig>§novita: HashMap<String, NovitaModelProviderConfig>§nvidia: HashMap<String, NvidiaModelProviderConfig>§vercel: HashMap<String, VercelModelProviderConfig>§cloudflare: HashMap<String, CloudflareModelProviderConfig>§ovh: HashMap<String, OvhModelProviderConfig>§copilot: HashMap<String, CopilotModelProviderConfig>§lmstudio: HashMap<String, LmstudioModelProviderConfig>§llamacpp: HashMap<String, LlamacppModelProviderConfig>§sglang: HashMap<String, SglangModelProviderConfig>§vllm: HashMap<String, VllmModelProviderConfig>§osaurus: HashMap<String, OsaurusModelProviderConfig>§litellm: HashMap<String, LitellmModelProviderConfig>§lepton: HashMap<String, LeptonModelProviderConfig>§synthetic: HashMap<String, SyntheticModelProviderConfig>§opencode: HashMap<String, OpencodeModelProviderConfig>§kilocli: HashMap<String, KiloCliModelProviderConfig>§custom: HashMap<String, CustomModelProviderConfig>Implementations§
Source§impl ModelProviders
impl ModelProviders
Sourcepub fn configurable_prefix() -> &'static str
pub fn configurable_prefix() -> &'static str
Returns the #[prefix] value for this Configurable struct.
Sourcepub fn secret_fields(&self) -> Vec<SecretFieldInfo>
pub fn secret_fields(&self) -> Vec<SecretFieldInfo>
Returns metadata about all #[secret] fields on this struct and nested children.
Sourcepub fn secret_field_terminals() -> Vec<&'static str>
pub fn secret_field_terminals() -> Vec<&'static str>
Static enumeration of every #[secret] field’s terminal name
(snake_case, matching the on-disk TOML key) reachable from
this type via #[nested] traversal. Unlike secret_fields(),
this requires no instance — the per-struct codegen literals
are joined at call time with recursive calls into the inner
types’ own secret_field_terminals().
Used by the migration crate’s raw-TOML encrypt walker as the
secret-key allowlist. prop_fields()-derived allowlists skip
compound (non-Vec) #[secret] fields, so this method is the
authoritative source.
Sourcepub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
pub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
Encrypt all secret fields in place using the provided store.
Sourcepub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
pub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
Decrypt all secret fields in place using the provided store.
Sourcepub fn set_secret(&mut self, name: &str, value: String) -> Result<(), Error>
pub fn set_secret(&mut self, name: &str, value: String) -> Result<(), Error>
Set a secret field by its full dotted name, dispatching to nested children.
Sourcepub fn prop_fields(&self) -> Vec<PropFieldInfo>
pub fn prop_fields(&self) -> Vec<PropFieldInfo>
Returns metadata about all property fields on this struct and nested children.
Sourcepub fn get_prop(&self, name: &str) -> Result<String, Error>
pub fn get_prop(&self, name: &str) -> Result<String, Error>
Get a property value by its full dotted name, returning it as a display string.
Sourcepub fn set_prop(&mut self, name: &str, value_str: &str) -> Result<(), Error>
pub fn set_prop(&mut self, name: &str, value_str: &str) -> Result<(), Error>
Set a property value by its full dotted name, parsing from string.
Sourcepub fn prop_is_secret(name: &str) -> bool
pub fn prop_is_secret(name: &str) -> bool
Check if a property name refers to a secret field (static, no instance needed).
Sourcepub fn init_defaults(&mut self, prefix: Option<&str>) -> Vec<&'static str>
pub fn init_defaults(&mut self, prefix: Option<&str>) -> Vec<&'static str>
Instantiate None nested sections whose prefix matches.
Returns the prefixes that were initialized.
Sourcepub fn map_key_sections() -> Vec<MapKeySection>
pub fn map_key_sections() -> Vec<MapKeySection>
Enumerate every map-keyed (HashMap<String, T>) and list-shaped
(Vec<T>) section discoverable from this Configurable’s tree.
The dashboard / CLI consume this to surface “+ Add” affordances
without hardcoding the section list.
Sourcepub fn nested_section_help(name: &str) -> Option<&'static str>
pub fn nested_section_help(name: &str) -> Option<&'static str>
Help blurb for a #[nested] field on this struct, sourced from
the field-level /// docstring. Returns None for unknown
names so callers can fall through to a different lookup.
Sourcepub fn get_map_keys(&self, section_path: &str) -> Option<Vec<String>>
pub fn get_map_keys(&self, section_path: &str) -> Option<Vec<String>>
Return the current alias keys at section_path, or None if
the path doesn’t resolve to a map-keyed section in this tree.
Sourcepub fn nested_option_entries(&self) -> Vec<NestedOptionEntry>
pub fn nested_option_entries(&self) -> Vec<NestedOptionEntry>
Snapshot of every #[nested] Option<T> field on this struct
as (field_name, is_some) tuples, in declaration order.
field_name is the raw Rust ident (snake_case) — consumers
can map to display names via their own table. The schema
is the single source of truth: adding a new
pub foo: Option<FooConfig> field with #[nested] surfaces
here without touching any caller.
Sourcepub fn create_map_key(
&mut self,
section_path: &str,
map_key: &str,
) -> Result<bool, String>
pub fn create_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>
Insert a default-valued entry under a map-keyed section, or
append to a list-shaped one, with map_key as the new entry’s
natural identifier (HashMap key for Map sections; identifier
field for List sections).
Returns Ok(true) if a new entry was created, Ok(false) if
the entry already existed (idempotent), or Err(reason) if
the section path doesn’t resolve to a Map/List in this tree.
Sourcepub fn delete_map_key(
&mut self,
section_path: &str,
map_key: &str,
) -> Result<bool, String>
pub fn delete_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>
Remove the entry identified by map_key from the map-keyed
section at section_path.
Returns Ok(true) if the entry existed and was removed,
Ok(false) if it didn’t exist, or Err(reason) if the
section path doesn’t resolve.
Sourcepub fn rename_map_key(
&mut self,
section_path: &str,
map_key: &str,
new_key: &str,
) -> Result<bool, String>
pub fn rename_map_key( &mut self, section_path: &str, map_key: &str, new_key: &str, ) -> Result<bool, String>
Rename map_key to new_key within the map-keyed section at
section_path, preserving the entry’s value.
Returns Ok(true) if renamed, Ok(false) if map_key didn’t
exist, or Err(reason) if new_key already exists or the
section path doesn’t resolve.
Source§impl ModelProviders
impl ModelProviders
Sourcepub fn iter_entries(
&self,
) -> impl Iterator<Item = (&'static str, &str, &ModelProviderConfig)>
pub fn iter_entries( &self, ) -> impl Iterator<Item = (&'static str, &str, &ModelProviderConfig)>
Iterate every entry across every typed slot, yielding
(provider_type, alias, &base) triples. Use this when consumer code
needs to walk every model model_provider entry without caring about family.
Materializes through a Vec rather than chaining iterators directly:
with ~60 typed slots the deeply-nested Chain<Chain<...>> type blows
up rustc’s Freeze trait-resolution recursion limit. The collection
cost is negligible (entries are sparse — most slots are empty in any
real config). Returned as impl Iterator so call sites can chain
.next(), .filter_map(), etc. without changes.
Sourcepub fn iter_entries_mut(
&mut self,
) -> impl Iterator<Item = (&'static str, &str, &mut ModelProviderConfig)>
pub fn iter_entries_mut( &mut self, ) -> impl Iterator<Item = (&'static str, &str, &mut ModelProviderConfig)>
Iterate every entry mutably across every typed slot.
Sourcepub fn resolved_endpoint_uri(
&self,
family: &str,
alias: &str,
) -> Option<&'static str>
pub fn resolved_endpoint_uri( &self, family: &str, alias: &str, ) -> Option<&'static str>
Resolve the family-default endpoint URI for <family>.<alias>. Returns
None when the family is single-endpoint, unknown, or the alias is
missing. Dispatch is generated by for_each_model_provider_slot!, so
adding a family without a FamilyEndpoint impl is a compile error.
Sourcepub fn find(&self, family: &str, alias: &str) -> Option<&ModelProviderConfig>
pub fn find(&self, family: &str, alias: &str) -> Option<&ModelProviderConfig>
Look up the shared base config for a given <provider_type>.<alias>
pair. Returns None when the family isn’t recognized OR when
the alias doesn’t exist in that family’s typed slot.
Sourcepub fn ensure(
&mut self,
family: &str,
alias: &str,
) -> Option<&mut ModelProviderConfig>
pub fn ensure( &mut self, family: &str, alias: &str, ) -> Option<&mut ModelProviderConfig>
Get-or-create the shared base config for a <provider_type>.<alias>
pair, returning a mutable reference. Used by tools that mutate
generic baseline fields (model, temperature, api_key) without caring
about the family’s specific extras. Returns None for unknown
model_provider types.
Sourcepub fn contains_model_provider_type(&self, family: &str) -> bool
pub fn contains_model_provider_type(&self, family: &str) -> bool
True when family’s typed slot has at least one configured
alias entry. Returns false for unknown families.
Sourcepub fn aliases_of<'a>(
&'a self,
family: &str,
) -> Box<dyn Iterator<Item = &'a str> + 'a>
pub fn aliases_of<'a>( &'a self, family: &str, ) -> Box<dyn Iterator<Item = &'a str> + 'a>
Iterate the alias keys for a given model_provider type. Returns an empty iterator for unknown model_provider types.
Sourcepub fn remove_alias(&mut self, family: &str, alias: &str) -> bool
pub fn remove_alias(&mut self, family: &str, alias: &str) -> bool
Remove the entry for <provider_type>.<alias>, returning whether it
existed. Returns false for unknown families.
Trait Implementations§
Source§impl Clone for ModelProviders
impl Clone for ModelProviders
Source§fn clone(&self) -> ModelProviders
fn clone(&self) -> ModelProviders
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelProviders
impl Debug for ModelProviders
Source§impl Default for ModelProviders
impl Default for ModelProviders
Source§fn default() -> ModelProviders
fn default() -> ModelProviders
Source§impl<'de> Deserialize<'de> for ModelProviders
impl<'de> Deserialize<'de> for ModelProviders
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelProviders, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelProviders, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ModelProviders
impl JsonSchema for ModelProviders
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl MaskSecrets for ModelProviders
impl MaskSecrets for ModelProviders
fn mask_secrets(&mut self)
fn restore_secrets_from(&mut self, current: &ModelProviders)
Source§impl Serialize for ModelProviders
impl Serialize for ModelProviders
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for ModelProviders
impl RefUnwindSafe for ModelProviders
impl Send for ModelProviders
impl Sync for ModelProviders
impl Unpin for ModelProviders
impl UnsafeUnpin for ModelProviders
impl UnwindSafe for ModelProviders
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more