{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aquanode-io/json-schema/aquanode-io-create-deployment-schema.json",
  "title": "CreateDeployment",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aquanode-io-openapi.json#/components/schemas/CreateDeployment",
  "type": "object",
  "properties": {
    "resource": {
      "type": "object",
      "properties": {
        "cpu": {
          "type": "number",
          "minimum": 1
        },
        "name": {
          "type": "string"
        },
        "memory": {
          "type": "string"
        },
        "storage": {
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "gpuUnits": {
          "type": "number"
        },
        "gpuModel": {
          "type": "string"
        },
        "desiredInstanceId": {
          "type": "string"
        },
        "location_id": {
          "type": "string"
        },
        "cloud_type": {
          "type": "string",
          "enum": [
            "secure",
            "community"
          ]
        }
      },
      "required": [
        "cpu",
        "memory",
        "storage"
      ]
    },
    "provider": {
      "$ref": "#/$defs/Provider"
    },
    "serviceConfig": {
      "$ref": "#/$defs/ServiceConfig"
    },
    "idlePolicy": {
      "type": "object",
      "properties": {
        "warnAfterMinutes": {
          "type": "integer",
          "minimum": 0,
          "exclusiveMinimum": true
        },
        "actAfterMinutes": {
          "type": "integer",
          "minimum": 0,
          "exclusiveMinimum": true
        },
        "gpuIdleThresholdPercent": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "autoStopEnabled": {
          "type": "boolean"
        }
      }
    },
    "ephemeralTtlMinutes": {
      "type": "number",
      "minimum": 0,
      "exclusiveMinimum": true
    },
    "maxPricePerHourUsd": {
      "type": "number",
      "minimum": 0,
      "exclusiveMinimum": true
    }
  },
  "required": [
    "resource",
    "provider",
    "serviceConfig"
  ],
  "$defs": {
    "Provider": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "enum": [
            "akash",
            "voltagepark",
            "datacrunch",
            "hotaisle",
            "vastai",
            "massecompute",
            "cudocompute",
            "hyperstack",
            "vultr",
            "simplepod",
            "runpod",
            "nebius",
            "jarvislabs",
            "aws"
          ],
          "description": "The cloud provider to use for the deployment"
        }
      },
      "required": [
        "name"
      ]
    },
    "ServiceConfig": {
      "allOf": [
        {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "VMS"
                  ]
                },
                "vmSlug": {
                  "type": "string"
                },
                "template": {
                  "type": "string",
                  "enum": [
                    "comfyui",
                    "torch_and_jupyter"
                  ]
                },
                "env": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "sshKeyId": {
                  "type": "string",
                  "minLength": 1
                },
                "sshPassword": {
                  "type": "string"
                },
                "snapshotterConfig": {
                  "type": "string",
                  "default": "aquanode"
                },
                "setupScript": {
                  "type": "string"
                },
                "firewallRules": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "post_deployment": {
                  "type": "object",
                  "properties": {
                    "startup_script_id": {
                      "type": "string"
                    },
                    "restore_from_deployment": {
                      "type": "string"
                    },
                    "enable_metrics": {
                      "type": "boolean"
                    },
                    "enable_backups": {
                      "type": "boolean"
                    },
                    "attach_workspace": {
                      "type": "string"
                    },
                    "attach_model": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "huggingface"
                          ]
                        },
                        "repoId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "revision": {
                          "type": "string",
                          "minLength": 1
                        },
                        "placement": {
                          "type": "string",
                          "enum": [
                            "hf_cache",
                            "comfyui_dir"
                          ],
                          "default": "hf_cache"
                        },
                        "comfyuiDir": {
                          "type": "string",
                          "minLength": 1
                        },
                        "hfToken": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "source",
                        "repoId"
                      ]
                    }
                  }
                }
              },
              "required": [
                "type",
                "vmSlug",
                "sshKeyId"
              ]
            },
            {
              "type": "object",
              "properties": {
                "logsStorageConfig": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "DOCKER_IMAGE"
                  ]
                },
                "image": {
                  "type": "string"
                },
                "tag": {
                  "type": "string",
                  "default": "latest"
                },
                "command": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "snapshotterConfig": {
                  "type": "string",
                  "default": "aquanode"
                },
                "args": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "dockerSlug": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "image",
                "dockerSlug"
              ]
            }
          ]
        },
        {
          "type": "object",
          "properties": {
            "env": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "appPort": {
              "type": "number"
            },
            "appPorts": {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          }
        }
      ]
    }
  }
}