vapi_client/models/
model_cost.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct ModelCost {
19    /// This is the type of cost, always 'model' for this class.
20    #[serde(rename = "type")]
21    pub r#type: Type,
22    /// 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`.
23    #[serde(rename = "model")]
24    pub model: serde_json::Value,
25    /// 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.
26    #[serde(rename = "promptTokens")]
27    pub prompt_tokens: f64,
28    /// 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.
29    #[serde(rename = "completionTokens")]
30    pub completion_tokens: f64,
31    /// This is the cost of the component in USD.
32    #[serde(rename = "cost")]
33    pub cost: f64,
34}
35
36impl ModelCost {
37    pub fn new(
38        r#type: Type,
39        model: serde_json::Value,
40        prompt_tokens: f64,
41        completion_tokens: f64,
42        cost: f64,
43    ) -> ModelCost {
44        ModelCost {
45            r#type,
46            model,
47            prompt_tokens,
48            completion_tokens,
49            cost,
50        }
51    }
52}
53/// This is the type of cost, always 'model' for this class.
54#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
55pub enum Type {
56    #[serde(rename = "model")]
57    Model,
58}
59
60impl Default for Type {
61    fn default() -> Type {
62        Self::Model
63    }
64}