{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudgpu-app/json-schema/cloudgpu-app-job-request-schema.json",
  "title": "JobRequest",
  "description": "Give gpu_model, template or quote_id.",
  "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/JobRequest",
  "type": "object",
  "required": [
    "command",
    "max_minutes",
    "max_spend_usd"
  ],
  "properties": {
    "command": {
      "type": "string",
      "maxLength": 32768,
      "description": "Bash command run once on the GPU. If the live automatic_output_collection capability is true, declare outputs and write those files under $CLOUDGPU_OUTPUT_DIR. Otherwise save results explicitly before release."
    },
    "gpu_model": {
      "type": "string"
    },
    "template": {
      "type": "string"
    },
    "gpu_count": {
      "type": "integer",
      "minimum": 1,
      "maximum": 8
    },
    "disk_gb": {
      "type": "integer",
      "description": "Optional larger system disk, one of the catalog's disk_options"
    },
    "max_minutes": {
      "type": "integer",
      "minimum": 1,
      "description": "Time limit for the whole job, enforced by the server"
    },
    "max_spend_usd": {
      "type": "number",
      "description": "Spend limit for the whole job, enforced by the server"
    },
    "quote_id": {
      "type": "string",
      "description": "Optional; binds the job to a quote like POST /v1/gpu/instances does"
    },
    "workspace_version_id": {
      "type": "string",
      "pattern": "^wsv_[0-9a-f]{32}$",
      "description": "Optional immutable Workspace version, restored into a fresh project directory before the command. Requires enabled storage. Does not save changed files automatically or restore a boot disk."
    },
    "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"
    }
  },
  "$defs": {
    "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"
          }
        }
      }
    }
  }
}