{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/theagentc-io/json-schema/theagentc-io-credit-balance-schema.json",
  "title": "CreditBalance",
  "description": "Current credit balance and tier information.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/theagentc-io-openapi.json#/components/schemas/CreditBalance",
  "properties": {
    "balance": {
      "type": "integer",
      "title": "Balance",
      "description": "Credits remaining in current billing period"
    },
    "total": {
      "type": "integer",
      "title": "Total",
      "description": "Total credits allocated for this billing period"
    },
    "plan": {
      "type": "string",
      "title": "Plan",
      "description": "Current plan tier (free | pro | legacy builder/studio variants)"
    },
    "warning_level": {
      "type": "string",
      "pattern": "^(normal|low|depleted)$",
      "title": "Warning Level",
      "description": "Balance warning level"
    },
    "video_used": {
      "type": "integer",
      "title": "Video Used",
      "description": "Videos created this month"
    },
    "video_cap": {
      "type": "integer",
      "title": "Video Cap",
      "description": "Total videos allowed this month"
    },
    "strategy_sessions_used": {
      "type": "integer",
      "title": "Strategy Sessions Used",
      "description": "Strategy sessions used this month"
    },
    "strategy_sessions_included": {
      "type": "integer",
      "title": "Strategy Sessions Included",
      "description": "Strategy sessions included in plan"
    },
    "next_reset_at": {
      "type": "string",
      "format": "date-time",
      "title": "Next Reset At",
      "description": "When credits reset (monthly)"
    },
    "free_credits": {
      "type": "integer",
      "title": "Free Credits",
      "description": "Free bucket (tops up monthly, no rollover)",
      "default": 0
    },
    "paid_credits": {
      "type": "integer",
      "title": "Paid Credits",
      "description": "Purchased/sub bucket (rolls over)",
      "default": 0
    },
    "free_credits_reset_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Free Credits Reset At",
      "description": "When the free bucket next tops up"
    }
  },
  "type": "object",
  "required": [
    "balance",
    "total",
    "plan",
    "warning_level",
    "video_used",
    "video_cap",
    "strategy_sessions_used",
    "strategy_sessions_included",
    "next_reset_at"
  ]
}