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

# Kling カスタムエレメント

> - Kling Custom Element（kling-custom-element）は参照画像または動画から再利用可能なサブジェクトエレメント（キャラクター/オブジェクト）を作成します
- 作成成功後、返された`element_id`はKling O3シリーズおよびKling V3画像から動画で`element_list`パラメータを通じて参照でき、キャラクター外観の一貫性制御を実現します
- 非同期処理モード、返されたタスクIDを使用して[ステータスを照会](/ja/api-manual/task-management/get-task-detail)
- タスク完了後、`result_data`に動画生成用の`element_id`が含まれます

**重要な注意事項：**
- このモデルは再利用可能なサブジェクト（エレメント）の作成に使用されます。**動画は生成しません**。prompt / duration / quality / aspect_ratioなどのパラメータは不要です



## OpenAPI

````yaml ja/api-manual/video-series/kling/kling-custom-element.json POST /v1/videos/generations
openapi: 3.1.0
info:
  title: kling-custom-element API
  description: >-
    Kling O3シリーズおよびKling
    V3画像から動画生成で一貫したキャラクター外観を実現するための再利用可能なサブジェクトエレメント（キャラクター/オブジェクト）を作成
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.evolink.ai
    description: 本番環境
security:
  - bearerAuth: []
tags:
  - name: サブジェクトエレメント作成
    description: 動画生成でのキャラクター外観一貫性制御のための再利用可能なサブジェクトエレメントを作成
paths:
  /v1/videos/generations:
    post:
      tags:
        - サブジェクトエレメント作成
      summary: kling-custom-element API
      description: >-
        - Kling Custom
        Element（kling-custom-element）は参照画像または動画から再利用可能なサブジェクトエレメント（キャラクター/オブジェクト）を作成します

        - 作成成功後、返された`element_id`はKling O3シリーズおよびKling
        V3画像から動画で`element_list`パラメータを通じて参照でき、キャラクター外観の一貫性制御を実現します

        -
        非同期処理モード、返されたタスクIDを使用して[ステータスを照会](/ja/api-manual/task-management/get-task-detail)

        - タスク完了後、`result_data`に動画生成用の`element_id`が含まれます


        **重要な注意事項：**

        - このモデルは再利用可能なサブジェクト（エレメント）の作成に使用されます。**動画は生成しません**。prompt / duration /
        quality / aspect_ratioなどのパラメータは不要です
      operationId: createCustomElement
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomElementRequest'
            examples:
              image_refer:
                summary: 参照画像からサブジェクトを作成
                value:
                  model: kling-custom-element
                  model_params:
                    element_name: マイキャラクター
                    element_description: 短髪の若い男性キャラクター、白いTシャツを着ている
                    reference_type: image_refer
                    element_image_list:
                      frontal_image: https://example.com/front.jpg
                      refer_images:
                        - image_url: https://example.com/side.jpg
              video_refer:
                summary: 参照動画からサブジェクトを作成
                value:
                  model: kling-custom-element
                  model_params:
                    element_name: マイキャラクター
                    element_description: 長髪の女性キャラクター、赤いワンピースを着ている
                    reference_type: video_refer
                    element_video_list:
                      video_url: https://example.com/reference.mp4
                    element_voice_id: '829824295735410756'
      responses:
        '200':
          description: サブジェクトエレメント作成タスクが正常に送信されました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomElementResponse'
        '400':
          description: リクエストパラメータが無効です
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_request
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: 未認証、トークンが無効または期限切れ
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: unauthorized
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: クォータ不足、チャージが必要です
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: insufficient_quota
                  message: Insufficient quota. Please top up your account.
                  type: insufficient_quota
        '403':
          description: アクセスが拒否されました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: model_access_denied
                  message: 'Token does not have access to model: kling-custom-element'
                  type: invalid_request_error
        '429':
          description: リクエスト頻度制限を超過しました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: rate_limit_exceeded
                  message: Too many requests, please try again later
                  type: rate_limit_error
        '500':
          description: サーバー内部エラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: Internal server error
                  type: api_error
        '502':
          description: アップストリームサービスエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: upstream_error
                  message: Upstream AI service unavailable
                  type: upstream_error
