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

# kling-element-create

> 通过参考图片或参考视频创建可复用的自定义主体。支持人物、动物、道具、服饰、场景、特效等分类。
返回 `task_id`，通过查询接口轮询直到 `task_status` 为 `succeed`。




## OpenAPI

````yaml zh/api-reference/model-api/kling/openapi/kling-element-create/openapi.yaml POST /kling/v2/general/advanced-custom-elements
openapi: 3.1.0
info:
  title: Kling 创建自定义主体
  description: 创建自定义主体（人物、场景、道具等），用于 Kling 视频生成
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /kling/v2/general/advanced-custom-elements:
    post:
      summary: 创建自定义主体
      description: |
        通过参考图片或参考视频创建可复用的自定义主体。支持人物、动物、道具、服饰、场景、特效等分类。
        返回 `task_id`，通过查询接口轮询直到 `task_status` 为 `succeed`。
      operationId: createKlingCustomElementZh
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - element_name
                - element_description
                - reference_type
              properties:
                element_name:
                  type: string
                  maxLength: 20
                  description: 主体名称，最长 20 个字符。
                  example: my-character
                element_description:
                  type: string
                  maxLength: 100
                  description: 主体描述，最长 100 个字符。
                  example: 视频系列主角
                reference_type:
                  type: string
                  description: >-
                    参考方式。`image_refer` 通过多张图片定义主体外观；`video_refer`
                    通过一段参考视频定义视频角色主体。
                  enum:
                    - image_refer
                    - video_refer
                  example: image_refer
                element_image_list:
                  type: object
                  description: >-
                    `reference_type` 为 `image_refer` 时必填。提供一张正面参考图和 1–3
                    张不同角度或特写参考图。支持可访问 URL 或原始 Base64；格式为 JPG/JPEG/PNG，不超过 10
                    MB，宽高均不小于 300 px，宽高比 1:2.5 至 2.5:1。
                  required:
                    - frontal_image
                    - refer_images
                  properties:
                    frontal_image:
                      type: string
                      description: 正面参考图片 URL。
                      example: https://example.com/frontal.jpg
                    refer_images:
                      type: array
                      minItems: 1
                      maxItems: 3
                      description: 1–3 张不同角度或特写参考图。
                      items:
                        type: object
                        required:
                          - image_url
                        properties:
                          image_url:
                            type: string
                            description: 参考图片 URL。
                            example: https://example.com/side.jpg
                element_video_list:
                  type: object
                  description: >-
                    `reference_type` 为 `video_refer` 时必填，图片参考方式下不生效。支持一段 MP4/MOV
                    视频，时长 3–8 秒、1080p、画面比例 16:9 或 9:16，不超过 200 MB。视频角色主体仅支持
                    Kling Video O3 及后续模型。
                  required:
                    - refer_videos
                  properties:
                    refer_videos:
                      type: array
                      minItems: 1
                      maxItems: 1
                      items:
                        type: object
                        required:
                          - video_url
                        properties:
                          video_url:
                            type: string
                            description: 角色参考视频的公开 URL。
                element_voice_id:
                  type: string
                  description: 可选绑定音色 ID。图片主体仅人物或类人角色支持绑定音色。
                tag_list:
                  type: array
                  description: |
                    标签列表。可用 tag_id：
                    - `o_101`：热梗
                    - `o_102`：人物（Character）
                    - `o_103`：动物
                    - `o_104`：道具
                    - `o_105`：服饰
                    - `o_106`：场景（Scene）
                    - `o_107`：特效
                    - `o_108`：其他
                  items:
                    type: object
                    required:
                      - tag_id
                    properties:
                      tag_id:
                        type: string
                        example: o_102
      responses:
        '200':
          description: 主体创建任务已提交
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 任务 ID
                    example: '863121016086724692'
                  task_id:
                    type: string
                    description: 任务 ID（同 id）
                    example: '863121016086724692'
                  object:
                    type: string
                    description: 固定 `video`
                    example: video
                  model:
                    type: string
                    description: 固定 `kling-element`
                    example: kling-element
                  status:
                    type: string
                    description: 初始任务状态
                    example: queued
                  progress:
                    type: integer
                    description: 进度 0–100
                    example: 0
                  created_at:
                    type: integer
                    description: Unix 时间戳
                    example: 1773812605
        '400':
          description: 请求参数有误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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