{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aitopia-ai/json-schema/aitopia-ai-request-schema.json",
  "title": "Request",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aitopia-ai-openapi.json#/components/schemas/Request",
  "type": "object",
  "required": [
    "request_id",
    "status",
    "endpoint",
    "created_at",
    "completed_at",
    "credits_estimated",
    "output",
    "status_url",
    "result_url",
    "cancel_url"
  ],
  "properties": {
    "request_id": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/RequestStatus"
    },
    "endpoint": {
      "type": "string"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "credits_estimated": {
      "type": [
        "number",
        "null"
      ]
    },
    "output": {
      "$ref": "#/$defs/Output"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Item"
      }
    },
    "error": {
      "$ref": "#/$defs/error"
    },
    "aitopia_url": {
      "type": "string",
      "format": "uri"
    },
    "status_url": {
      "type": "string",
      "format": "uri"
    },
    "result_url": {
      "type": "string",
      "format": "uri"
    },
    "cancel_url": {
      "type": "string",
      "format": "uri"
    }
  },
  "$defs": {
    "Item": {
      "type": "object",
      "required": [
        "status",
        "output"
      ],
      "properties": {
        "index": {
          "type": "integer"
        },
        "status": {
          "$ref": "#/$defs/RequestStatus"
        },
        "output": {
          "$ref": "#/$defs/Output"
        },
        "error": {
          "$ref": "#/$defs/error"
        },
        "credits_estimated": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    },
    "Media": {
      "type": "object",
      "required": [
        "url",
        "content_type"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "content_type": {
          "type": "string"
        },
        "width": {
          "type": "number"
        },
        "height": {
          "type": "number"
        },
        "duration": {
          "type": "number"
        }
      }
    },
    "Output": {
      "type": "object",
      "required": [
        "images",
        "videos",
        "audio",
        "files"
      ],
      "properties": {
        "images": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Media"
          }
        },
        "videos": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Media"
          }
        },
        "audio": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Media"
          }
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "content_type": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    },
    "RequestStatus": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "completed",
        "partial",
        "failed",
        "cancelled"
      ]
    }
  }
}