{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cayra-io/json-schema/cayra-io-license-usage-event-request-schema.json",
  "title": "LicenseUsageEventRequest",
  "description": "Usage event payload for license-key scoped endpoints.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cayra-io-usage-api-openapi.yml#/components/schemas/LicenseUsageEventRequest",
  "properties": {
    "model_name": {
      "type": "string",
      "maxLength": 128,
      "title": "Model Name",
      "description": "LLM model name"
    },
    "input_tokens": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Input Tokens",
      "description": "Prompt tokens consumed",
      "default": 0
    },
    "output_tokens": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Output Tokens",
      "description": "Completion tokens produced",
      "default": 0
    },
    "cache_read_tokens": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Cache Read Tokens",
      "description": "Prompt cache read tokens (if provider supports)",
      "default": 0
    },
    "cache_creation_tokens": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Cache Creation Tokens",
      "description": "Prompt cache creation tokens (if provider supports)",
      "default": 0
    },
    "idempotency_key": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Idempotency Key",
      "description": "Optional idempotency key for dedupe"
    },
    "run_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Run Id",
      "description": "Optional execution run identifier"
    },
    "total_cost": {
      "type": "number",
      "minimum": 0.0,
      "title": "Total Cost",
      "description": "Cost in license currency"
    },
    "usage_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Usage Date",
      "description": "Override usage date (defaults to current UTC date)"
    }
  },
  "type": "object",
  "required": [
    "model_name",
    "total_cost"
  ]
}