> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apipod.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Genjutsu 对象替换

> Higgsfield Genjutsu 对象替换使用 1–10 张参考图局部替换 4–30 秒源 MP4 视频中的物体或商品，支持 480p / 720p / 1080p。

> [!NOTE]
>
> 必须通过 `video_urls` 传入恰好 1 段公开 HTTPS MP4 源视频（`4–30` 秒），并通过 `image_urls` 传入 `1–10` 张替换物参考图。提示词可省略（上限 5000 字符），建议用 `@video_1` 与 `@image_1` 指明源视频与替换图。支持 `480p`、`720p`（默认）、`1080p`，成片时长与画幅跟随源视频。


## OpenAPI

````yaml api-reference/openapi/genjutsu--genjutsu-1-0-object-swap.zh.yaml POST /v1/videos/generations
openapi: 3.1.0
info:
  title: Genjutsu 对象替换 API
  version: 1.0.0
  description: >-
    Higgsfield Genjutsu 对象替换使用 1-10 张参考图局部替换 4-30 秒源 MP4 视频中的物体或商品，保留原始运镜与周围画面。在
    APIPod 中，公开模型 ID 为 genjutsu-1.0-object-swap。
servers:
  - url: https://api.apipod.ai
    description: 生产环境
security: []
paths:
  /v1/videos/generations:
    post:
      tags:
        - Genjutsu 对象替换
      summary: 创建生成任务
      description: >-
        传入恰好 1 段 4-30 秒公开 HTTPS MP4 源视频与 1-10 张替换物参考图，支持 480p / 720p /
        1080p，成片时长与画幅跟随源视频。公开模型 ID 为 genjutsu-1.0-object-swap。
      operationId: create-genjutsu-genjutsu-1-0-object-swap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              title: Genjutsu 对象替换
              properties:
                model:
                  type: string
                  title: 模型 ID
                  description: APIPod 公开模型 ID。
                  const: genjutsu-1.0-object-swap
                video_urls:
                  type: array
                  title: 源视频
                  description: 必填。恰好 1 段公开 HTTPS MP4 视频（4-30 秒），成片时长与画幅跟随源视频。
                  items:
                    type: string
                    description: 公开 HTTPS MP4 视频地址。
                  minItems: 1
                  maxItems: 1
                image_urls:
                  type: array
                  title: 参考图片
                  description: 必填。1-10 张公开 HTTPS 替换物体或商品参考图地址。
                  items:
                    type: string
                    description: 公开 HTTPS 图片地址。
                  minItems: 1
                  maxItems: 10
                prompt:
                  type: string
                  title: 提示词
                  description: 可选，上限 5000 字符。可使用 @video_1 与 @image_1 指明源视频与替换图。
                  maxLength: 5000
                resolution:
                  type: string
                  title: 分辨率
                  description: 输出分辨率（480p、720p 或 1080p，默认 720p）。
                  enum:
                    - 480p
                    - 720p
                    - 1080p
                  default: 720p
                callback_url:
                  type: string
                  title: 回调地址
                  description: 可选，任务完成后的 Webhook 通知地址。
              required:
                - model
                - video_urls
                - image_urls
            example:
              model: genjutsu-1.0-object-swap
              video_urls:
                - https://cdn.example.com/source-table.mp4
              image_urls:
                - https://cdn.example.com/ceramic-cup.png
              prompt: 把 @video_1 里的红色马克杯换成 @image_1 里的陶瓷杯。
              resolution: 720p
      responses:
        '200':
          description: 任务已受理
          content:
            application/json:
              schema:
                type: object
                title: 任务提交响应
                properties:
                  code:
                    type: integer
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                        description: 生成任务 ID
                  message:
                    type: string
                required:
                  - code
                  - message
                  - data
              example:
                code: 200
                message: success
                data:
                  task_id: vid_task_01JEXAMPLE
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          label: cURL
          source: |-
            curl https://api.apipod.ai/v1/videos/generations \
              -H "Authorization: Bearer $APIPOD_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
              "model": "genjutsu-1.0-object-swap",
              "video_urls": ["https://cdn.example.com/source-table.mp4"],
              "image_urls": ["https://cdn.example.com/ceramic-cup.png"],
              "prompt": "把 @video_1 里的红色马克杯换成 @image_1 里的陶瓷杯。",
              "resolution": "720p"
            }'
        - lang: Python
          label: Python
          source: |-
            import os import requests
            response = requests.post(
                "https://api.apipod.ai/v1/videos/generations",
                headers={
                    "Authorization": f"Bearer {os.environ['APIPOD_API_KEY']}",
                    "Content-Type": "application/json",
                },
                json={
                    "model": "genjutsu-1.0-object-swap",
                    "video_urls": ["https://cdn.example.com/source-table.mp4"],
                    "image_urls": ["https://cdn.example.com/ceramic-cup.png"],
                    "prompt": "把 @video_1 里的红色马克杯换成 @image_1 里的陶瓷杯。",
                    "resolution": "720p",
                },
                timeout=60,
            ) response.raise_for_status() print(response.json())
        - lang: JavaScript
          label: Node.js
          source: >-
            const response = await
            fetch("https://api.apipod.ai/v1/videos/generations", {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.APIPOD_API_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                model: "genjutsu-1.0-object-swap",
                video_urls: ["https://cdn.example.com/source-table.mp4"],
                image_urls: ["https://cdn.example.com/ceramic-cup.png"],
                prompt: "把 @video_1 里的红色马克杯换成 @image_1 里的陶瓷杯。",
                resolution: "720p",
              }),
            });

            if (!response.ok) {
              throw new Error(`APIPod request failed: ${response.status} ${await response.text()}`);
            }

            console.log(await response.json());
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: APIPod API key
      description: 在 Authorization 请求头中使用 Bearer APIPod API Key 鉴权。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.