{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arkova-ai/json-schema/arkova-ai-usage-response-schema.json",
  "title": "UsageResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arkova-ai-usage-api-openapi.yml#/components/schemas/UsageResponse",
  "type": "object",
  "required": [
    "used",
    "limit",
    "remaining",
    "reset_date",
    "month",
    "keys",
    "allowance"
  ],
  "properties": {
    "used": {
      "type": "integer"
    },
    "limit": {
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string",
          "enum": [
            "unlimited"
          ]
        }
      ]
    },
    "remaining": {
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string",
          "enum": [
            "unlimited"
          ]
        }
      ]
    },
    "reset_date": {
      "type": "string",
      "format": "date-time"
    },
    "month": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}$"
    },
    "keys": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key_prefix": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "used": {
            "type": "integer"
          }
        }
      }
    },
    "allowance": {
      "type": "object",
      "description": "UAT-21: monthly allowance and overage terms for the organization.",
      "required": [
        "included_monthly_queries",
        "plan",
        "overage_unit_price_usd",
        "overage_queries",
        "overage_reported_to_stripe"
      ],
      "properties": {
        "included_monthly_queries": {
          "type": "integer"
        },
        "plan": {
          "type": "string",
          "enum": [
            "capped",
            "metered",
            "unmetered"
          ]
        },
        "overage_unit_price_usd": {
          "type": "number"
        },
        "overage_queries": {
          "type": "integer",
          "description": "Queries above the included allowance this month (metered plan only)."
        },
        "overage_reported_to_stripe": {
          "type": "boolean",
          "description": "Retained for v1 compatibility. Overage is sent to Stripe only after the month closes, so this is always false for the current month. It is never proof of an invoice charge."
        },
        "overage_approval_required": {
          "type": "boolean",
          "description": "True for a paying organization with no active overage approval: requests stop at the included queries (plan is capped, limit is the included allowance) until an organization owner or admin approves overage."
        }
      }
    },
    "viewer": {
      "type": "string",
      "enum": [
        "admin",
        "member"
      ],
      "description": "Signed-in callers only."
    }
  }
}