{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prowl-chat/json-schema/prowl-chat-usage-summary-response-schema.json",
  "title": "UsageSummaryResponse",
  "description": "Spend over a window, with the current balances alongside it.\n\nInherits `WalletBalances` because the handler spreads the wallet into its reply\n(`persistence/wallet.py:2405`) — modelling it any other way would make the\nenforced filter drop the four balance fields the dashboard reads.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/prowl-chat-openapi.json#/components/schemas/UsageSummaryResponse",
  "properties": {
    "subscription_balance_usd": {
      "type": "number",
      "title": "Subscription Balance Usd",
      "description": "Plan credit for the current period. Burns at period end, spent first."
    },
    "extra_balance_usd": {
      "type": "number",
      "title": "Extra Balance Usd",
      "description": "Top-up credit. Never expires, spent after the subscription pool."
    },
    "total_available_usd": {
      "type": "number",
      "title": "Total Available Usd",
      "description": "What the next call can draw on: the two pools added together."
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At",
      "description": "ISO-8601 timestamp of the last balance change, or null if never moved."
    },
    "days": {
      "type": "integer",
      "title": "Days",
      "description": "Length of the window this summary covers, in days."
    },
    "invocation_count": {
      "type": "integer",
      "title": "Invocation Count",
      "description": "Metered calls inside the window."
    },
    "total_billed_usd": {
      "type": "number",
      "title": "Total Billed Usd",
      "description": "Total debited from the wallet inside the window."
    },
    "total_provider_usd": {
      "type": "number",
      "title": "Total Provider Usd",
      "description": "Total upstream provider cost inside the window."
    },
    "by_tool": {
      "items": {
        "$ref": "#/$defs/UsageByTool"
      },
      "type": "array",
      "title": "By Tool",
      "description": "Top 20 tools by spend, highest first."
    }
  },
  "type": "object",
  "required": [
    "subscription_balance_usd",
    "extra_balance_usd",
    "total_available_usd",
    "days",
    "invocation_count",
    "total_billed_usd",
    "total_provider_usd",
    "by_tool"
  ],
  "$defs": {
    "UsageByTool": {
      "properties": {
        "tool_name": {
          "type": "string",
          "title": "Tool Name"
        },
        "calls": {
          "type": "integer",
          "title": "Calls"
        },
        "billed_usd": {
          "type": "number",
          "title": "Billed Usd"
        }
      },
      "type": "object",
      "required": [
        "tool_name",
        "calls",
        "billed_usd"
      ],
      "title": "UsageByTool",
      "description": "Spend rolled up per tool over the requested window."
    }
  }
}