pub struct Model {
pub id: String,
pub name: String,
pub provider: String,
pub reasoning: bool,
pub cost: Option<ModelCost>,
pub limit: ModelLimit,
pub release_date: Option<String>,
}Expand description
Unified model representation across all providers
Fields§
§id: StringModel identifier sent to the API (e.g., “claude-sonnet-4-5-20250929”)
name: StringHuman-readable name (e.g., “Claude Sonnet 4.5”)
provider: StringProvider identifier (e.g., “anthropic”, “openai”, “google”)
reasoning: boolExtended thinking/reasoning support
cost: Option<ModelCost>Pricing per 1M tokens (None for custom/unknown models)
limit: ModelLimitToken limits
release_date: Option<String>Release date (YYYY-MM-DD format)
Implementations§
Source§impl Model
impl Model
Sourcepub fn new(
id: impl Into<String>,
name: impl Into<String>,
provider: impl Into<String>,
reasoning: bool,
cost: Option<ModelCost>,
limit: ModelLimit,
) -> Model
pub fn new( id: impl Into<String>, name: impl Into<String>, provider: impl Into<String>, reasoning: bool, cost: Option<ModelCost>, limit: ModelLimit, ) -> Model
Create a new model with all fields
Sourcepub fn custom(id: impl Into<String>, provider: impl Into<String>) -> Model
pub fn custom(id: impl Into<String>, provider: impl Into<String>) -> Model
Create a custom model with minimal info (no pricing)
Sourcepub fn has_pricing(&self) -> bool
pub fn has_pricing(&self) -> bool
Check if this model has pricing information
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Get the display name (name field)
Sourcepub fn provider_name(&self) -> &str
pub fn provider_name(&self) -> &str
Get the provider name
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Model
impl<'de> Deserialize<'de> for Model
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Model, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Model, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Model
impl Serialize for Model
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,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Model
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin 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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request