{
  "$id": "https://comitiva.dev/schema/UsageSummary.json",
  "title": "UsageSummary",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "totals": {
      "type": "object",
      "properties": {
        "runs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "inputTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "outputTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "cacheReadTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "cacheWriteTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "costUsd": {
          "type": "number",
          "minimum": 0
        },
        "costUsdCli": {
          "type": "number",
          "minimum": 0
        },
        "anyEstimated": {
          "type": "boolean"
        },
        "anyUnpriced": {
          "type": "boolean"
        }
      },
      "required": [
        "runs",
        "inputTokens",
        "outputTokens",
        "cacheReadTokens",
        "cacheWriteTokens",
        "costUsd",
        "costUsdCli",
        "anyEstimated",
        "anyUnpriced"
      ]
    },
    "byConnection": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "inputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "outputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cacheReadTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cacheWriteTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "costUsd": {
            "type": "number",
            "minimum": 0
          },
          "costUsdCli": {
            "type": "number",
            "minimum": 0
          },
          "anyEstimated": {
            "type": "boolean"
          },
          "anyUnpriced": {
            "type": "boolean"
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "provider": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "anthropic",
                  "openai-compatible",
                  "google",
                  "ollama",
                  "claude-code",
                  "codex",
                  "gemini-cli"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "runs",
          "inputTokens",
          "outputTokens",
          "cacheReadTokens",
          "cacheWriteTokens",
          "costUsd",
          "costUsdCli",
          "anyEstimated",
          "anyUnpriced",
          "key",
          "label"
        ]
      }
    },
    "byAgent": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "inputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "outputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cacheReadTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cacheWriteTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "costUsd": {
            "type": "number",
            "minimum": 0
          },
          "costUsdCli": {
            "type": "number",
            "minimum": 0
          },
          "anyEstimated": {
            "type": "boolean"
          },
          "anyUnpriced": {
            "type": "boolean"
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "provider": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "anthropic",
                  "openai-compatible",
                  "google",
                  "ollama",
                  "claude-code",
                  "codex",
                  "gemini-cli"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "runs",
          "inputTokens",
          "outputTokens",
          "cacheReadTokens",
          "cacheWriteTokens",
          "costUsd",
          "costUsdCli",
          "anyEstimated",
          "anyUnpriced",
          "key",
          "label"
        ]
      }
    },
    "byModel": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "inputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "outputTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cacheReadTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "cacheWriteTokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "costUsd": {
            "type": "number",
            "minimum": 0
          },
          "costUsdCli": {
            "type": "number",
            "minimum": 0
          },
          "anyEstimated": {
            "type": "boolean"
          },
          "anyUnpriced": {
            "type": "boolean"
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "provider": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "anthropic",
                  "openai-compatible",
                  "google",
                  "ollama",
                  "claude-code",
                  "codex",
                  "gemini-cli"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "runs",
          "inputTokens",
          "outputTokens",
          "cacheReadTokens",
          "cacheWriteTokens",
          "costUsd",
          "costUsdCli",
          "anyEstimated",
          "anyUnpriced",
          "key",
          "label"
        ]
      }
    }
  },
  "required": [
    "totals",
    "byConnection",
    "byAgent",
    "byModel"
  ]
}
