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

# Genjutsu 1.0 / Lite

> 基于源视频与参考图片进行动作迁移或物体替换，在同一接口内支持 Genjutsu 1.0 与 1.0 Lite。

## 参数与输入模式

请求必填 `model` 与 `input`，省略的可选字段使用模型默认值。完整字段定义见下方 Body 区域。

| 请求场景 | 必填 input 字段 |
| - | - |
| 动作迁移（仅 `1.0`） | `mode: "motion_control"`、`video_url`（MP4/MOV/WebM/MKV，≤30 秒）、`reference_image_urls`（1–20 张） |
| 物体替换（`1.0`） | `mode: "replace_object"`、`video_url`（MP4/MOV/WebM/MKV，4–30 秒）、`reference_image_urls`（1–20 张） |
| 物体替换（`1.0-lite`） | `version: "1.0-lite"`、`mode: "replace_object"`、`video_url`（MP4/MOV/WebM/MKV，4–30 秒）、`reference_image_urls`（1–10 张） |

## 特殊模式

* **`1.0-lite` 限制**：仅支持 `720p`/`1080p`，且参考图宽高比须 `< 3.3:1`；传入 `motion_control`、`480p` 或超过 10 张图返回 HTTP 400。
* **提示词指代与严格校验**：可选 `prompt` 支持 `@Image1`… 与 `@Video1`；传入 `aspect_ratio`、`duration` 或 `seed` 返回 HTTP 400。

## 使用场景示例

将下方示例提交至 `POST /api/v1/tasks/create_task`，并替换为你自己的素材链接。

```json 动作迁移（1.0） theme={null}
{
  "model": "genjutsu",
  "input": {
    "version": "1.0",
    "mode": "motion_control",
    "video_url": "https://cdn.example.com/source-motion.mp4",
    "reference_image_urls": [
      "https://cdn.example.com/character.jpg"
    ],
    "resolution": "720p"
  }
}
```

```json 物体替换（1.0） theme={null}
{
  "model": "genjutsu",
  "input": {
    "version": "1.0",
    "mode": "replace_object",
    "video_url": "https://cdn.example.com/product-shot.mp4",
    "reference_image_urls": [
      "https://cdn.example.com/new-bottle.png"
    ],
    "resolution": "720p",
    "prompt": "Replace the clear bottle in @Video1 with the frosted glass bottle from @Image1, keeping hand grip and lighting consistent."
  }
}
```

```json 物体替换（1.0 Lite） theme={null}
{
  "model": "genjutsu",
  "input": {
    "version": "1.0-lite",
    "mode": "replace_object",
    "video_url": "https://cdn.example.com/product-shot.mp4",
    "reference_image_urls": [
      "https://cdn.example.com/new-bottle.png"
    ],
    "resolution": "720p"
  }
}
```

