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;
const PUBLIC_MODEL_LISTING: bool = false;
// Provided methods
fn wire_api(&self) -> Option<WireApi> { ... }
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).
Sourceconst PUBLIC_MODEL_LISTING: bool = false
const PUBLIC_MODEL_LISTING: bool = false
Whether this provider’s /models endpoint is accessible without an
API key. When true, list_models() and list_models_with_pricing()
will query the live endpoint even when no credential is configured.
Defaults to false; set to true for providers like Kilo Gateway
whose model catalog is public.
Provided Methods§
Sourcefn wire_api(&self) -> Option<WireApi>
fn wire_api(&self) -> Option<WireApi>
Wire protocol selector for this entry, when the family reads it from
per-alias config. Defaults to None so families that only speak
chat_completions need no override.
A family whose endpoint can serve the responses wire MUST override this
to return self.base.wire_api; otherwise a user’s
wire_api = "responses" is silently ignored and routed through
chat_completions. The blanket create_provider consults this before
building the compat client.
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.
Implementations on Foreign Types§
Source§impl CompatFamilySpec for AtomicChatModelProviderConfig
impl CompatFamilySpec for AtomicChatModelProviderConfig
Source§const DEFAULT_URL: &'static str = "http://127.0.0.1:1337/v1"
const DEFAULT_URL: &'static str = "http://127.0.0.1:1337/v1"
Default endpoint for the Jan / Atomic Chat local OpenAI-compatible
runtime (jan.ai). Operators override via api_url on the alias
entry when they run it on a non-default port.