pub struct ModelSchema {Show 14 fields
pub id: String,
pub name: String,
pub provider: String,
pub family: String,
pub version: String,
pub capabilities: Vec<ModelCapability>,
pub context_length: usize,
pub param_count: String,
pub quantization: Option<String>,
pub performance: PerformanceEnvelope,
pub cost: CostModel,
pub source: ModelSource,
pub tags: Vec<String>,
pub available: bool,
}Expand description
The full declarative schema for a model.
Analogous to ToolSchema — describes what a model is, what it can do,
and how to access it. The router uses this for constraint-based filtering
and cold-start scoring before observed performance data is available.
Fields§
§id: StringUnique identifier: “provider/model-name:variant” (e.g., “qwen/qwen3-4b:q4_k_m”).
name: StringHuman-readable display name.
provider: StringProvider (qwen, openai, anthropic, google, meta, ollama, custom).
family: StringModel family for grouping (qwen3, gpt-4, claude-4, llama-3).
version: StringSemantic version or checkpoint label.
capabilities: Vec<ModelCapability>What this model can do — ordered by primary capability first.
context_length: usizeContext window in tokens.
param_count: StringParameter count as human-readable string (e.g., “4B”, “30B (3B active)”).
quantization: Option<String>Quantization (Q4_K_M, Q8_0, F16, none).
performance: PerformanceEnvelopeDeclared performance envelope (initial estimate, overridden by observed data).
cost: CostModelCost structure.
source: ModelSourceHow to access this model.
Free-form tags for filtering (e.g., “fast”, “multilingual”, “moe”).
available: boolWhether this model is currently available (downloaded / reachable). Not serialized — computed at runtime.
Implementations§
Source§impl ModelSchema
impl ModelSchema
Sourcepub fn has_capability(&self, cap: ModelCapability) -> bool
pub fn has_capability(&self, cap: ModelCapability) -> bool
Check if this model has a given capability.
Sourcepub fn ram_mb(&self) -> u64
pub fn ram_mb(&self) -> u64
Get the RAM requirement in MB (from cost model, falls back to size_mb).
Sourcepub fn cost_per_1k_output(&self) -> f64
pub fn cost_per_1k_output(&self) -> f64
Estimated cost per 1K output tokens in USD. Returns 0.0 for local models.
Trait Implementations§
Source§impl Clone for ModelSchema
impl Clone for ModelSchema
Source§fn clone(&self) -> ModelSchema
fn clone(&self) -> ModelSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelSchema
impl Debug for ModelSchema
Source§impl<'de> Deserialize<'de> for ModelSchema
impl<'de> Deserialize<'de> for ModelSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&ModelSchema> for ModelInfo
impl From<&ModelSchema> for ModelInfo
Source§fn from(s: &ModelSchema) -> Self
fn from(s: &ModelSchema) -> Self
Auto Trait Implementations§
impl Freeze for ModelSchema
impl RefUnwindSafe for ModelSchema
impl Send for ModelSchema
impl Sync for ModelSchema
impl Unpin for ModelSchema
impl UnsafeUnpin for ModelSchema
impl UnwindSafe for ModelSchema
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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