{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.computetable.com/data/instances.schema.json",
  "title": "ComputeTable instance prices",
  "description": "Shape of https://www.computetable.com/data/instances.json (schemaVersion 1). Docs: https://www.computetable.com/docs/api. Data license: CC BY 4.0; GPU prices must also credit https://gpuadvisor.com.",
  "type": "object",
  "required": [
    "schemaVersion",
    "updatedAt",
    "generatedAt",
    "currency",
    "note",
    "count",
    "rows"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1,
      "description": "Bumped only on breaking changes. New optional fields may appear without a bump."
    },
    "license": {
      "type": "string",
      "description": "Terms for reusing the data."
    },
    "attribution": {
      "type": "string",
      "description": "Required credit when reusing the data."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When this file was last written."
    },
    "generatedAt": {
      "type": "string",
      "description": "Same moment as updatedAt, formatted 'YYYY-MM-DD HH:MM' (UTC)."
    },
    "gpuUpdatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When GPU list prices were last refreshed (every ~6 hours)."
    },
    "cpuSnapshotAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the CPU/VM snapshot was assembled. Use cpuPricedAt for when prices were collected."
    },
    "cpuPricedAt": {
      "type": "object",
      "description": "Date (YYYY-MM-DD) each provider's CPU/VM prices were collected, keyed by providerId. Can differ by months between providers.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "currency": {
      "const": "USD"
    },
    "note": {
      "type": "string"
    },
    "count": {
      "type": "integer",
      "minimum": 0,
      "description": "Number of rows."
    },
    "rows": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/row"
      }
    }
  },
  "$defs": {
    "nullableNumber": {
      "type": [
        "number",
        "null"
      ]
    },
    "row": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "instance",
        "cpu",
        "vcpu",
        "ramGb",
        "arch",
        "provider",
        "providerId",
        "region",
        "pricing",
        "priceHr",
        "priceVcpuHr",
        "priceRamGbHr"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Stable unique id within the file."
        },
        "kind": {
          "enum": [
            "cpu",
            "gpu"
          ]
        },
        "instance": {
          "type": "string",
          "description": "Provider's instance/plan name. Names starting 'cheapest_' are the provider's lowest listed offer for that GPU."
        },
        "cpu": {
          "type": "string",
          "description": "CPU family (e.g. 'AMD EPYC'); 'GPU host' for GPU rows."
        },
        "cpuDetail": {
          "type": [
            "string",
            "null"
          ]
        },
        "vcpu": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Host vCPUs. Placeholder when vcpuUnknown is true."
        },
        "ramGb": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Host RAM in GB. Placeholder when ramUnknown is true."
        },
        "vcpuUnknown": {
          "type": "boolean",
          "description": "True when the source did not publish vCPUs; ignore vcpu and priceVcpuHr."
        },
        "ramUnknown": {
          "type": "boolean",
          "description": "True when the source did not publish RAM; ignore ramGb and priceRamGbHr."
        },
        "diskGb": {
          "$ref": "#/$defs/nullableNumber",
          "description": "Included disk in GB, null if unknown or none."
        },
        "diskType": {
          "enum": [
            "nvme",
            "ssd",
            "hdd",
            "local",
            "network",
            null
          ]
        },
        "arch": {
          "enum": [
            "x86",
            "arm64"
          ]
        },
        "family": {
          "type": [
            "string",
            "null"
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "provider": {
          "type": "string",
          "description": "Display name, e.g. 'Google Cloud'."
        },
        "providerId": {
          "type": "string",
          "description": "Stable lowercase id, e.g. 'gcp'."
        },
        "region": {
          "type": "string",
          "description": "Provider region, or 'global' when the source gives none."
        },
        "pricing": {
          "const": "on-demand"
        },
        "priceHr": {
          "type": "number",
          "minimum": 0,
          "description": "USD per hour for the whole instance."
        },
        "priceVcpuHr": {
          "type": "number",
          "minimum": 0
        },
        "priceRamGbHr": {
          "type": "number",
          "minimum": 0
        },
        "priceDiskGbHr": {
          "$ref": "#/$defs/nullableNumber"
        },
        "gpu": {
          "type": [
            "string",
            "null"
          ],
          "description": "GPU model, e.g. 'H100'. Null for CPU rows."
        },
        "gpuCount": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        },
        "vramGb": {
          "$ref": "#/$defs/nullableNumber",
          "description": "Memory per GPU in GB."
        },
        "priceGpuHr": {
          "$ref": "#/$defs/nullableNumber",
          "description": "USD per GPU per hour."
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Provider pricing page."
        },
        "specsEstimated": {
          "type": "boolean",
          "deprecated": true,
          "description": "Legacy: same as vcpuUnknown and ramUnknown both true."
        }
      }
    }
  }
}
