Vapi · Schema

ModelCost

AIVoiceAgentsRealtimeCPaaS

Properties

Name Type Description
type string This is the type of cost, always 'model' for this class.
model object 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].assistant
promptTokens number 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 ass
completionTokens number 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
cachedPromptTokens number This is the number of cached prompt tokens used in the call. This is only applicable to certain providers (e.g., OpenAI, Azure OpenAI) that support prompt caching. Cached tokens are billed at a discou
cost number This is the cost of the component in USD.
View JSON Schema on GitHub

JSON Schema

vapi-modelcost-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/ModelCost",
  "title": "ModelCost",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "description": "This is the type of cost, always 'model' for this class.",
      "enum": [
        "model"
      ]
    },
    "model": {
      "type": "object",
      "description": "This is the model that was used during the call.\n\nThis matches one of the following:\n- `call.assistant.model`,\n- `call.assistantId->model`,\n- `call.squad[n].assistant.model`,\n- `call.squad[n].assistantId->model`,\n- `call.squadId->[n].assistant.model`,\n- `call.squadId->[n].assistantId->model`."
    },
    "promptTokens": {
      "type": "number",
      "description": "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."
    },
    "completionTokens": {
      "type": "number",
      "description": "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."
    },
    "cachedPromptTokens": {
      "type": "number",
      "description": "This is the number of cached prompt tokens used in the call. This is only applicable to certain providers (e.g., OpenAI, Azure OpenAI) that support prompt caching. Cached tokens are billed at a discounted rate."
    },
    "cost": {
      "type": "number",
      "description": "This is the cost of the component in USD."
    }
  },
  "required": [
    "type",
    "model",
    "promptTokens",
    "completionTokens",
    "cost"
  ]
}