pub trait CompatFamilySpec {
const DISPLAY: &'static str;
const DEFAULT_URL: &'static str;
const AUTH: AuthStyle;
const MODELS_DEV_KEY: Option<&'static str> = None;
const OPENROUTER_VENDOR_PREFIX: Option<&'static str> = None;
// Provided methods
fn build_compat_base(
&self,
alias: &str,
key: Option<&str>,
api_url: Option<&str>,
) -> OpenAiCompatibleModelProvider { ... }
fn build_compat(
&self,
alias: &str,
key: Option<&str>,
api_url: Option<&str>,
) -> OpenAiCompatibleModelProvider { ... }
}Expand description
Spec trait for OpenAI-compatible families. Implementing this gives a
FamilyProviderFactory impl for free via the blanket below.
Override CompatFamilySpec::build_compat when the family needs minor
modifiers (e.g. .without_native_tools()); otherwise the default
OpenAiCompatibleModelProvider::new constructor is used.
Required Associated Constants§
Provided Associated Constants§
Sourceconst MODELS_DEV_KEY: Option<&'static str> = None
const MODELS_DEV_KEY: Option<&'static str> = None
models.dev catalog key for this provider, when present in the
public catalog. Lets list_models() pre-populate the model
picker without a credential — the gateway and TUI both surface
the cataloged IDs even before the operator pastes their API key.
Set to None for providers that don’t have a models.dev
entry; their picker stays empty until a credential unlocks the
live /models endpoint, which the dashboard already falls back
to a free-text input for.
Sourceconst OPENROUTER_VENDOR_PREFIX: Option<&'static str> = None
const OPENROUTER_VENDOR_PREFIX: Option<&'static str> = None
OpenRouter vendor prefix used by list_models as a last-resort
fallback when this family has no models.dev entry and no live
credential. None when no OpenRouter prefix exists for this family
(e.g. Sambanova, Hyperbolic — no public catalog at all without a key).
Provided Methods§
Sourcefn build_compat_base(
&self,
alias: &str,
key: Option<&str>,
api_url: Option<&str>,
) -> OpenAiCompatibleModelProvider
fn build_compat_base( &self, alias: &str, key: Option<&str>, api_url: Option<&str>, ) -> OpenAiCompatibleModelProvider
Build the base compat provider with both catalog consts applied. Use
this from inside build_compat overrides so the catalog hooks ride
along with any family-specific modifiers.
Sourcefn build_compat(
&self,
alias: &str,
key: Option<&str>,
api_url: Option<&str>,
) -> OpenAiCompatibleModelProvider
fn build_compat( &self, alias: &str, key: Option<&str>, api_url: Option<&str>, ) -> OpenAiCompatibleModelProvider
Build the underlying compat provider. Default just returns the base
from build_compat_base; override to chain family-specific
modifiers (e.g. .without_native_tools(), .with_merge_system_into_user()).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.