pub struct Model {Show 14 fields
pub id: String,
pub model_name: String,
pub match_pattern: String,
pub start_date: Option<Option<String>>,
pub unit: Option<ModelUsageUnit>,
pub input_price: Option<Option<f64>>,
pub output_price: Option<Option<f64>>,
pub total_price: Option<Option<f64>>,
pub tokenizer_id: Option<Option<String>>,
pub tokenizer_config: Option<Option<Value>>,
pub is_langfuse_managed: bool,
pub created_at: String,
pub prices: HashMap<String, ModelPrice>,
pub pricing_tiers: Vec<PricingTier>,
}Expand description
Model : Model definition used for transforming usage into USD cost and/or tokenization. Models can have either simple flat pricing or tiered pricing: - Flat pricing: Single price per usage type (legacy, but still supported) - Tiered pricing: Multiple pricing tiers with conditional matching based on usage patterns The pricing tiers approach is recommended for models with usage-based pricing variations. When using tiered pricing, the flat price fields (inputPrice, outputPrice, prices) are populated from the default tier for backward compatibility.
Fields§
§id: String§model_name: StringName of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime
match_pattern: StringRegex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use (?i)^modelname$
start_date: Option<Option<String>>Apply only to generations which are newer than this ISO date.
unit: Option<ModelUsageUnit>§input_price: Option<Option<f64>>Deprecated. See ‘prices’ instead. Price (USD) per input unit
output_price: Option<Option<f64>>Deprecated. See ‘prices’ instead. Price (USD) per output unit
total_price: Option<Option<f64>>Deprecated. See ‘prices’ instead. Price (USD) per total unit. Cannot be set if input or output price is set.
tokenizer_id: Option<Option<String>>Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
tokenizer_config: Option<Option<Value>>Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
is_langfuse_managed: bool§created_at: StringTimestamp when the model was created
prices: HashMap<String, ModelPrice>Deprecated. Use ‘pricingTiers’ instead for models with usage-based pricing variations. This field shows prices by usage type from the default pricing tier. Maintained for backward compatibility. If the model uses tiered pricing, this field will be populated from the default tier’s prices.
pricing_tiers: Vec<PricingTier>Array of pricing tiers with conditional pricing based on usage thresholds. Pricing tiers enable accurate cost tracking for models that charge different rates based on usage patterns (e.g., different rates for high-volume usage, large context windows, or cached tokens). Each model must have exactly one default tier (isDefault=true, priority=0) that serves as a fallback. Additional conditional tiers can be defined with specific matching criteria. If this array is empty, the model uses legacy flat pricing from the inputPrice/outputPrice/totalPrice fields.
Implementations§
Source§impl Model
impl Model
Sourcepub fn builder() -> ModelBuilder
pub fn builder() -> ModelBuilder
Create an instance of Model using the builder syntax
Source§impl Model
impl Model
Sourcepub fn new(
id: String,
model_name: String,
match_pattern: String,
is_langfuse_managed: bool,
created_at: String,
prices: HashMap<String, ModelPrice>,
pricing_tiers: Vec<PricingTier>,
) -> Model
pub fn new( id: String, model_name: String, match_pattern: String, is_langfuse_managed: bool, created_at: String, prices: HashMap<String, ModelPrice>, pricing_tiers: Vec<PricingTier>, ) -> Model
Model definition used for transforming usage into USD cost and/or tokenization. Models can have either simple flat pricing or tiered pricing: - Flat pricing: Single price per usage type (legacy, but still supported) - Tiered pricing: Multiple pricing tiers with conditional matching based on usage patterns The pricing tiers approach is recommended for models with usage-based pricing variations. When using tiered pricing, the flat price fields (inputPrice, outputPrice, prices) are populated from the default tier for backward compatibility.
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>,
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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)