> 通过[查询任务](https://docs.apistable.ai/zh/query-task.md)或 `callback_url`（[Webhook 验签](https://docs.apistable.ai/zh/webhook-secret.md)）获取结果，提交错误见[创建任务](https://docs.apistable.ai/zh/create-task.md)。生成链接保留 14 天；超过 24 小时未完成的任务自动失败且不扣费。

## 在线试用与价格

每个成功视频分别按源视频（视频/音频轨较长者）计费秒数结算：`motion_control` 四舍五入到整秒（最少 4 秒），`replace_object` 向上取整。参考图与提示词不加价，失败项扣费为 0。余额查询见[积分余额](https://docs.apistable.ai/zh/credits.md)。

| 版本与分辨率 | 积分 / 秒 | 价格 / 秒 |
| - | - | - |
| `1.0` · `480p` | 29.3 | 折合 ≈ \*\*$0.133** · 常规 $0.147 |
| `1.0` · `720p`（默认） | 68.3 | 折合 ≈ \*\*$0.310** · 常规 $0.342 |
| `1.0` · `1080p` | 195.0 | 折合 ≈ \*\*$0.886** · 常规 $0.975 |
| `1.0-lite` · `720p` | 23.4 | 折合 ≈ \*\*$0.106** · 常规 $0.117 |
| `1.0-lite` · `1080p` | 46.8 | 折合 ≈ \*\*$0.213** · 常规 $0.234 |

> [card] [在线试用](https://apistable.ai/zh/models/genjutsu#try)
>
> 切换 1.0 与 1.0 Lite，上传源视频并实时测算报价。

> [card] [查看价格](https://apistable.ai/zh/models/genjutsu#pricing)
>
> 查看 1.0 与 1.0 Lite 每秒费率与充值折合价。


## OpenAPI

````yaml openapi-genjutsu-zh.json POST /api/v1/tasks/create_task
openapi: 3.1.0
info:
  title: APIstable API
  version: 1.0.0-preview
  description: >-
    Public /api/v1 protocol. Valid API keys have the same account-scoped access.
    Read the selected model documentation for its ID, supported inputs, result
    format and availability before submitting. No client submission idempotency
    or max_credits. Availability, pricing, file retention and callback formats
    follow the selected model contract. Unconfigured operations return 503.
servers:
  - url: https://apistable.ai
    description: API Stable API
security: []
paths:
  /api/v1/tasks/create_task:
    post:
      summary: Genjutsu 1.0 / Lite
      description: 基于源视频与参考图片进行动作迁移或物体替换，在同一接口内支持 Genjutsu 1.0 与 1.0 Lite。
      operationId: genjutsu
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              additionalProperties: false
              properties:
                model:
                  type: string
                  enum:
                    - genjutsu
                  example: genjutsu
                  description: 本页对应的 APIstable 模型 ID。
                input:
                  type: object
                  properties:
                    nsfw_check:
                      type: boolean
                      description: >-
                        可选 APIstable 安全审核，默认 false。开启后审核失败会拒绝请求；仅审核文字及最多 20
                        张图片，不审核音视频；图片超限返回 HTTP 400。网站试用始终开启审核。
                    output_count:
                      default: 1
                      type: integer
                      minimum: 1
                      maximum: 4
                      description: 独立视频数量，1–4 的整数，默认 1。成功项分别计费，失败项不扣费。
                    version:
                      default: '1.0'
                      type: string
                      enum:
                        - '1.0'
                        - 1.0-lite
                      description: >-
                        模型版本：`1.0`（默认）支持 `motion_control` 与
                        `replace_object`、`480p`/`720p`/`1080p` 及 1–20
                        张参考图；`1.0-lite` 仅支持 `replace_object`、`720p`/`1080p` 与
                        1–10 张参考图（宽高比 < 3.3:1）。
                    mode:
                      type: string
                      enum:
                        - motion_control
                        - replace_object
                      description: >-
                        必填工作流模式：`motion_control`（动作迁移，仅 `1.0`）或
                        `replace_object`（物体替换，`1.0` 与 `1.0-lite` 均支持）。`1.0-lite`
                        传入 `motion_control` 返回 HTTP 400。
                    video_url:
                      type: string
                      format: uri
                      description: >-
                        必填源视频（MP4/MOV/WebM/MKV）。`motion_control` 须 ≤30
                        秒，`replace_object` 须 4–30 秒；无法测量音视频轨时长时返回 HTTP 400。
                    reference_image_urls:
                      minItems: 1
                      maxItems: 20
                      type: array
                      items:
                        type: string
                        format: uri
                      description: >-
                        必填参考图片：`1.0` 支持 1–20 张；`1.0-lite` 支持 1–10 张且横向或纵向宽高比须 <
                        3.3:1。
                    resolution:
                      default: 720p
                      type: string
                      enum:
                        - 480p
                        - 720p
                        - 1080p
                      description: >-
                        输出分辨率与每秒计费档位，默认 `720p`。`1.0` 支持
                        `480p`/`720p`/`1080p`；`1.0-lite` 仅支持 `720p`/`1080p`（传
                        `480p` 返回 HTTP 400）。
                    prompt:
                      type: string
                      maxLength: 5000
                      description: >-
                        可选文字说明（最多 5,000 字符）；可按数组顺序用 `@Image1`、`@Image2`…
                        指代参考图片，用 `@Video1` 指代源视频。
                  required:
                    - mode
                    - video_url
                    - reference_image_urls
                  additionalProperties: false
                  description: Genjutsu 视频到视频输入参数，各字段规则见下方说明。
                  not:
                    anyOf:
                      - properties:
                          version:
                            const: 1.0-lite
                          mode:
                            const: motion_control
                        required:
                          - version
                      - properties:
                          version:
                            const: 1.0-lite
                          resolution:
                            const: 480p
                        required:
                          - version
                      - properties:
                          version:
                            const: 1.0-lite
                          reference_image_urls:
                            minItems: 11
                        required:
                          - version
                          - reference_image_urls
                callback_url:
                  type: string
                  format: uri
                  description: 任务完成时接收签名回调的公网 HTTPS 地址。须为可直接访问的地址，不能跳转到其他地址。省略时可轮询查询任务接口。
            example:
              model: genjutsu
              input:
                version: '1.0'
                mode: motion_control
                video_url: https://cdn.example.com/source-motion.mp4
                reference_image_urls:
                  - https://cdn.example.com/character.jpg
                resolution: 720p
      responses:
        '200':
          description: Accepted task. Poll the common task endpoint or use callback_url.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - msg
                  - data
                additionalProperties: false
                properties:
                  code:
                    const: 200
                  msg:
                    const: success
                  data:
                    type: object
                    required:
                      - task_id
                    additionalProperties: false
                    properties:
                      task_id:
                        type: string
        '400':
          description: >-
            40001 invalid JSON, 40002 invalid input/callback or input rejected
            by screening, 40003 unsupported parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: '40201: Insufficient credits (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: '40301: Website session requests require the APIstable site origin.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '40401: Unknown model or resource not found in this account.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '40901: Resource incompatible with this operation.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: '41001: Source audio or temporary resource has expired.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: '41301: Request too large.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: '42201: Requested capability combination is not enabled.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '42901: Rate/concurrency limit (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: '50301: Service unavailable. No live submission or charge.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      callbacks:
        Webhook:
          '{$request.body#/callback_url}':
            post:
              requestBody:
                required: true
                description: >-
                  任务成功或失败后，APIstable 向创建任务时传入的 `callback_url` 发送 JSON POST。验签后返回
                  HTTP 2xx 确认接收。


                  用 `data.status` 判断生成结果。成功时为 `succeeded`，生成视频链接位于
                  `data.result.urls`。全部失败时为 `failed`，`data.result` 为
                  `null`，`data.message` 提供失败原因。


                  签名和去重使用 `X-APIstable-Signature`、`X-APIstable-Timestamp` 和
                  `X-APIstable-Event-Id`。详见 [Webhook 安全与验签](/zh/webhook-secret)。


                  **Webhook 请求体示例**


                  ```json

                  {
                    "code": 200,
                    "msg": "success",
                    "data": {
                      "task_id": "c6adbc82-8b9a-4d6f-8b60-1114c8c4aafb",
                      "model": "genjutsu",
                      "status": "succeeded",
                      "created_at": "2026-11-25T08:30:00.000Z",
                      "completed_at": "2026-11-25T08:32:00.000Z",
                      "duration": 120000,
                      "charged_credits": 341.5,
                      "message": "",
                      "input": "{\"version\":\"1.0\",\"mode\":\"motion_control\",\"video_url\":\"https://cdn.example.com/source-motion.mp4\",\"reference_image_urls\":[\"https://cdn.example.com/character.jpg\"],\"resolution\":\"720p\"}",
                      "result": {
                        "urls": [
                          "https://cdn.example.com/generated/video.mp4"
                        ],
                        "items": [
                          {
                            "id": "e7aacd19-819a-4747-bbbf-46fb6f2995a5",
                            "urls": [
                              "https://cdn.example.com/generated/video.mp4"
                            ],
                            "last_frame_url": null,
                            "draft": false,
                            "draft_expires_at": null
                          }
                        ]
                      }
                    }
                  }

                  ```
                content:
                  application/json:
                    schema:
                      type: object
                      required:
                        - code
                        - msg
                        - data
                      properties:
                        code:
                          type: integer
                          const: 200
                        msg:
                          type: string
                          const: success
                        data:
                          type: object
                          additionalProperties: false
                          required:
                            - task_id
                            - model
                            - status
                            - created_at
                            - completed_at
                            - duration
                            - charged_credits
                            - message
                            - input
                            - result
                          properties:
                            task_id:
                              type: string
                            model:
                              type: string
                              const: genjutsu
                            status:
                              type: string
                              enum:
                                - succeeded
                                - failed
                            created_at:
                              type: string
                              format: date-time
                            completed_at:
                              type:
                                - string
                                - 'null'
                              format: date-time
                            duration:
                              type:
                                - integer
                                - 'null'
                              minimum: 0
                              description: >-
                                Total elapsed milliseconds; null while
                                processing.
                            charged_credits:
                              type:
                                - number
                                - 'null'
                              minimum: 0
                              description: Final charged Credits; null until completion.
                            message:
                              type: string
                              description: >-
                                Failure reason for failed tasks, or an
                                actionable pending-settlement message while
                                processing; empty on success.
                            input:
                              type: string
                              contentMediaType: application/json
                              description: JSON-serialized accepted model input.
                            result:
                              type:
                                - object
                                - 'null'
                              required:
                                - urls
                                - items
                              properties:
                                urls:
                                  type: array
                                  items:
                                    type: string
                                    format: uri
                                items:
                                  type: array
                                  maxItems: 1
                                  items:
                                    type: object
                                    required:
                                      - id
                                      - urls
                                      - last_frame_url
                                      - draft
                                      - draft_expires_at
                                    properties:
                                      id:
                                        type: string
                                        format: uuid
                                      urls:
                                        type: array
                                        items:
                                          type: string
                                          format: uri
                                      last_frame_url:
                                        type:
                                          - string
                                          - 'null'
                                        format: uri
                                      draft:
                                        type: boolean
                                      draft_expires_at:
                                        type:
                                          - string
                                          - 'null'
                                        format: date-time
                    example:
                      code: 200
                      msg: success
                      data:
                        task_id: c6adbc82-8b9a-4d6f-8b60-1114c8c4aafb
                        model: genjutsu
                        status: succeeded
                        created_at: '2026-11-25T08:30:00.000Z'
                        completed_at: '2026-11-25T08:32:00.000Z'
                        duration: 120000
                        charged_credits: 341.5
                        message: ''
                        input: >-
                          {"version":"1.0","mode":"motion_control","video_url":"https://cdn.example.com/source-motion.mp4","reference_image_urls":["https://cdn.example.com/character.jpg"],"resolution":"720p"}
                        result:
                          urls:
                            - https://cdn.example.com/generated/video.mp4
                          items:
                            - id: e7aacd19-819a-4747-bbbf-46fb6f2995a5
                              urls:
                                - https://cdn.example.com/generated/video.mp4
                              last_frame_url: null
                              draft: false
                              draft_expires_at: null
              responses:
                2XX:
                  description: 已接收 Webhook。
              method: post
              type: path
            path: '{$request.body#/callback_url}'
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      required:
        - code
        - msg
        - data
      properties:
        code:
          type: integer
        msg:
          type: string
        data:
          type: 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        登录 APIstable 后，在 [API Key 管理](https://apistable.ai/zh/console/keys)
        创建并复制密钥。


        每次调用都要在 HTTP 请求头传入：


        ```http

        Authorization: Bearer YOUR_API_KEY

        ```


        将 YOUR_API_KEY 替换为你创建的 API Key。

````

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