{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/animgen-com/json-schema/animgen-com-animation-create-request-schema.json",
  "title": "AnimationCreateRequest",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/animgen-com-openapi.json#/components/schemas/AnimationCreateRequest",
  "properties": {
    "input": {
      "$ref": "#/$defs/GenerationInput",
      "description": "Images owned by the caller or supplied for this generation.",
      "x-description-zh": "调用方所属或本次提供的生成图片。"
    },
    "prompt": {
      "type": "string",
      "maxLength": 8000,
      "title": "Prompt",
      "description": "Motion instruction; nonempty when the model requires a prompt. Keep private prompts out of logs.",
      "default": "",
      "x-description-zh": "动作提示词；模型要求时不能为空，私有提示词不得写入日志。"
    },
    "negative_prompt": {
      "type": "string",
      "maxLength": 4000,
      "title": "Negative Prompt",
      "description": "Optional exclusions, only when the model supports negative prompts.",
      "default": "",
      "x-description-zh": "可选负向提示词，仅适用于支持的模型。"
    },
    "video": {
      "$ref": "#/$defs/VideoOptions",
      "description": "Model-compatible generation settings.",
      "default": {
        "transparency": {
          "key_selection": "auto",
          "mode": "standard"
        }
      },
      "x-description-zh": "符合模型能力的生成设置。"
    },
    "metadata": {
      "additionalProperties": true,
      "type": "object",
      "title": "Metadata",
      "description": "Caller metadata: simple string/number/boolean/null values, at most 4 KiB JSON. Do not store secrets.",
      "default": {},
      "x-description-zh": "调用方元数据，仅字符串、数字、布尔或 null；JSON 不超过 4 KiB，不存凭据。"
    },
    "selection": {
      "$ref": "#/$defs/Selection",
      "description": "Interval selected after generation; full by default.",
      "default": {
        "mode": "full",
        "start_seconds": 0.0
      },
      "x-description-zh": "生成后选取的区间，默认完整视频。"
    },
    "export": {
      "$ref": "#/$defs/ExportOptions",
      "description": "Export after video generation. Alpha-bearing formats require an alpha_key source; compatible formats automatically enable its transparent export.",
      "default": {
        "output_formats": [
          "spritesheet"
        ],
        "frame_count": 24,
        "output_width": 512,
        "output_height": 512,
        "transparent": {
          "enabled": false
        },
        "unity": {
          "pivot": "bottom_center",
          "pixels_per_unit": 100
        }
      },
      "x-description-zh": "视频生成后执行导出；带 Alpha 的格式要求 alpha_key 来源，适配格式会自动启用其透明处理。"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "input"
  ],
  "$defs": {
    "Base64ImageInput": {
      "properties": {
        "type": {
          "type": "string",
          "const": "base64",
          "title": "Type"
        },
        "media_type": {
          "type": "string",
          "enum": [
            "image/png",
            "image/jpeg",
            "image/webp"
          ],
          "title": "Media Type",
          "description": "Actual image MIME type.",
          "x-description-zh": "图片实际 MIME 类型。"
        },
        "data": {
          "type": "string",
          "minLength": 4,
          "title": "Data",
          "description": "Pure Base64 without a data URL prefix; decoded limits: 10 MiB per image, 20 MiB total.",
          "x-description-zh": "纯 Base64，不含 data URL 前缀；解码后单张 10 MiB、合计 20 MiB。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "type",
        "media_type",
        "data"
      ],
      "title": "Base64ImageInput"
    },
    "ExportOptions": {
      "properties": {
        "output_formats": {
          "items": {
            "type": "string",
            "enum": [
              "clip_video",
              "webm_alpha",
              "prores_4444",
              "gif",
              "frames_zip",
              "spritesheet",
              "spritesheet_json",
              "unity_meta",
              "unity_pack",
              "godot_pack",
              "unreal_paper2d_pack",
              "cocos_creator_pack",
              "construct3_pack"
            ]
          },
          "type": "array",
          "minItems": 1,
          "title": "Output Formats",
          "description": "Requested asset formats; defaults to spritesheet in frame_count mode, or spritesheet plus spritesheet_json in FPS mode. Duplicates are removed. Metadata needs its matching texture.",
          "default": [
            "spritesheet"
          ],
          "x-description-zh": "请求的资产格式；帧数模式默认 spritesheet，FPS 模式默认 spritesheet 加 spritesheet_json。重复项会去重，元数据需配套纹理。"
        },
        "frame_count": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 240.0,
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Frame Count",
          "description": "Legacy uniform frame count, mutually exclusive with fps. When both are omitted, uses 24 frames.",
          "x-description-zh": "旧版等间隔帧数，与 fps 互斥；两者均省略时使用 24 帧。"
        },
        "fps": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 60.0,
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Fps",
          "description": "Source-speed sampling frequency, without interpolation. Independent exports only; requires spritesheet and spritesheet_json. A short final frame preserves the selection duration.",
          "x-description-zh": "按源视频原速采样，不补帧；仅用于独立导出，需 spritesheet 和 spritesheet_json；短尾帧保留选区总时长。"
        },
        "output_width": {
          "type": "integer",
          "maximum": 1024.0,
          "minimum": 64.0,
          "title": "Output Width",
          "description": "Output frame width in pixels.",
          "default": 512,
          "x-description-zh": "输出帧宽度，单位像素。"
        },
        "output_height": {
          "type": "integer",
          "maximum": 1024.0,
          "minimum": 64.0,
          "title": "Output Height",
          "description": "Output frame height in pixels.",
          "default": 512,
          "x-description-zh": "输出帧高度，单位像素。"
        },
        "transparent": {
          "$ref": "#/$defs/ExportTransparency",
          "description": "Use the enabled object form. Legacy booleans are accepted but normalized to this object.",
          "default": {
            "enabled": false
          },
          "x-description-zh": "使用 enabled 对象形式；兼容布尔值输入并规范化为此对象。"
        },
        "unity": {
          "$ref": "#/$defs/UnityOptions",
          "description": "Settings for Unity-specific metadata and packs.",
          "default": {
            "pixels_per_unit": 100,
            "pivot": "bottom_center"
          },
          "x-description-zh": "Unity 专用元数据和资源包设置。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "ExportOptions"
    },
    "ExportTransparency": {
      "properties": {
        "enabled": {
          "type": "boolean",
          "title": "Enabled",
          "description": "Transparent processing for compatible outputs; requires an alpha_key source and does not make MP4 transparent.",
          "default": false,
          "x-description-zh": "为兼容输出启用透明处理；要求 alpha_key 来源，不会让 MP4 透明。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "ExportTransparency"
    },
    "FileImageInput": {
      "properties": {
        "type": {
          "type": "string",
          "const": "file",
          "title": "Type"
        },
        "file_id": {
          "type": "string",
          "format": "uuid",
          "title": "File Id",
          "description": "Owned public file ID from POST /files or complete_image_upload; not a Studio upload ID.",
          "x-description-zh": "POST /files 或 complete_image_upload 返回的所属公共文件 ID，不是 Studio uploadId。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "type",
        "file_id"
      ],
      "title": "FileImageInput"
    },
    "GenerationInput": {
      "properties": {
        "first_frame": {
          "oneOf": [
            {
              "$ref": "#/$defs/FileImageInput"
            },
            {
              "$ref": "#/$defs/Base64ImageInput"
            },
            {
              "$ref": "#/$defs/UrlImageInput"
            }
          ],
          "title": "First Frame",
          "description": "Required starting image; use the type discriminator to select an input representation.",
          "x-description-zh": "必需首帧，用 type 选择图片传入方式。"
        },
        "last_frame": {
          "anyOf": [
            {
              "oneOf": [
                {
                  "$ref": "#/$defs/FileImageInput"
                },
                {
                  "$ref": "#/$defs/Base64ImageInput"
                },
                {
                  "$ref": "#/$defs/UrlImageInput"
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Frame",
          "description": "Optional end image; the selected model must support first/last-frame mode.",
          "x-description-zh": "可选尾帧，所选模型必须支持首尾帧模式。"
        },
        "reference_images": {
          "items": {
            "oneOf": [
              {
                "$ref": "#/$defs/FileImageInput"
              },
              {
                "$ref": "#/$defs/Base64ImageInput"
              },
              {
                "$ref": "#/$defs/UrlImageInput"
              }
            ]
          },
          "type": "array",
          "maxItems": 8,
          "title": "Reference Images",
          "description": "Additional references, excluding the first frame. The live model can impose a smaller limit.",
          "default": [],
          "x-description-zh": "额外参考图，不含首帧；实时模型可能有更低上限。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "first_frame"
      ],
      "title": "GenerationInput"
    },
    "GenerationTransparency": {
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "standard",
            "alpha_key"
          ],
          "title": "Mode",
          "description": "standard keeps the scene; alpha_key requires meaningful alpha in all active input images. Raw videos remain opaque.",
          "default": "standard",
          "x-description-zh": "standard 保留场景；alpha_key 要求所有参与图片有有效 Alpha，原始视频仍不透明。"
        },
        "key_color": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Key Color",
          "description": "Temporary key color when using manual selection; normally leave automatic selection enabled.",
          "x-description-zh": "手动选择时使用的临时键色；通常保留自动选择。"
        },
        "key_selection": {
          "type": "string",
          "enum": [
            "auto",
            "manual"
          ],
          "title": "Key Selection",
          "description": "How the temporary key color is selected.",
          "default": "auto",
          "x-description-zh": "临时键色的选择方式。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "GenerationTransparency"
    },
    "InputCanvasOptions": {
      "properties": {
        "enabled": {
          "type": "boolean",
          "title": "Enabled",
          "description": "Whether to prepare an expanded input canvas.",
          "default": true,
          "x-description-zh": "是否准备扩展输入画布。"
        },
        "source_scale": {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.5,
          "title": "Source Scale",
          "description": "Source subject scale within the canvas.",
          "default": 0.8,
          "x-description-zh": "原图主体在画布中的缩放比例。"
        },
        "position_x": {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0,
          "title": "Position X",
          "description": "Normalized horizontal source position.",
          "default": 0.5,
          "x-description-zh": "归一化水平位置。"
        },
        "position_y": {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0,
          "title": "Position Y",
          "description": "Normalized vertical source position.",
          "default": 0.5,
          "x-description-zh": "归一化垂直位置。"
        },
        "aspect_ratio": {
          "type": "string",
          "enum": [
            "follow_output",
            "source"
          ],
          "title": "Aspect Ratio",
          "description": "Follow the output ratio or preserve the source ratio.",
          "default": "follow_output",
          "x-description-zh": "跟随输出比例或保持原图比例。"
        },
        "background": {
          "type": "string",
          "enum": [
            "auto",
            "transparent",
            "solid"
          ],
          "title": "Background",
          "description": "Canvas extension background strategy.",
          "default": "auto",
          "x-description-zh": "画布扩展区域的背景策略。"
        },
        "background_color": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^#[0-9A-Fa-f]{6}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Background Color",
          "description": "Six-digit RGB color for a solid extension.",
          "x-description-zh": "纯色扩展区域的六位 RGB 颜色。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "InputCanvasOptions"
    },
    "Selection": {
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "full",
            "range"
          ],
          "title": "Mode",
          "description": "full uses the complete source; range requires duration_seconds.",
          "default": "full",
          "x-description-zh": "full 使用完整来源；range 必须提供 duration_seconds。"
        },
        "start_seconds": {
          "type": "number",
          "minimum": 0.0,
          "title": "Start Seconds",
          "description": "Range start in seconds from the source beginning.",
          "default": 0.0,
          "x-description-zh": "相对源视频起点的选段开始秒数。"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "type": "number",
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration Seconds",
          "description": "Required when mode=range; positive interval length in seconds.",
          "x-description-zh": "mode=range 时必填，选段时长秒数必须为正。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "Selection"
    },
    "UnityOptions": {
      "properties": {
        "pixels_per_unit": {
          "type": "integer",
          "maximum": 1000.0,
          "minimum": 1.0,
          "title": "Pixels Per Unit",
          "description": "Unity texture pixels per world unit.",
          "default": 100,
          "x-description-zh": "Unity 每世界单位对应的纹理像素数。"
        },
        "pivot": {
          "type": "string",
          "const": "bottom_center",
          "title": "Pivot",
          "description": "Supported Unity sprite pivot.",
          "default": "bottom_center",
          "x-description-zh": "支持的 Unity 精灵锚点。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "UnityOptions"
    },
    "UrlImageInput": {
      "properties": {
        "type": {
          "type": "string",
          "const": "url",
          "title": "Type"
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "minLength": 9,
          "title": "Url",
          "description": "Public HTTPS image on port 443, without credentials or fragments. Private networks and unsafe redirects are rejected. Keep bytes stable across retries.",
          "x-description-zh": "公开 HTTPS 图片，443 端口，不带凭据或 fragment；禁止私网和不安全跳转，重试期间保持图片字节稳定。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "type",
        "url"
      ],
      "title": "UrlImageInput"
    },
    "VideoOptions": {
      "properties": {
        "model": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Model",
          "description": "provider:model ID from GET /models; omission uses the configured default model.",
          "x-description-zh": "GET /models 返回的 provider:model ID；省略时使用配置的默认模型。"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "type": "number",
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration Seconds",
          "description": "Seconds; choose a supported duration for the model and resolution. Omission uses its default.",
          "x-description-zh": "秒数，需符合模型与分辨率支持范围；省略时使用模型默认值。"
        },
        "resolution": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resolution",
          "description": "Resolution value from the live model catalog.",
          "x-description-zh": "实时模型目录中的分辨率值。"
        },
        "ratio": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ratio",
          "description": "Aspect ratio supported by the current model and input mode.",
          "x-description-zh": "当前模型与输入模式支持的画幅比例。"
        },
        "seed": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 2147483647.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Seed",
          "description": "Optional seed only for models advertising seed support; not a universal determinism guarantee.",
          "x-description-zh": "仅适用于声明支持 seed 的模型，不保证所有输出确定性。"
        },
        "style_preset": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Style Preset",
          "description": "Optional style preset supported by the selected provider/model.",
          "x-description-zh": "所选供应商或模型支持的可选风格预设。"
        },
        "watermark": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Watermark",
          "description": "Optional watermark setting; check the model capability.",
          "x-description-zh": "可选水印设置，需检查模型能力。"
        },
        "transparency": {
          "$ref": "#/$defs/GenerationTransparency",
          "description": "Source transparency workflow; transparent exports require alpha_key.",
          "default": {
            "mode": "standard",
            "key_selection": "auto"
          },
          "x-description-zh": "来源透明流程；透明导出要求 alpha_key。"
        },
        "input_canvas": {
          "anyOf": [
            {
              "$ref": "#/$defs/InputCanvasOptions"
            },
            {
              "type": "null"
            }
          ],
          "description": "Optional input framing; omit to keep the source framing.",
          "x-description-zh": "可选输入画布设置；省略时保持来源构图。"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "VideoOptions"
    }
  }
}