{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudgpu-app/json-schema/cloudgpu-app-job-schema.json",
  "title": "Job",
  "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/Job",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "enum": [
        "job"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "provisioning",
        "running",
        "stopping",
        "succeeded",
        "failed",
        "cancelled",
        "needs_attention"
      ],
      "description": "needs_attention: CloudGPU stopped the job because it could not confirm the state of its GPU, and will not retry it automatically."
    },
    "gpu_model": {
      "type": "string"
    },
    "gpu_count": {
      "type": "integer"
    },
    "template": {
      "type": [
        "string",
        "null"
      ]
    },
    "disk_gb": {
      "type": "integer"
    },
    "max_minutes": {
      "type": "integer"
    },
    "max_spend_usd": {
      "type": "number"
    },
    "instance_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The GPU instance this job runs on; also readable with GET /v1/gpu/instances/{id}"
    },
    "attempt": {
      "type": "integer"
    },
    "cancel_requested": {
      "type": "boolean"
    },
    "exit_code": {
      "type": [
        "integer",
        "null"
      ]
    },
    "cost_usd": {
      "type": [
        "number",
        "null"
      ]
    },
    "error": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "created_at": {
      "type": "integer"
    },
    "started_at": {
      "type": [
        "integer",
        "null"
      ]
    },
    "finished_at": {
      "type": [
        "integer",
        "null"
      ]
    },
    "updated_at": {
      "type": "integer"
    },
    "workspace_version_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "model_references": {
      "type": "array",
      "maxItems": 4,
      "items": {
        "$ref": "#/$defs/ModelReference"
      },
      "description": "Pinned public files, at most 100 GB across all references. Downloads go directly to the rented GPU after Workspace restore and consume the same time/spend limits. No platform model cache, dependency install or remote repository code execution."
    },
    "outputs": {
      "$ref": "#/$defs/JobOutputs"
    },
    "output_collection": {
      "$ref": "#/$defs/JobOutputCollection"
    }
  },
  "$defs": {
    "JobOutputCollection": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "collecting",
            "succeeded",
            "failed",
            "skipped"
          ]
        },
        "code": {
          "type": "string"
        },
        "cleanup_pending": {
          "type": "integer",
          "minimum": 0,
          "description": "Last collection attempt, not a live counter."
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "file_id": {
                "type": "string"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "size_bytes": {
                "type": "integer",
                "minimum": 0
              },
              "status": {
                "type": "string",
                "enum": [
                  "uploading",
                  "ready",
                  "deleted",
                  "cleanup_pending"
                ]
              }
            }
          }
        }
      },
      "description": "Only succeeded confirms all requested results are stored. Ready partial files may be downloaded with existing storage APIs. Collection failure does not prevent GPU release or trigger a retry. No signed URLs are returned."
    },
    "JobOutputs": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "required": [
        "files"
      ],
      "properties": {
        "files": {
          "type": "array",
          "minItems": 1,
          "maxItems": 16,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "maxLength": 512
          },
          "description": "Explicit relative regular files under $CLOUDGPU_OUTPUT_DIR. No globs, hidden/credential names, symlinks, hardlinks or device files."
        },
        "max_bytes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 104857600,
          "default": 10485760,
          "description": "Total transfer limit, not an extra storage allowance."
        },
        "accept_storage_charges": {
          "type": "boolean",
          "default": false,
          "description": "Only after explicit agreement to existing paid storage terms. Budget-limited Agent keys cannot consent to paid storage."
        }
      }
    },
    "ModelFile": {
      "type": "object",
      "required": [
        "path",
        "size_bytes"
      ],
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "maxLength": 240,
          "description": "Explicit relative path; no empty, dot or parent segments."
        },
        "size_bytes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100000000000
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Independently verified SHA-256; required when using an instance mirror."
        }
      }
    },
    "ModelReference": {
      "type": "object",
      "required": [
        "name",
        "repo_id",
        "revision",
        "files"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,47}$"
        },
        "repo_id": {
          "type": "string",
          "description": "Public Hugging Face owner/repo; no URL, token or private/gated repository."
        },
        "revision": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$"
        },
        "files": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "items": {
            "$ref": "#/$defs/ModelFile"
          }
        }
      }
    }
  }
}