pub struct Model {
pub id: String,
pub name: String,
pub api: Api,
pub provider: String,
pub base_url: String,
pub reasoning: bool,
pub input: Vec<InputModality>,
pub cost: Cost,
pub context_window: usize,
pub max_tokens: usize,
pub headers: HashMap<String, String>,
pub compat: Option<CompatSettings>,
}Expand description
Core type definitions (tokens, cost, etc.). LLM model definition.
Describes a model’s capabilities, endpoint, and cost structure.
Fields§
§id: StringUnique model identifier (e.g. "gpt-4o", "claude-3-5-sonnet").
name: StringHuman-readable display name.
api: ApiWhich API dialect this model speaks.
provider: StringProvider name (e.g. "openai", "anthropic").
base_url: StringBase URL for the provider API.
reasoning: boolWhether this model supports extended reasoning / thinking.
input: Vec<InputModality>Supported input modalities.
cost: CostPricing information.
context_window: usizeMaximum context window in tokens.
max_tokens: usizeMaximum output tokens per request.
headers: HashMap<String, String>Extra HTTP headers to send with every request.
compat: Option<CompatSettings>Compatibility tweaks for non-standard providers.
Implementations§
Source§impl Model
impl Model
Sourcepub fn new(
id: impl Into<String>,
name: impl Into<String>,
api: Api,
provider: impl Into<String>,
base_url: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, name: impl Into<String>, api: Api, provider: impl Into<String>, base_url: impl Into<String>, ) -> Self
Create a new model with sensible defaults.
Sourcepub fn supports_vision(&self) -> bool
pub fn supports_vision(&self) -> bool
Returns true if the model accepts image inputs.
Sourcepub fn supports_reasoning(&self) -> bool
pub fn supports_reasoning(&self) -> bool
Returns true if the model supports extended reasoning.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Model
impl<'de> Deserialize<'de> for Model
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
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
Mutably borrows from an owned value. Read more