{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onclarity-com/json-schema/onclarity-com-leaderboards-response-schema.json",
  "title": "LeaderboardsResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onclarity-com-agent-costs-api-openapi.yml#/components/schemas/LeaderboardsResponse",
  "properties": {
    "top_sessions": {
      "items": {
        "$ref": "#/$defs/SessionLeaderRow"
      },
      "type": "array",
      "title": "Top Sessions"
    },
    "top_users": {
      "items": {
        "$ref": "#/$defs/KeyLeaderRow"
      },
      "type": "array",
      "title": "Top Users"
    },
    "top_routines": {
      "items": {
        "$ref": "#/$defs/KeyLeaderRow"
      },
      "type": "array",
      "title": "Top Routines"
    },
    "worst_cache": {
      "items": {
        "$ref": "#/$defs/SessionLeaderRow"
      },
      "type": "array",
      "title": "Worst Cache"
    }
  },
  "type": "object",
  "required": [
    "top_sessions",
    "top_users",
    "top_routines",
    "worst_cache"
  ],
  "$defs": {
    "CostTotals": {
      "properties": {
        "input_tokens": {
          "type": "integer",
          "title": "Input Tokens",
          "default": 0
        },
        "output_tokens": {
          "type": "integer",
          "title": "Output Tokens",
          "default": 0
        },
        "cache_read_tokens": {
          "type": "integer",
          "title": "Cache Read Tokens",
          "default": 0
        },
        "cache_5m_tokens": {
          "type": "integer",
          "title": "Cache 5M Tokens",
          "default": 0
        },
        "cache_1h_tokens": {
          "type": "integer",
          "title": "Cache 1H Tokens",
          "default": 0
        },
        "total_tokens": {
          "type": "integer",
          "title": "Total Tokens",
          "default": 0
        },
        "runtime_seconds": {
          "type": "number",
          "title": "Runtime Seconds",
          "default": 0.0
        },
        "usd": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Usd"
        },
        "unpriced_tokens": {
          "type": "integer",
          "title": "Unpriced Tokens",
          "default": 0
        },
        "list_usd": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "List Usd"
        }
      },
      "type": "object",
      "title": "CostTotals",
      "description": "Token deltas + billed runtime + priced dollars for one bucket.\n\n``usd`` is ``None`` only when NOTHING in the bucket was priceable; ``unpriced_tokens``\ncounts tokens whose model had no pricing rule (surfaced, never silently $0)."
    },
    "KeyLeaderRow": {
      "properties": {
        "key": {
          "type": "string",
          "title": "Key"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Label"
        },
        "totals": {
          "$ref": "#/$defs/CostTotals"
        },
        "sessions": {
          "type": "integer",
          "title": "Sessions",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "key",
        "totals"
      ],
      "title": "KeyLeaderRow"
    },
    "SessionLeaderRow": {
      "properties": {
        "provider_session_id": {
          "type": "string",
          "title": "Provider Session Id"
        },
        "session_db_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Session Db Id"
        },
        "project_id": {
          "type": "integer",
          "title": "Project Id"
        },
        "project_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Project Name"
        },
        "surface": {
          "type": "string",
          "title": "Surface"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Title"
        },
        "owner_email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Owner Email"
        },
        "model_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Model Id"
        },
        "totals": {
          "$ref": "#/$defs/CostTotals"
        },
        "cache_read_ratio": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cache Read Ratio"
        }
      },
      "type": "object",
      "required": [
        "provider_session_id",
        "session_db_id",
        "project_id",
        "surface",
        "totals"
      ],
      "title": "SessionLeaderRow"
    }
  }
}