{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/majr-app/json-schema/majr-app-usage-response-schema.json",
  "title": "UsageResponse",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dispatch-openapi.json#/components/schemas/UsageResponse",
  "properties": {
    "account": {
      "type": "string",
      "title": "Account"
    },
    "product": {
      "type": "string",
      "title": "Product"
    },
    "tenant": {
      "type": "string",
      "title": "Tenant",
      "description": "DEPRECATED alias of `product` (pre-accounts contract); will be removed in v2",
      "deprecated": true
    },
    "month": {
      "$ref": "#/$defs/UsagePeriod",
      "description": "UTC calendar month-to-date (drafting)"
    },
    "lifetime": {
      "$ref": "#/$defs/UsagePeriod"
    },
    "services": {
      "additionalProperties": {
        "$ref": "#/$defs/ServiceUsage"
      },
      "type": "object",
      "title": "Services",
      "description": "Cross-service breakdown for this product — every platform service that metered usage for it (only services with recorded events appear). Drafting appears as 'dispatch' with the same numbers as month/lifetime."
    }
  },
  "type": "object",
  "required": [
    "account",
    "product",
    "tenant",
    "month",
    "lifetime"
  ],
  "$defs": {
    "ServiceUsage": {
      "properties": {
        "month": {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "number"
              }
            ]
          },
          "type": "object",
          "title": "Month"
        },
        "lifetime": {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "number"
              }
            ]
          },
          "type": "object",
          "title": "Lifetime"
        }
      },
      "type": "object",
      "required": [
        "month",
        "lifetime"
      ],
      "title": "ServiceUsage",
      "description": "Per-service totals: `events` plus that service's own quantity sums (bytes, seconds, ...)."
    },
    "UsagePeriod": {
      "properties": {
        "drafts": {
          "type": "integer",
          "title": "Drafts"
        },
        "input_tokens": {
          "type": "integer",
          "title": "Input Tokens"
        },
        "output_tokens": {
          "type": "integer",
          "title": "Output Tokens"
        }
      },
      "type": "object",
      "required": [
        "drafts",
        "input_tokens",
        "output_tokens"
      ],
      "title": "UsagePeriod"
    }
  }
}