vapi_client/models/model_cost.rs
1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ModelCost {
16 /// This is the type of cost, always 'model' for this class.
17 #[serde(rename = "type")]
18 pub r#type: TypeTrue,
19 /// This is the model that was used during the call. This matches one of the following: - `call.assistant.model`, - `call.assistantId->model`, - `call.squad[n].assistant.model`, - `call.squad[n].assistantId->model`, - `call.squadId->[n].assistant.model`, - `call.squadId->[n].assistantId->model`.
20 #[serde(rename = "model")]
21 pub model: serde_json::Value,
22 /// This is the number of prompt tokens used in the call. These should be total prompt tokens used in the call for single assistant calls, while squad calls will have multiple model costs one for each assistant that was used.
23 #[serde(rename = "promptTokens")]
24 pub prompt_tokens: f64,
25 /// This is the number of completion tokens generated in the call. These should be total completion tokens used in the call for single assistant calls, while squad calls will have multiple model costs one for each assistant that was used.
26 #[serde(rename = "completionTokens")]
27 pub completion_tokens: f64,
28 /// This is the cost of the component in USD.
29 #[serde(rename = "cost")]
30 pub cost: f64,
31}
32
33impl ModelCost {
34 pub fn new(
35 r#type: TypeTrue,
36 model: serde_json::Value,
37 prompt_tokens: f64,
38 completion_tokens: f64,
39 cost: f64,
40 ) -> ModelCost {
41 ModelCost {
42 r#type,
43 model,
44 prompt_tokens,
45 completion_tokens,
46 cost,
47 }
48 }
49}
50/// This is the type of cost, always 'model' for this class.
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum TypeTrue {
53 #[serde(rename = "model")]
54 Model,
55}
56
57impl Default for TypeTrue {
58 fn default() -> TypeTrue {
59 Self::Model
60 }
61}