{
  "components": {
    "schemas": {
      "Error": {
        "additionalProperties": false,
        "properties": {
          "current_price": {
            "format": "double",
            "type": "number"
          },
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "retry_after": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "Interval": {
        "additionalProperties": false,
        "properties": {
          "billed_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "cost": {
            "format": "double",
            "type": "number"
          },
          "end": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "price_per_node_hr": {
            "format": "double",
            "type": "number"
          },
          "start": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "start",
          "end",
          "price_per_node_hr",
          "billed_seconds",
          "cost"
        ],
        "type": "object"
      },
      "Node": {
        "additionalProperties": false,
        "properties": {
          "billed_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "billing_warning": {
            "type": "string"
          },
          "cleaned_at": {
            "format": "date-time",
            "type": "string"
          },
          "cost_so_far": {
            "format": "double",
            "type": "number"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "end_reason": {
            "type": "string"
          },
          "ended_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "gpu": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "ip": {
            "type": "string"
          },
          "price_per_node_hr": {
            "format": "double",
            "type": "number"
          },
          "provider": {
            "type": "string"
          },
          "ready_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "region": {
            "type": "string"
          },
          "region_class": {
            "type": "string"
          },
          "region_name": {
            "type": "string"
          },
          "release_at": {
            "format": "date-time",
            "type": "string"
          },
          "retry_after": {
            "format": "int64",
            "type": "integer"
          },
          "ssh_command": {
            "type": "string"
          },
          "ssh_port": {
            "format": "int64",
            "type": "integer"
          },
          "ssh_user": {
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "startup_failure_code": {
            "enum": [
              "capacity_unavailable"
            ],
            "type": "string"
          },
          "startup_failure_message": {
            "type": "string"
          },
          "status": {
            "enum": [
              "provisioning",
              "running",
              "preempted",
              "terminating",
              "terminated",
              "failed"
            ],
            "type": "string"
          },
          "workspace_id": {
            "type": "string"
          },
          "workspace_slot": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "gpu",
          "provider",
          "region",
          "price_per_node_hr",
          "ip",
          "ssh_user",
          "ssh_port",
          "created_at",
          "ready_at",
          "started_at",
          "ended_at",
          "billed_seconds",
          "cost_so_far"
        ],
        "type": "object"
      },
      "Price": {
        "additionalProperties": false,
        "properties": {
          "available_to_quote": {
            "type": "boolean"
          },
          "gpu": {
            "type": "string"
          },
          "gpus": {
            "format": "int64",
            "type": "integer"
          },
          "price_per_node_hr": {
            "format": "double",
            "type": "number"
          },
          "provider": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "region_class": {
            "type": "string"
          },
          "region_name": {
            "type": "string"
          },
          "supports_workspace_storage": {
            "type": "boolean"
          }
        },
        "required": [
          "gpu",
          "gpus",
          "price_per_node_hr",
          "region",
          "provider",
          "available_to_quote",
          "supports_workspace_storage"
        ],
        "type": "object"
      },
      "Request": {
        "additionalProperties": false,
        "properties": {
          "gpu": {
            "enum": [
              "h200x8",
              "h100x8",
              "h200x1",
              "h100x1",
              "mi300x8"
            ],
            "type": "string"
          },
          "idempotency_key": {
            "maxLength": 255,
            "type": "string"
          },
          "local_wait_s": {
            "format": "int64",
            "maximum": 900,
            "minimum": 0,
            "type": "integer"
          },
          "max_price_per_node_hr": {
            "format": "double",
            "minimum": 0,
            "type": "number"
          },
          "placement": {
            "enum": [
              "local_first",
              "local_only",
              "cheapest"
            ],
            "type": "string"
          },
          "providers": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "regions": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "ssh_public_keys": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "workspace_id": {
            "type": "string"
          },
          "workspace_slot": {
            "maxLength": 32,
            "type": "string"
          }
        },
        "required": [
          "gpu"
        ],
        "type": "object"
      },
      "Usage": {
        "additionalProperties": false,
        "properties": {
          "billed_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "billing_warning": {
            "type": "string"
          },
          "cleaned_at": {
            "format": "date-time",
            "type": "string"
          },
          "cost_so_far": {
            "format": "double",
            "type": "number"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "end_reason": {
            "type": "string"
          },
          "ended_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "gpu": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "intervals": {
            "items": {
              "$ref": "#/components/schemas/Interval"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "ip": {
            "type": "string"
          },
          "price_per_node_hr": {
            "format": "double",
            "type": "number"
          },
          "provider": {
            "type": "string"
          },
          "ready_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "region": {
            "type": "string"
          },
          "region_class": {
            "type": "string"
          },
          "region_name": {
            "type": "string"
          },
          "release_at": {
            "format": "date-time",
            "type": "string"
          },
          "retry_after": {
            "format": "int64",
            "type": "integer"
          },
          "ssh_command": {
            "type": "string"
          },
          "ssh_port": {
            "format": "int64",
            "type": "integer"
          },
          "ssh_user": {
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "startup_failure_code": {
            "enum": [
              "capacity_unavailable"
            ],
            "type": "string"
          },
          "startup_failure_message": {
            "type": "string"
          },
          "status": {
            "enum": [
              "provisioning",
              "running",
              "preempted",
              "terminating",
              "terminated",
              "failed"
            ],
            "type": "string"
          },
          "workspace_id": {
            "type": "string"
          },
          "workspace_slot": {
            "type": "string"
          }
        },
        "required": [
          "intervals",
          "id",
          "status",
          "gpu",
          "provider",
          "region",
          "price_per_node_hr",
          "ip",
          "ssh_user",
          "ssh_port",
          "created_at",
          "ready_at",
          "started_at",
          "ended_at",
          "billed_seconds",
          "cost_so_far"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "Nodus Spot API (pilot)",
    "version": "v1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/spot/nodes": {
      "get": {
        "operationId": "spotNodes",
        "parameters": [
          {
            "description": "Organization to select with a user token; API keys are already scoped.",
            "in": "header",
            "name": "Nodus-Org",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/Node"
                  },
                  "type": [
                    "array",
                    "null"
                  ]
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          }
        },
        "summary": "List this account's Spot nodes",
        "tags": [
          "Spot"
        ]
      },
      "post": {
        "description": "Reuse the same Idempotency-Key for every retry. A matching provisioning node is reused when no key is supplied. A preempted node releases its key. A failed node with end_reason capacity_unavailable releases its key only after confirmed cleanup, then returns retry_after seconds before another attempt. No-capacity responses create no node. Billing begins when SSH is ready.",
        "operationId": "spotRequest",
        "parameters": [
          {
            "description": "Organization to select with a user token; API keys are already scoped.",
            "in": "header",
            "name": "Nodus-Org",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Request"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Node"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          }
        },
        "summary": "Request a dedicated interruptible node",
        "tags": [
          "Spot"
        ]
      }
    },
    "/v1/spot/nodes/{id}": {
      "delete": {
        "description": "Idempotent. Billing stops when release is accepted; the node may remain terminating while deletion is retried.",
        "operationId": "spotRelease",
        "parameters": [
          {
            "description": "Organization to select with a user token; API keys are already scoped.",
            "in": "header",
            "name": "Nodus-Org",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Node"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          }
        },
        "summary": "Stop billing and delete the VM and boot disk",
        "tags": [
          "Spot"
        ]
      },
      "get": {
        "operationId": "spotNode",
        "parameters": [
          {
            "description": "Organization to select with a user token; API keys are already scoped.",
            "in": "header",
            "name": "Nodus-Org",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Node"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          }
        },
        "summary": "Read a node's status and SSH connection",
        "tags": [
          "Spot"
        ]
      }
    },
    "/v1/spot/prices": {
      "get": {
        "operationId": "spotPrices",
        "parameters": [
          {
            "description": "Organization to select with a user token; API keys are already scoped.",
            "in": "header",
            "name": "Nodus-Org",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/Price"
                  },
                  "type": [
                    "array",
                    "null"
                  ]
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          }
        },
        "summary": "Current prices in USD per complete node-hour",
        "tags": [
          "Spot"
        ]
      }
    },
    "/v1/spot/usage": {
      "get": {
        "operationId": "spotUsage",
        "parameters": [
          {
            "description": "Organization to select with a user token; API keys are already scoped.",
            "in": "header",
            "name": "Nodus-Org",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/Usage"
                  },
                  "type": [
                    "array",
                    "null"
                  ]
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Spot error or platform authentication failure"
          }
        },
        "summary": "Per-node charges and price intervals for a time window",
        "tags": [
          "Spot"
        ]
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ]
}
