{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/modelslab-com/json-schema/modelslab-com-video-batch-response-schema.json",
  "title": "Video batch response",
  "description": "The batch envelope, or the shared error envelope when the whole batch was refused (validation, balance, or concurrency). Always on HTTP 200.",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/modelslab-com-api-openapi.json#/components/schemas/VideoBatchResponse",
  "oneOf": [
    {
      "$ref": "#/$defs/VideoBatchAccepted"
    },
    {
      "$ref": "#/$defs/GenerationError"
    }
  ],
  "$defs": {
    "GenerationError": {
      "type": "object",
      "title": "Generation error",
      "description": "Failure envelope. Note that generation endpoints return this on HTTP 200 — branch on `status` and `code`, not on the HTTP status.",
      "required": [
        "status",
        "message"
      ],
      "properties": {
        "status": {
          "type": "string",
          "const": "error"
        },
        "code": {
          "type": "string",
          "description": "Stable machine-readable error code. Branch on this.",
          "enum": [
            "validation_error",
            "invalid_api_key",
            "unauthenticated",
            "forbidden",
            "no_subscription",
            "insufficient_balance",
            "not_found",
            "rate_limited",
            "provider_error",
            "content_moderated",
            "upstream_unavailable",
            "server_error"
          ]
        },
        "message": {
          "type": "string",
          "description": "Human-readable explanation. Wording is not stable; do not parse it."
        },
        "errors": {
          "type": "object",
          "description": "Per-field validation detail. Present when code is \"validation_error\".",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "tips": {
          "type": "string",
          "description": "Optional remediation hint."
        }
      },
      "additionalProperties": true
    },
    "VideoBatchAccepted": {
      "type": "object",
      "title": "Video batch accepted / status",
      "description": "Keyed like a single generation response (`status`, `id`, `output`, `message`, `tip`), with the batch fields on top.",
      "required": [
        "status",
        "id",
        "batch_id",
        "output",
        "request_counts",
        "results"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "processing",
            "success",
            "failed"
          ],
          "description": "\"processing\" on submit and while any request is still running; \"success\" once all succeeded; \"failed\" once all failed."
        },
        "id": {
          "type": "integer",
          "description": "The batch id, under the key a single response uses. Drawn from the same counter as request ids, so the two never collide."
        },
        "batch_id": {
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "tip": {
          "type": "string"
        },
        "output": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          },
          "description": "Every finished video across the batch in request order; empty on submit and while nothing has finished."
        },
        "future_links": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          },
          "description": "On submit: the URLs every request will publish to, in request order."
        },
        "fetch_result": {
          "type": "string",
          "format": "uri",
          "description": "Absolute URL to poll the whole batch."
        },
        "eta": {
          "type": "integer",
          "description": "Largest per-request estimate, in seconds."
        },
        "meta": {
          "type": "object",
          "description": "On submit: the envelope inputs (`model_id`, `track_id`, `webhook`).",
          "additionalProperties": true
        },
        "timeout_minutes": {
          "type": "integer",
          "description": "Requests not finished by then are failed and refunded."
        },
        "discount": {
          "type": "number",
          "description": "Fraction taken off every request's single-request price."
        },
        "request_counts": {
          "type": "object",
          "required": [
            "total",
            "processing",
            "succeeded",
            "failed"
          ],
          "properties": {
            "total": {
              "type": "integer"
            },
            "processing": {
              "type": "integer"
            },
            "succeeded": {
              "type": "integer"
            },
            "failed": {
              "type": "integer"
            }
          }
        },
        "results": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/VideoBatchResult"
          }
        }
      },
      "additionalProperties": true
    },
    "VideoBatchResult": {
      "type": "object",
      "title": "Video batch result",
      "description": "One request of a batch. The same shape the single fetch endpoint returns for that request's `id`, plus its position and correlation id.",
      "required": [
        "index",
        "status"
      ],
      "properties": {
        "index": {
          "type": "integer",
          "description": "Position in the submitted `requests` array."
        },
        "track_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": [
            "integer",
            "string"
          ],
          "description": "Request id, also pollable on the single fetch endpoint."
        },
        "status": {
          "type": "string",
          "enum": [
            "processing",
            "success",
            "failed"
          ]
        },
        "fetch_result": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "eta": {
          "type": [
            "number",
            "string",
            "null"
          ]
        },
        "output": {
          "type": [
            "array",
            "string"
          ],
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "future_links": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "message": {
          "type": "string"
        },
        "refunded": {
          "type": "boolean",
          "description": "Present on a failed result: whether the charge was reversed."
        }
      },
      "additionalProperties": true
    }
  }
}