{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/LettaUsageStatistics",
  "title": "LettaUsageStatistics",
  "properties": {
    "message_type": {
      "type": "string",
      "const": "usage_statistics",
      "title": "Message Type",
      "default": "usage_statistics"
    },
    "completion_tokens": {
      "type": "integer",
      "title": "Completion Tokens",
      "description": "The number of tokens generated by the agent.",
      "default": 0
    },
    "prompt_tokens": {
      "type": "integer",
      "title": "Prompt Tokens",
      "description": "The number of tokens in the prompt.",
      "default": 0
    },
    "total_tokens": {
      "type": "integer",
      "title": "Total Tokens",
      "description": "The total number of tokens processed by the agent.",
      "default": 0
    },
    "step_count": {
      "type": "integer",
      "title": "Step Count",
      "description": "The number of steps taken by the agent.",
      "default": 0
    },
    "run_ids": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Run Ids",
      "description": "The background task run IDs associated with the agent interaction"
    },
    "cached_input_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cached Input Tokens",
      "description": "The number of input tokens served from cache. None if not reported by provider."
    },
    "cache_write_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cache Write Tokens",
      "description": "The number of input tokens written to cache (Anthropic only). None if not reported by provider."
    },
    "reasoning_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reasoning Tokens",
      "description": "The number of reasoning/thinking tokens generated. None if not reported by provider."
    },
    "context_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Context Tokens",
      "description": "Estimate of tokens currently in the context window."
    }
  },
  "type": "object",
  "description": "Usage statistics for the agent interaction.\n\nAttributes:\n    completion_tokens (int): The number of tokens generated by the agent.\n    prompt_tokens (int): The number of tokens in the prompt.\n    total_tokens (int): The total number of tokens processed by the agent.\n    step_count (int): The number of steps taken by the agent.\n    cached_input_tokens (Optional[int]): The number of input tokens served from cache. None if not reported.\n    cache_write_tokens (Optional[int]): The number of input tokens written to cache. None if not reported.\n    reasoning_tokens (Optional[int]): The number of reasoning/thinking tokens generated. None if not reported."
}