{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peeve-ai/json-schema/peeve-ai-usage-object-schema.json",
  "title": "UsageObject",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peeve-ai-openapi.yml#/components/schemas/UsageObject",
  "allOf": [
    {
      "$ref": "#/$defs/ObjectEnvelope"
    },
    {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "properties": {
            "object": {
              "type": "string",
              "const": "usage"
            },
            "period_start": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "plan": {
              "type": "string"
            },
            "trialing": {
              "type": "boolean"
            },
            "credits": {
              "type": "object",
              "properties": {
                "included": {
                  "type": "number"
                },
                "used": {
                  "type": "number"
                },
                "remaining": {
                  "type": "number"
                },
                "percent_used": {
                  "type": "number"
                },
                "exhausted": {
                  "type": "boolean"
                }
              }
            },
            "by_channel": {
              "type": "object",
              "properties": {
                "chat": {
                  "type": "number"
                },
                "email": {
                  "type": "number"
                },
                "social": {
                  "type": "number"
                },
                "voice": {
                  "type": "number"
                },
                "connector": {
                  "type": "number"
                }
              }
            },
            "voice": {
              "type": "object",
              "properties": {
                "credits_used": {
                  "type": "number"
                },
                "credits_cap": {
                  "type": "number"
                },
                "over_cap": {
                  "type": "boolean"
                },
                "minutes": {
                  "type": "number"
                }
              }
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "ObjectEnvelope": {
      "type": "object",
      "required": [
        "object",
        "data",
        "request_id"
      ],
      "properties": {
        "object": {
          "type": "string",
          "description": "The resource type, e.g. `lead`."
        },
        "data": {
          "type": "object",
          "additionalProperties": true
        },
        "request_id": {
          "type": "string",
          "description": "Echoed in the `X-Request-Id` header. Quote it to support."
        }
      }
    }
  }
}