{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudgpu-app/json-schema/cloudgpu-app-instance-schema.json",
  "title": "Instance",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/cloudgpu-app-api-openapi.json#/components/schemas/Instance",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "const": "gpu.instance"
    },
    "gpu_model": {
      "type": "string"
    },
    "gpu_count": {
      "type": "integer"
    },
    "template": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "enum": [
        "creating",
        "running",
        "stopped",
        "failed"
      ]
    },
    "hourly_usd": {
      "type": "number",
      "description": "Price per hour for the whole instance"
    },
    "created_at": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Unix seconds"
    },
    "started_at": {
      "type": [
        "integer",
        "null"
      ]
    },
    "stopped_at": {
      "type": [
        "integer",
        "null"
      ]
    },
    "running_minutes": {
      "type": [
        "integer",
        "null"
      ]
    },
    "cost_usd": {
      "type": [
        "number",
        "null"
      ],
      "description": "Spent so far while running; final charge once stopped"
    },
    "ssh": {
      "type": [
        "object",
        "null"
      ],
      "description": "SSH login once running",
      "properties": {
        "host": {
          "type": "string"
        },
        "port": {
          "type": "integer"
        },
        "user": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      }
    },
    "api_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "Public HTTPS endpoint for templates with an API"
    },
    "failure_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why provisioning failed (failed instances are not charged)"
    },
    "limits": {
      "$ref": "#/$defs/Limits"
    }
  },
  "$defs": {
    "Limits": {
      "type": [
        "object",
        "null"
      ],
      "description": "Auto-shutdown settings given at creation",
      "properties": {
        "max_minutes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "max_spend_usd": {
          "type": [
            "number",
            "null"
          ]
        },
        "idle_minutes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "expires_at": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Unix time when max_minutes ends the instance"
        },
        "stopped_by": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "max_minutes",
            "max_spend",
            "idle",
            null
          ],
          "description": "Which limit ended the instance, if one did"
        }
      }
    }
  }
}