{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cayra-io/json-schema/cayra-io-usage-event-response-schema.json",
  "title": "UsageEventResponse",
  "description": "Response after persisting a usage event.",
  "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/UsageEventResponse",
  "properties": {
    "success": {
      "type": "boolean",
      "title": "Success",
      "default": true
    },
    "balance": {
      "$ref": "#/$defs/UsageBalanceSummary"
    },
    "daily_usage": {
      "$ref": "#/$defs/DailyUsageEntry"
    }
  },
  "type": "object",
  "required": [
    "balance",
    "daily_usage"
  ],
  "$defs": {
    "DailyUsageEntry": {
      "properties": {
        "usage_date": {
          "type": "string",
          "format": "date",
          "title": "Usage Date"
        },
        "model_name": {
          "type": "string",
          "title": "Model Name"
        },
        "input_tokens": {
          "type": "integer",
          "title": "Input Tokens"
        },
        "output_tokens": {
          "type": "integer",
          "title": "Output Tokens"
        },
        "total_cost": {
          "type": "number",
          "title": "Total Cost"
        }
      },
      "type": "object",
      "required": [
        "usage_date",
        "model_name",
        "input_tokens",
        "output_tokens",
        "total_cost"
      ],
      "title": "DailyUsageEntry",
      "description": "Aggregated usage entry."
    },
    "UsageBalanceSummary": {
      "properties": {
        "license_id": {
          "type": "string",
          "format": "uuid",
          "title": "License Id"
        },
        "current_balance": {
          "type": "number",
          "title": "Current Balance"
        },
        "currency": {
          "type": "string",
          "title": "Currency"
        },
        "allow_external_api": {
          "type": "boolean",
          "title": "Allow External Api"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        }
      },
      "type": "object",
      "required": [
        "license_id",
        "current_balance",
        "currency",
        "allow_external_api",
        "updated_at"
      ],
      "title": "UsageBalanceSummary",
      "description": "Balance information for a license."
    }
  }
}