langfuse_client/models/
usage.rs

1/*
2 * langfuse
3 *
4 * ## Authentication  Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:  - username: Langfuse Public Key - password: Langfuse Secret Key  ## Exports  - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml - Postman collection: https://cloud.langfuse.com/generated/postman/collection.json
5 *
6 * The version of the OpenAPI document: 
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Usage : (Deprecated. Use usageDetails and costDetails instead.) Standard interface for usage and cost
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16#[cfg_attr(feature="bon", derive(bon::Builder))]
17pub struct Usage {
18    /// Number of input units (e.g. tokens)
19    #[serde(rename = "input", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
20    pub input: Option<Option<i32>>,
21    /// Number of output units (e.g. tokens)
22    #[serde(rename = "output", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub output: Option<Option<i32>>,
24    /// Defaults to input+output if not set
25    #[serde(rename = "total", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub total: Option<Option<i32>>,
27    #[serde(rename = "unit", skip_serializing_if = "Option::is_none")]
28    pub unit: Option<models::ModelUsageUnit>,
29    /// USD input cost
30    #[serde(rename = "inputCost", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub input_cost: Option<Option<f64>>,
32    /// USD output cost
33    #[serde(rename = "outputCost", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub output_cost: Option<Option<f64>>,
35    /// USD total cost, defaults to input+output
36    #[serde(rename = "totalCost", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub total_cost: Option<Option<f64>>,
38}
39
40impl Usage {
41    /// (Deprecated. Use usageDetails and costDetails instead.) Standard interface for usage and cost
42    pub fn new() -> Usage {
43        Usage {
44            input: None,
45            output: None,
46            total: None,
47            unit: None,
48            input_cost: None,
49            output_cost: None,
50            total_cost: None,
51        }
52    }
53}
54