pub enum ModelTier {
Premium = 3,
Standard = 2,
Economy = 1,
Local = 0,
}Expand description
Cost tier of an LLM model.
Variants§
Premium = 3
Highest capability, highest cost (e.g. GPT-4o, Claude Opus).
Standard = 2
Mid-tier capability and cost (e.g. GPT-4o-mini, Claude Sonnet).
Economy = 1
Low-cost, reduced capability (e.g. GPT-3.5, Claude Haiku).
Local = 0
Zero marginal cost local model (e.g. Ollama, llama.cpp).
Implementations§
Source§impl ModelTier
impl ModelTier
Sourcepub fn downgrade(&self) -> Option<ModelTier>
pub fn downgrade(&self) -> Option<ModelTier>
Return the next cheaper tier, or None if already at the lowest.
Sourcepub fn cost_per_1k_output(&self) -> f64
pub fn cost_per_1k_output(&self) -> f64
Approximate cost per 1K output tokens in USD.
Sourcepub fn cost_per_1k_input(&self) -> f64
pub fn cost_per_1k_input(&self) -> f64
Approximate cost per 1K input tokens in USD.
Sourcepub fn estimate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64
pub fn estimate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64
Estimate cost for a request.
Trait Implementations§
impl Copy for ModelTier
Source§impl<'de> Deserialize<'de> for ModelTier
impl<'de> Deserialize<'de> for ModelTier
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
impl Eq for ModelTier
Source§impl JsonSchema for ModelTier
Available on crate feature schemars only.
impl JsonSchema for ModelTier
Available on crate feature
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Ord for ModelTier
impl Ord for ModelTier
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for ModelTier
impl PartialOrd for ModelTier
impl StructuralPartialEq for ModelTier
Auto Trait Implementations§
impl Freeze for ModelTier
impl RefUnwindSafe for ModelTier
impl Send for ModelTier
impl Sync for ModelTier
impl Unpin for ModelTier
impl UnsafeUnpin for ModelTier
impl UnwindSafe for ModelTier
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