{
  "openapi": "3.1.0",
  "info": {
    "title": "CVEDIA GPU Capacity Calculator",
    "version": "1",
    "description": "How many video analytics cameras a GPU runs with CVEDIA-RT, and what hardware to buy for a set of cameras: the answers of the calculator page (https://gpu-calc.cvedia.com/), from CVEDIA's own benchmarks. Ask one scenario per request. Each answer links to the page with the same scenario."
  },
  "servers": [
    {
      "url": "https://gpu-calc.cvedia.com"
    }
  ],
  "paths": {
    "/api/have": {
      "get": {
        "operationId": "haveHardware",
        "summary": "I have hardware: how many cameras fit on a computer",
        "description": "Whether the cameras fit on the computer, what limits them, and the most cameras of each row that fit after the rows above it. With every count 0, the answer is the most each row fits. `cameraCapacityUsedPercent` is the calculator bar in whole percent, null when there is no bar. The calculator bar shows the share of the GPU’s camera capacity used or, beyond that capacity, needed. It can reflect CPU constraints and excludes host RAM and the server stream ceiling. Capacity is based on benchmark counts when recorded and estimated when fitted or model-backed. `gpuUsePercent` is a separate estimate of GPU resource load, null when unavailable.",
        "parameters": [
          {
            "name": "gpu",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "NVIDIA GeForce RTX 4090",
            "description": "A GPU the calculator lists, by its id or name, or a part of its name that only one GPU has."
          },
          {
            "name": "gpus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                1,
                2
              ],
              "default": 1
            },
            "description": "How many of the GPU card the computer has. A built-in GPU is one."
          },
          {
            "name": "cpu",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "intel-core-ultra-5-225",
                "Core Ultra 5, Series 2",
                "intel-core-ultra-7-265",
                "Core Ultra 7, Series 2",
                "intel-core-ultra-9-285",
                "Core Ultra 9, Series 2",
                "intel-core-i3-14100",
                "Intel Core i3, 14th gen",
                "intel-core-i5-14400",
                "Intel Core i5, 14th gen",
                "intel-core-i7-14700",
                "Intel Core i7, 14th gen",
                "intel-core-i9-14900",
                "Intel Core i9, 14th gen",
                "intel-core-i3-13100",
                "Intel Core i3, 13th gen",
                "intel-core-i5-13400",
                "Intel Core i5, 13th gen",
                "intel-core-i7-13700",
                "Intel Core i7, 13th gen",
                "intel-core-i9-13900",
                "Intel Core i9, 13th gen",
                "intel-core-i3-12100",
                "Intel Core i3, 12th gen",
                "intel-core-i5-12400",
                "Intel Core i5, 12th gen",
                "intel-core-i7-12700",
                "Intel Core i7, 12th gen",
                "intel-core-i9-12900",
                "Intel Core i9, 12th gen",
                "intel-xeon-e-2488",
                "Intel Xeon E-2488",
                "intel-xeon-silver-4510",
                "Intel Xeon Silver 4510",
                "intel-xeon-6724p",
                "Intel Xeon 6724P",
                "intel-xeon-silver-4314",
                "Intel Xeon Silver 4314",
                "intel-xeon-gold-6226r",
                "Intel Xeon Gold 6226R",
                "intel-xeon-silver-4416-plus",
                "Intel Xeon Silver 4416+",
                "intel-xeon-6728p",
                "Intel Xeon 6728P",
                "intel-xeon-silver-4516y-plus",
                "Intel Xeon Silver 4516Y+",
                "intel-xeon-gold-6248r",
                "Intel Xeon Gold 6248R",
                "intel-xeon-gold-5520-plus",
                "Intel Xeon Gold 5520+",
                "intel-xeon-6730p",
                "Intel Xeon 6730P",
                "intel-xeon-6740p",
                "Intel Xeon 6740P",
                "intel-xeon-platinum-8468",
                "Intel Xeon Platinum 8468",
                "intel-xeon-platinum-8580",
                "Intel Xeon Platinum 8580",
                "amd-ryzen-5-9600",
                "AMD Ryzen 5, 9000 series",
                "amd-ryzen-7-9700x",
                "AMD Ryzen 7, 9000 series",
                "amd-ryzen-9-9900x",
                "AMD Ryzen 9, 9000 series",
                "amd-ryzen-3-8300g",
                "AMD Ryzen 3, 8000G series",
                "amd-ryzen-5-7600",
                "AMD Ryzen 5, 7000 series",
                "amd-ryzen-7-7700",
                "AMD Ryzen 7, 7000 series",
                "amd-ryzen-9-7900",
                "AMD Ryzen 9, 7000 series",
                "amd-ryzen-5-5600",
                "AMD Ryzen 5, 5000 series",
                "amd-ryzen-7-5700x",
                "AMD Ryzen 7, 5000 series",
                "amd-ryzen-9-5900x",
                "AMD Ryzen 9, 5000 series",
                "amd-epyc-9135",
                "AMD EPYC 9135",
                "amd-epyc-9355",
                "AMD EPYC 9355",
                "amd-epyc-9555",
                "AMD EPYC 9555"
              ]
            },
            "description": "The computer's CPU, by name or id, where the calculator asks for it (NVIDIA GPUs it models). Default: not counted."
          },
          {
            "name": "ram",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "enum": [
                    0,
                    4,
                    8,
                    12,
                    16,
                    24,
                    32,
                    48,
                    64
                  ]
                },
                {
                  "const": "Not sure"
                }
              ]
            },
            "description": "The computer's memory in GB, where the calculator asks for it. Zero, Not sure and omission leave memory uncounted."
          },
          {
            "name": "cameras",
            "in": "query",
            "required": false,
            "description": "The rows of cameras in order: a JSON array of 1 to 8 row objects, percent-encoded. Default: one new row with no allocated cameras.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 8,
                  "items": {
                    "$ref": "#/components/schemas/CameraRow"
                  }
                },
                "example": [
                  {
                    "resolution": "2 MP",
                    "fps": 15
                  },
                  {
                    "resolution": "8 MP",
                    "scene": "Busy"
                  }
                ]
              }
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/count"
            },
            "description": "One row of cameras without JSON: the row's count, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "resolution",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/resolution"
            },
            "description": "One row of cameras without JSON: the row's resolution, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "fps",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/fps"
            },
            "description": "One row of cameras without JSON: the row's fps, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "codec",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/codec"
            },
            "description": "One row of cameras without JSON: the row's codec, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "scene",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/scene"
            },
            "description": "One row of cameras without JSON: the row's scene, as in a `cameras` row. Give either these or `cameras`."
          }
        ],
        "responses": {
          "200": {
            "description": "The answer, computed as the calculator page computes it.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HaveAnswer"
                }
              }
            }
          },
          "400": {
            "description": "The query has settings the calculator does not take. Every error is listed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "https://gpu-calc.cvedia.com/openapi.json#/components/schemas/Problem",
                  "title": "The question has settings the calculator does not take",
                  "status": 400,
                  "detail": "1 setting needs correcting.",
                  "errors": [
                    {
                      "parameter": "cameras",
                      "row": 2,
                      "field": "fps",
                      "setting": "Frame rate",
                      "detail": "Accepted values: 5, 10, 15, 20, 25, 30 (frames per second of the camera stream; AI analysis runs at 5 FPS)."
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The sizing service is temporarily unavailable, including when a calculation is running and another is waiting.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "Service Unavailable"
              }
            }
          }
        }
      }
    },
    "/api/need": {
      "get": {
        "operationId": "needHardware",
        "summary": "I need hardware: what to buy for a set of cameras",
        "description": "CVEDIA's products and the server layouts that run the cameras, best first: first those that keep the safety margin, then by estimated purchase cost (not published). Fleet figures are named as totals; the others are per server or box. `planningCapacityUsedPercentPerUnit`: Whole-percent share of one unit’s camera capacity at the rounded planning load, as shown on the calculator bar. The capacity is based on benchmark or estimated camera throughput for the workload.",
        "parameters": [
          {
            "name": "cameras",
            "in": "query",
            "required": false,
            "description": "The rows of cameras in order: a JSON array of 1 to 8 row objects, percent-encoded. Give at least one row a positive count, here or with `count`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 8,
                  "items": {
                    "$ref": "#/components/schemas/CameraRow"
                  }
                },
                "example": [
                  {
                    "count": 32,
                    "resolution": "2 MP"
                  },
                  {
                    "count": 8,
                    "resolution": "4 MP",
                    "fps": 25,
                    "codec": "H.264",
                    "scene": "Medium"
                  }
                ]
              }
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/count"
            },
            "description": "One row of cameras without JSON: the row's count, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "resolution",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/resolution"
            },
            "description": "One row of cameras without JSON: the row's resolution, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "fps",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/fps"
            },
            "description": "One row of cameras without JSON: the row's fps, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "codec",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/codec"
            },
            "description": "One row of cameras without JSON: the row's codec, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "scene",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CameraRow/properties/scene"
            },
            "description": "One row of cameras without JSON: the row's scene, as in a `cameras` row. Give either these or `cameras`."
          },
          {
            "name": "consumer",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Include consumer GPUs (GeForce)."
          }
        ],
        "responses": {
          "200": {
            "description": "The answer, computed as the calculator page computes it.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NeedAnswer"
                }
              }
            }
          },
          "400": {
            "description": "The query has settings the calculator does not take. Every error is listed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The sizing service is temporarily unavailable, including when a calculation is running and another is waiting.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "Service Unavailable"
              }
            }
          }
        }
      }
    },
    "/answer/have": {
      "get": {
        "operationId": "haveHardwarePage",
        "summary": "The \"I have hardware\" answer as a simple HTML page",
        "parameters": [
          {
            "$ref": "#/paths/~1api~1have/get/parameters/0"
          },
          {
            "$ref": "#/paths/~1api~1have/get/parameters/1"
          },
          {
            "$ref": "#/paths/~1api~1have/get/parameters/2"
          },
          {
            "$ref": "#/paths/~1api~1have/get/parameters/3"
          },
          {
            "$ref": "#/paths/~1api~1have/get/parameters/4"
          }
        ],
        "responses": {
          "200": {
            "description": "The answer page.",
            "content": {
              "text/html": {}
            }
          },
          "400": {
            "description": "The settings to correct.",
            "content": {
              "text/html": {}
            }
          },
          "503": {
            "description": "The sizing service is temporarily unavailable, including when a calculation is running and another is waiting.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "Service Unavailable"
              }
            }
          }
        }
      }
    },
    "/answer/need": {
      "get": {
        "operationId": "needHardwarePage",
        "summary": "The \"I need hardware\" answer as a simple HTML page",
        "parameters": [
          {
            "$ref": "#/paths/~1api~1need/get/parameters/0"
          },
          {
            "$ref": "#/paths/~1api~1need/get/parameters/1"
          }
        ],
        "responses": {
          "200": {
            "description": "The answer page.",
            "content": {
              "text/html": {}
            }
          },
          "400": {
            "description": "The settings to correct.",
            "content": {
              "text/html": {}
            }
          },
          "503": {
            "description": "The sizing service is temporarily unavailable, including when a calculation is running and another is waiting.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "Service Unavailable"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CameraRow": {
        "type": "object",
        "additionalProperties": false,
        "description": "One row of cameras of the same kind, as the calculator page sets it. Every field is optional and takes the value of a new row on the page.",
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100000,
            "default": 0,
            "description": "How many cameras of this kind. For \"I have hardware\", 0 asks for the most that fit."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "0.7 MP",
              "1 MP",
              "2 MP",
              "3 MP",
              "4 MP",
              "5 MP",
              "8 MP"
            ],
            "default": "2 MP",
            "description": "Camera resolution class (2 MP is 1080p, 8 MP is 4K)."
          },
          "fps": {
            "type": "integer",
            "enum": [
              5,
              10,
              15,
              20,
              25,
              30
            ],
            "default": 15,
            "description": "Frame rate of the camera stream, frames per second. AI analysis runs at 5 FPS."
          },
          "codec": {
            "type": "string",
            "pattern": "^[.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*(?:[hH][.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*2[.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*6[.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*4|[hH][.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*2[.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*6[.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*5|[hH][.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*[eE][.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*[vV][.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*[cC])[.\\t-\\r \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*$",
            "examples": [
              "H.264",
              "H264",
              "H.265",
              "HEVC",
              "H265"
            ],
            "default": "H.265",
            "description": "Video codec. Matching ignores case, periods and whitespace. Answers use the calculator label for the chosen codec."
          },
          "scene": {
            "type": "string",
            "enum": [
              "Quiet",
              "Perimeter or quiet area",
              "Low",
              "Office or shop entrance",
              "Medium",
              "Parking lot, road or store entrance",
              "Busy",
              "Busy street, station or mall",
              "Crowd",
              "Crowds: stadium gates or main station"
            ],
            "default": "Quiet",
            "description": "How busy the scene is: Quiet: Perimeter or quiet area; Low: Office or shop entrance; Medium: Parking lot, road or store entrance; Busy: Busy street, station or mall; Crowd: Crowds: stadium gates or main station. The scene's label is also accepted."
          }
        }
      },
      "RowSettings": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "row": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "resolution": {
            "type": "string"
          },
          "fps": {
            "type": "integer"
          },
          "aiFps": {
            "type": "integer",
            "description": "AI analysis frame rate (fixed by the calculator)."
          },
          "codec": {
            "type": "string"
          },
          "scene": {
            "type": "string"
          },
          "analytics": {
            "type": "string",
            "description": "The analytics sized: CVEDIA-RT Full Suite."
          }
        },
        "required": [
          "row",
          "count",
          "resolution",
          "fps",
          "aiFps",
          "codec",
          "scene",
          "analytics"
        ]
      },
      "HaveAnswer": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "question": {
            "const": "have"
          },
          "summary": {
            "type": "string",
            "description": "A short opening sentence followed by the ordered camera rows, one per line, and any additional sizing detail."
          },
          "source": {
            "type": "string"
          },
          "corpus": {
            "type": [
              "string",
              "null"
            ],
            "description": "Fingerprint of the benchmark corpus the answer is computed from."
          },
          "calculatorUrl": {
            "type": "string",
            "format": "uri",
            "description": "Opens the calculator page with this scenario. Pass it on unchanged."
          },
          "machine": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "gpu": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "benchmarked": {
                    "type": "boolean",
                    "description": "Whether CVEDIA benchmarked this hardware."
                  }
                },
                "required": [
                  "id",
                  "name",
                  "benchmarked"
                ]
              },
              "gpus": {
                "type": "integer"
              },
              "cpu": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ]
                  }
                ]
              },
              "memoryGb": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "gpu",
              "gpus",
              "cpu",
              "memoryGb"
            ]
          },
          "answer": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "kind": {
                "enum": [
                  "capacity",
                  "fit"
                ],
                "description": "capacity: every count is 0, read each row's maximum; fit: whether the counted cameras fit."
              },
              "outcome": {
                "enum": [
                  "fits",
                  "fits_using_margin",
                  "over_capacity",
                  "no_answer",
                  null
                ],
                "description": "Null for capacity. Fit outcomes include fits within the margin, fits using margin, over capacity and no answer when an allocated row has no estimate."
              },
              "cameras": {
                "type": "integer",
                "description": "Cameras counted in all rows."
              },
              "limit": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "GPU",
                  "CPU",
                  "memory",
                  "server stream",
                  null
                ],
                "description": "What decides the fit. For capacity, a limit shared by every row, if known. Read each row for its own limit."
              },
              "cameraCapacityUsedPercent": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The calculator bar shows the share of the GPU’s camera capacity used or, beyond that capacity, needed. It can reflect CPU constraints and excludes host RAM and the server stream ceiling. Capacity is based on benchmark counts when recorded and estimated when fitted or model-backed. Whole percent, or null when there is no bar reading, including capacity queries."
              },
              "gpuUsePercent": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Estimated load on the busiest GPU resource (compute, decoding or video memory), in whole percent of its capacity before the safety margin. CPU, host memory and the server stream ceiling are separate. Null for capacity queries or when independent GPU resource estimates are unavailable for any allocated row."
              },
              "marginPercent": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The stability margin kept below the highest steady count."
              },
              "camerasThatFitWithMargin": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "When the cameras use or exceed the margin: about how many of this mix fit with it kept."
              },
              "camerasThatFitAtFullCapacity": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "When they do not fit: about how many of this mix fit at full capacity."
              },
              "memoryGbToFitAll": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Where memory stops them: a memory size that fits them all with the safety margin kept, if available."
              },
              "memoryUsePercent": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Where the cameras need more memory than they may use: their share of the memory installed."
              },
              "memoryCeilingPercent": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Maximum usable share of installed memory where memory is counted."
              },
              "memoryUpgradeKeepsMargin": {
                "enum": [
                  true,
                  null
                ],
                "description": "True for the suggested memory upgrade, null when none is given."
              },
              "testedScaleRows": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Rows whose estimate is held at the most cameras CVEDIA tested on one GPU; each GPU may run more."
              }
            },
            "required": [
              "kind",
              "outcome",
              "cameras",
              "limit",
              "cameraCapacityUsedPercent",
              "gpuUsePercent",
              "marginPercent",
              "camerasThatFitWithMargin",
              "camerasThatFitAtFullCapacity",
              "memoryGbToFitAll",
              "memoryUsePercent",
              "memoryCeilingPercent",
              "memoryUpgradeKeepsMargin",
              "testedScaleRows"
            ]
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "row": {
                  "type": "integer"
                },
                "count": {
                  "type": "integer"
                },
                "resolution": {
                  "type": "string"
                },
                "fps": {
                  "type": "integer"
                },
                "aiFps": {
                  "type": "integer",
                  "description": "AI analysis frame rate (fixed by the calculator)."
                },
                "codec": {
                  "type": "string"
                },
                "scene": {
                  "type": "string"
                },
                "analytics": {
                  "type": "string",
                  "description": "The analytics sized: CVEDIA-RT Full Suite."
                },
                "status": {
                  "enum": [
                    "counted",
                    "measured_zero",
                    "withheld",
                    "blocked_by_row_above"
                  ],
                  "description": "counted: a camera count; measured_zero: a benchmark supported no cameras; withheld: no count for lack of evidence (see reasons); blocked_by_row_above: a row above has no answer."
                },
                "maximumAfterRowsAbove": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "The most cameras of this row that fit in what the rows above (with their counts) leave free, keeping the safety margin."
                },
                "limit": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "GPU",
                    "CPU",
                    "memory",
                    "server stream",
                    null
                  ],
                  "description": "The part of the computer that decides: GPU, CPU, memory or the 500-stream ceiling of one server. Null where no part is named."
                },
                "basis": {
                  "enum": [
                    "measured",
                    "estimate"
                  ],
                  "description": "Evidence for this workload on the hardware, when a count is available."
                },
                "fit": {
                  "enum": [
                    "fits",
                    "fits_using_margin",
                    "over_capacity"
                  ],
                  "description": "Whether this row's count fits after the rows above."
                },
                "moreWithMemory": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "memoryGb": {
                      "type": "integer"
                    },
                    "maximum": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "memoryGb",
                    "maximum"
                  ]
                },
                "reasons": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "text"
                    ]
                  }
                }
              },
              "required": [
                "row",
                "count",
                "resolution",
                "fps",
                "aiFps",
                "codec",
                "scene",
                "analytics",
                "status",
                "maximumAfterRowsAbove"
              ]
            }
          }
        },
        "required": [
          "question",
          "summary",
          "source",
          "corpus",
          "calculatorUrl",
          "machine",
          "answer",
          "rows"
        ]
      },
      "NeedAnswer": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "question": {
            "const": "need"
          },
          "summary": {
            "type": "string",
            "description": "A short opening sentence followed by the ordered camera rows, one per line, and any additional sizing detail."
          },
          "source": {
            "type": "string"
          },
          "corpus": {
            "type": [
              "string",
              "null"
            ],
            "description": "Fingerprint of the benchmark corpus the answer is computed from."
          },
          "calculatorUrl": {
            "type": "string",
            "format": "uri",
            "description": "Opens the calculator page with this scenario. Pass it on unchanged."
          },
          "evaluatedOn": {
            "type": "string",
            "format": "date",
            "description": "The date the card price assumptions that rank the options are taken at."
          },
          "includeConsumerCards": {
            "type": "boolean"
          },
          "cameras": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/RowSettings"
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "row": {
                      "type": "integer"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "resolution": {
                      "type": "string"
                    },
                    "fps": {
                      "type": "integer"
                    },
                    "aiFps": {
                      "type": "integer",
                      "description": "AI analysis frame rate (fixed by the calculator)."
                    },
                    "codec": {
                      "type": "string"
                    },
                    "scene": {
                      "type": "string"
                    },
                    "analytics": {
                      "type": "string",
                      "description": "The analytics sized: CVEDIA-RT Full Suite."
                    },
                    "status": {
                      "const": "withheld",
                      "description": "Present on an allocated row of an empty answer when no eligible device can size this workload independently."
                    },
                    "reasons": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "candidates": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "candidates",
                          "text"
                        ]
                      },
                      "description": "Distinct evidence reasons for the withheld workload, each with the eligible devices it applies to. A measured zero is recorded as exact_zero."
                    }
                  },
                  "required": [
                    "row",
                    "count",
                    "resolution",
                    "fps",
                    "aiFps",
                    "codec",
                    "scene",
                    "analytics",
                    "status",
                    "reasons"
                  ]
                }
              ]
            }
          },
          "answer": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "recommendations"
              },
              "outcome": {
                "enum": [
                  "recommendations",
                  "none_without_consumer_cards",
                  "no_supported_hardware"
                ]
              },
              "cameras": {
                "type": "integer"
              },
              "marginPercent": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "outcome",
              "cameras",
              "marginPercent"
            ]
          },
          "recommendations": {
            "type": "array",
            "description": "Best first. Empty when the calculator has no recommendation for this workload and card selection.",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "rank": {
                      "type": "integer"
                    },
                    "units": {
                      "type": "integer"
                    },
                    "fit": {
                      "enum": [
                        "fits",
                        "fits_using_margin"
                      ]
                    },
                    "type": {
                      "const": "cvedia_product"
                    },
                    "product": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name"
                      ]
                    }
                  },
                  "required": [
                    "rank",
                    "units",
                    "fit",
                    "type",
                    "product"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "rank": {
                      "type": "integer"
                    },
                    "units": {
                      "type": "integer"
                    },
                    "fit": {
                      "enum": [
                        "fits",
                        "fits_using_margin"
                      ]
                    },
                    "type": {
                      "const": "server"
                    },
                    "gpu": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "benchmarked": {
                          "type": "boolean",
                          "description": "Whether CVEDIA benchmarked this hardware."
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "benchmarked"
                      ]
                    },
                    "unit": {
                      "enum": [
                        "server",
                        "box"
                      ]
                    },
                    "gpusPerUnit": {
                      "type": "integer"
                    },
                    "gpusTotal": {
                      "type": "integer",
                      "description": "GPUs in the whole fleet."
                    },
                    "host": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The class of host each server is."
                    },
                    "cpuPerUnit": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The CPU each server needs, where the calculator sizes it."
                    },
                    "memoryGbPerUnit": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Memory to put in each server or box."
                    },
                    "planningCapacityUsedPercentPerUnit": {
                      "type": "integer",
                      "description": "Whole-percent share of one unit’s camera capacity at the rounded planning load, as shown on the calculator bar. The capacity is based on benchmark or estimated camera throughput for the workload."
                    },
                    "camerasPerUnit": {
                      "type": "array",
                      "description": "Sizing allowance on a single unit. Each row’s even share is rounded up. Use the submitted counts for the fleet schedule.",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "row": {
                            "type": "integer"
                          },
                          "cameras": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "row",
                          "cameras"
                        ]
                      }
                    },
                    "testedScaleRows": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  },
                  "required": [
                    "rank",
                    "units",
                    "fit",
                    "type",
                    "gpu",
                    "unit",
                    "gpusPerUnit",
                    "gpusTotal",
                    "host",
                    "cpuPerUnit",
                    "memoryGbPerUnit",
                    "planningCapacityUsedPercentPerUnit",
                    "camerasPerUnit",
                    "testedScaleRows"
                  ]
                }
              ]
            }
          }
        },
        "required": [
          "question",
          "summary",
          "source",
          "corpus",
          "calculatorUrl",
          "evaluatedOn",
          "includeConsumerCards",
          "cameras",
          "answer",
          "recommendations"
        ]
      },
      "Problem": {
        "description": "RFC 9457 problem details.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "parameter": {
                  "type": "string",
                  "description": "The query parameter (or \"query\": the whole query, at most 4096 characters)."
                },
                "row": {
                  "type": "integer",
                  "description": "The camera row, from 1."
                },
                "field": {
                  "type": "string",
                  "description": "The field of the row."
                },
                "setting": {
                  "type": "string",
                  "description": "The setting of the calculator page."
                },
                "detail": {
                  "type": "string",
                  "description": "What it accepts."
                }
              },
              "required": [
                "parameter",
                "setting",
                "detail"
              ]
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "errors"
        ]
      }
    }
  }
}