{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kinopipe-com/json-schema/kinopipe-com-tool-request-schema.json",
  "title": "ToolRequest",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kinopipe-com-openapi.json#/components/schemas/ToolRequest",
  "type": "object",
  "required": [
    "inputs"
  ],
  "properties": {
    "inputs": {
      "type": "array",
      "minItems": 1,
      "maxItems": 6,
      "description": "Named HTTP(S) media inputs. Every tool requires main; multi-input tools document their additional IDs.",
      "items": {
        "$ref": "#/$defs/MediaInput"
      }
    },
    "options": {
      "type": "object",
      "additionalProperties": true,
      "default": {}
    },
    "webhook": {
      "$ref": "#/$defs/Webhook"
    },
    "maxCredits": {
      "type": "integer",
      "minimum": 1,
      "maximum": 720,
      "description": "Optional hard ceiling for billable credits. An edit is billed the greater of rounded-up worker seconds or rounded-up 6 MiB output units. An analysis is billed one credit per started minute of the media it reads, so the ceiling caps how long the input may be and is checked before the work starts. The full amount is reserved before enqueue and unused credits are refunded after success."
    }
  },
  "$defs": {
    "MediaInput": {
      "type": "object",
      "required": [
        "id",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]*$",
          "maxLength": 40,
          "description": "A stable name used by operations to reference this input."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "A public HTTP(S) URL or the mediaUrl returned by POST /api/v1/uploads."
        },
        "filename": {
          "type": "string",
          "maxLength": 180
        }
      }
    },
    "Webhook": {
      "type": "object",
      "required": [
        "url",
        "secret"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "A public HTTPS endpoint using the default port."
        },
        "secret": {
          "type": "string",
          "minLength": 16,
          "maxLength": 256,
          "writeOnly": true,
          "description": "Used to sign X-KinoPipe-Signature with HMAC-SHA256."
        },
        "events": {
          "type": "array",
          "minItems": 1,
          "maxItems": 2,
          "items": {
            "type": "string",
            "enum": [
              "job.succeeded",
              "job.failed"
            ]
          },
          "default": [
            "job.succeeded",
            "job.failed"
          ]
        }
      }
    }
  }
}