components:
  schemas:
    CustomElementRequest:
      type: object
      required:
        - model
        - model_params
      properties:
        model:
          type: string
          description: モデル名
          enum:
            - kling-custom-element
          default: kling-custom-element
          example: kling-custom-element
        model_params:
          type: object
          description: モデルパラメータ
          required:
            - element_name
            - element_description
            - reference_type
          properties:
            element_name:
              type: string
              description: |-
                サブジェクトエレメント名

                **注意：**
                - 最大`20`文字
              maxLength: 20
              example: マイキャラクター
            element_description:
              type: string
              description: |-
                サブジェクトエレメントの説明、モデルがサブジェクトの外観特徴を理解するのに役立ちます

                **注意：**
                - 最大`100`文字
              maxLength: 100
              example: 短髪の若い男性キャラクター、白いTシャツを着ている
            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`の場合は必須

                **注意：**
                - 鮮明で、十分な照明があり、サブジェクトが目立つ画像の使用を推奨
                - 画像サイズ：幅・高さ ≥ `300px`、アスペクト比 `1:2.5` ～ `2.5:1` の範囲
                - `frontal_image`（推奨）：正面参照画像URL
                - `refer_images`：追加参照画像リスト、各項目に`image_url`フィールドを含む
              properties:
                frontal_image:
                  type: string
                  format: uri
                  description: >-
                    正面参照画像URL（推奨）、サーバーから直接アクセスできる必要があります。アクセス時に直接ダウンロードされるURLでも構いません
                refer_images:
                  type: array
                  description: >-
                    追加参照画像リスト、画像URLはサーバーから直接アクセスできる必要があります。アクセス時に直接ダウンロードされるURLでも構いません
                  items:
                    type: object
                    properties:
                      image_url:
                        type: string
                        format: uri
                        description: >-
                          参照画像URL、サーバーから直接アクセスできる必要があります。アクセス時に直接ダウンロードされるURLでも構いません
                    required:
                      - image_url
              example:
                frontal_image: https://example.com/front.jpg
                refer_images:
                  - image_url: https://example.com/side.jpg
            element_video_list:
              type: object
              description: |-
                サブジェクトエレメント作成用の参照動画。`reference_type = video_refer`の場合は必須

                **注意：**
                - `video_url`：参照動画URL
              properties:
                video_url:
                  type: string
                  format: uri
                  description: 参照動画URL、サーバーから直接アクセスできる必要があります
              required:
                - video_url
              example:
                video_url: https://example.com/reference.mp4
            element_voice_id:
              type: string
              description: |-
                要素に割り当てる音声ID。生成動画内で要素が話す際にこの音声が使用されます

                **注意：**
                - `reference_type = video_refer` の場合のみサポート
                - `image_refer` では利用できません
              example: '829824295735410756'
        callback_url:
          type: string
          description: |-
            タスク完了時のHTTPSコールバックURL

            **コールバックタイミング:**
            - タスクが完了、失敗、またはキャンセルされた時にトリガー
            - 課金確認後に送信

            **セキュリティ制限:**
            - HTTPSプロトコルのみ
            - 内部IPアドレスは禁止（127.0.0.1, 10.x.x.x, 172.16-31.x.x, 192.168.x.x など）
            - URLの長さは`2048`文字以下

            **コールバックメカニズム:**
            - タイムアウト: `10`秒
            - 失敗後最大`3`回リトライ（失敗後`1`/`2`/`4`秒）
            - コールバックレスポンス形式はタスク照会APIと一致
            - 2xxステータスコードは成功とみなされ、その他のコードはリトライをトリガー
          format: uri
          example: https://your-domain.com/webhooks/video-task-completed
    CustomElementResponse:
      type: object
      properties:
        created:
          type: integer
          description: タスク作成タイムスタンプ
          example: 1757169743
        id:
          type: string
          description: タスクID
          example: task-unified-1757169743-8dxnm6yz
        model:
          type: string
          description: 使用された実際のモデル名
          example: kling-custom-element
        object:
          type: string
          enum:
            - video.generation.task
          description: タスクタイプ
        progress:
          type: integer
          description: タスク進捗率（0-100）
          minimum: 0
          maximum: 100
          example: 0
        status:
          type: string
          description: タスクステータス
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        task_info:
          type: object
          description: タスク詳細情報
          properties:
            can_cancel:
              type: boolean
              description: タスクをキャンセルできるかどうか
              example: true
            estimated_time:
              type: integer
              description: 推定完了時間（秒）
              minimum: 0
              example: 600
        type:
          type: string
          enum:
            - video
          description: タスク出力タイプ
          example: video
        usage:
          type: object
          description: 使用量と課金情報
          properties:
            billing_rule:
              type: string
              description: 課金ルール
              enum:
                - per_call
              example: per_call
            credits_reserved:
              type: number
              description: 推定消費クレジット
              minimum: 0
              example: 1
            user_group:
              type: string
              description: ユーザーグループカテゴリ
              example: default
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: エラーコード識別子
            message:
              type: string
              description: エラーの説明
            type:
              type: string
              description: エラータイプ
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ## すべてのAPIにBearer Token認証が必要です ##

        **APIキーの取得：**

        [APIキー管理ページ](https://evolink.ai/dashboard/keys)にアクセスしてAPIキーを取得してください

        **リクエストヘッダーに追加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````