{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onclarity-com/json-schema/onclarity-com-session-cost-detail-response-schema.json",
  "title": "SessionCostDetailResponse",
  "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/SessionCostDetailResponse",
  "properties": {
    "session_db_id": {
      "type": "integer",
      "title": "Session Db Id"
    },
    "provider_session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Provider Session Id"
    },
    "project_id": {
      "type": "integer",
      "title": "Project Id"
    },
    "project_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Name"
    },
    "surface": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Surface"
    },
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "thread_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Thread Id"
    },
    "owner_user_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Owner User Id"
    },
    "owner_email": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Owner Email"
    },
    "type": {
      "type": "string",
      "title": "Type"
    },
    "routine_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Routine Id"
    },
    "routine_run_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Routine Run Id"
    },
    "agent_version": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent Version"
    },
    "model_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model Id"
    },
    "model_speed": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model Speed"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created At"
    },
    "totals": {
      "$ref": "#/$defs/CostTotals"
    },
    "components": {
      "items": {
        "$ref": "#/$defs/ComponentCostRow"
      },
      "type": "array",
      "title": "Components",
      "default": []
    },
    "series": {
      "items": {
        "$ref": "#/$defs/SnapshotPoint"
      },
      "type": "array",
      "title": "Series"
    }
  },
  "type": "object",
  "required": [
    "session_db_id",
    "provider_session_id",
    "project_id",
    "type",
    "totals",
    "series"
  ],
  "$defs": {
    "ComponentCostRow": {
      "properties": {
        "component": {
          "type": "string",
          "title": "Component"
        },
        "label": {
          "type": "string",
          "title": "Label"
        },
        "model_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Model Id"
        },
        "threads": {
          "type": "integer",
          "title": "Threads",
          "default": 0
        },
        "provider_thread_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Provider Thread Ids",
          "default": []
        },
        "snapshots": {
          "type": "integer",
          "title": "Snapshots",
          "default": 0
        },
        "totals": {
          "$ref": "#/$defs/CostTotals"
        }
      },
      "type": "object",
      "required": [
        "component",
        "label",
        "totals"
      ],
      "title": "ComponentCostRow",
      "description": "One spend component of a session: the primary agent, its advisor consults, or the\nverification judge — tokens and dollars folded from that component's rows."
    },
    "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)."
    },
    "SnapshotPoint": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "captured_at": {
          "type": "string",
          "format": "date-time",
          "title": "Captured At"
        },
        "source": {
          "type": "string",
          "title": "Source"
        },
        "provider_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Provider Status"
        },
        "is_final": {
          "type": "boolean",
          "title": "Is Final"
        },
        "delta_tokens": {
          "type": "integer",
          "title": "Delta Tokens"
        },
        "delta_usd": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delta Usd"
        },
        "cumulative_tokens": {
          "type": "integer",
          "title": "Cumulative Tokens"
        },
        "active_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Active Seconds"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration Seconds"
        },
        "component": {
          "type": "string",
          "title": "Component",
          "default": "session"
        },
        "provider_thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Provider Thread Id"
        },
        "model_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Model Id"
        },
        "delta_list_usd": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delta List Usd"
        }
      },
      "type": "object",
      "required": [
        "id",
        "captured_at",
        "source",
        "provider_status",
        "is_final",
        "delta_tokens",
        "cumulative_tokens"
      ],
      "title": "SnapshotPoint"
    }
  }
}