langfuse_rs/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)]
16pub struct Usage {
17	/// Number of input units (e.g. tokens)
18	#[serde(
19		rename = "input",
20		default,
21		with = "::serde_with::rust::double_option",
22		skip_serializing_if = "Option::is_none"
23	)]
24	pub input: Option<Option<i32>>,
25	/// Number of output units (e.g. tokens)
26	#[serde(
27		rename = "output",
28		default,
29		with = "::serde_with::rust::double_option",
30		skip_serializing_if = "Option::is_none"
31	)]
32	pub output: Option<Option<i32>>,
33	/// Defaults to input+output if not set
34	#[serde(
35		rename = "total",
36		default,
37		with = "::serde_with::rust::double_option",
38		skip_serializing_if = "Option::is_none"
39	)]
40	pub total: Option<Option<i32>>,
41	#[serde(rename = "unit", skip_serializing_if = "Option::is_none")]
42	pub unit: Option<models::ModelUsageUnit>,
43	/// USD input cost
44	#[serde(
45		rename = "inputCost",
46		default,
47		with = "::serde_with::rust::double_option",
48		skip_serializing_if = "Option::is_none"
49	)]
50	pub input_cost: Option<Option<f64>>,
51	/// USD output cost
52	#[serde(
53		rename = "outputCost",
54		default,
55		with = "::serde_with::rust::double_option",
56		skip_serializing_if = "Option::is_none"
57	)]
58	pub output_cost: Option<Option<f64>>,
59	/// USD total cost, defaults to input+output
60	#[serde(
61		rename = "totalCost",
62		default,
63		with = "::serde_with::rust::double_option",
64		skip_serializing_if = "Option::is_none"
65	)]
66	pub total_cost: Option<Option<f64>>,
67}
68
69impl Usage {
70	/// (Deprecated. Use usageDetails and costDetails instead.) Standard interface for usage and cost
71	pub fn new() -> Usage {
72		Usage {
73			input: None,
74			output: None,
75			total: None,
76			unit: None,
77			input_cost: None,
78			output_cost: None,
79			total_cost: None,
80		}
81	}
82}