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

# Kling テキストから動画を生成

> このシリーズはOpenAIの動画生成形式をサポートしています（詳細はリンク [動画生成Sora互換形式](/api-reference/ja/video-generation-sora-compatible-format/create-video) を参照してください）。

Kling 4.0 ネイティブタスクAPI。本サイトの Bearer API Key を使用して認証します。リクエスト本文に model は不要です。settings.resolution=720p では kling-4.0、1080p では kling-4.0-1080p を使用し、デフォルトは1080pです。作成後、返された data.id を使用して GET /tasks?task_ids=タスクID を呼び出します。複数のIDはカンマで区切ります。照会結果の data は配列で、生成された動画は data[].outputs[].url にあります。

現在、プロンプト、first_frame、last_frame、refer_image、feature_video に対応する生成シナリオをサポートしています。モデルはデフォルトで音声と映像を同時に生成します。現在、ネイティブエンドポイントでは settings.audio、refer_audio、voice は公開されていません。音声の有効化設定や音声素材を追加で渡さないでください。middle_frame、base_video、element、コールバック、カスタム外部タスク ID はサポートされていません。空でない options.callback_url、空でない options.external_task_id、空でない contents.id、およびその他の未サポートフィールドは 400 を返します。options は省略するか空のオブジェクトを渡せます。また、watermark_info.enabled=false を渡すこともできます。透かしの有効化は現在サポートされていません。現在サポートされる長さは 4～30 秒で、デフォルトは 10 秒です。3 秒はサポートされていません。テキスト生成および参照シナリオのアスペクト比はデフォルトで 16:9 です。adaptive を明示的に指定すると 400 が返されます。先頭・末尾フレームのシナリオでは settings.aspect_ratio を明示的に指定できず、アスペクト比は最初の frame 画像のサイズによって決まります。

テキストから動画を生成する場合は、トップレベルの prompt を渡します。contents は不要です。



## OpenAPI

````yaml api-reference/ja/openapi.json POST /text-to-video/kling-4.0
openapi: 3.0.0
info:
  title: NewAPIs API 参考ドキュメント
  version: 1.0.0
  description: Public AI Gateway API Reference
servers:
  - url: https://api.newapi.si
security:
  - BearerAuth: []
tags:
  - name: OpenAI形式(Chat)
  - name: OpenAI形式（Responses）
  - name: 画像生成Gemini形式
  - name: 画像生成OpenAI DALL-E形式
  - name: モデル一覧の取得
  - name: 動画生成HappyHorseとWan
  - name: 動画生成Kling形式
  - name: 動画生成OmniとVeo形式
  - name: Video generation Seedance
  - name: 動画生成Sora対応形式
  - name: Video generation Vidu
  - name: 音楽生成タスクの形式
paths:
  /text-to-video/kling-4.0:
    post:
      tags:
        - 動画生成Kling形式
      summary: Kling テキストから動画を生成
      description: >-
        このシリーズはOpenAIの動画生成形式をサポートしています（詳細はリンク
        [動画生成Sora互換形式](/api-reference/ja/video-generation-sora-compatible-format/create-video)
        を参照してください）。


        Kling 4.0 ネイティブタスクAPI。本サイトの Bearer API Key を使用して認証します。リクエスト本文に model
        は不要です。settings.resolution=720p では kling-4.0、1080p では kling-4.0-1080p
        を使用し、デフォルトは1080pです。作成後、返された data.id を使用して GET /tasks?task_ids=タスクID
        を呼び出します。複数のIDはカンマで区切ります。照会結果の data は配列で、生成された動画は data[].outputs[].url
        にあります。


        現在、プロンプト、first_frame、last_frame、refer_image、feature_video
        に対応する生成シナリオをサポートしています。モデルはデフォルトで音声と映像を同時に生成します。現在、ネイティブエンドポイントでは
        settings.audio、refer_audio、voice
        は公開されていません。音声の有効化設定や音声素材を追加で渡さないでください。middle_frame、base_video、element、コールバック、カスタム外部タスク
        ID はサポートされていません。空でない options.callback_url、空でない
        options.external_task_id、空でない contents.id、およびその他の未サポートフィールドは 400
        を返します。options は省略するか空のオブジェクトを渡せます。また、watermark_info.enabled=false
        を渡すこともできます。透かしの有効化は現在サポートされていません。現在サポートされる長さは 4～30 秒で、デフォルトは 10 秒です。3
        秒はサポートされていません。テキスト生成および参照シナリオのアスペクト比はデフォルトで 16:9 です。adaptive を明示的に指定すると
        400 が返されます。先頭・末尾フレームのシナリオでは settings.aspect_ratio を明示的に指定できず、アスペクト比は最初の
        frame 画像のサイズによって決まります。


        テキストから動画を生成する場合は、トップレベルの prompt を渡します。contents は不要です。
      operationId: create_kling4_native_text_to_video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - prompt
              properties:
                settings:
                  type: object
                  additionalProperties: false
                  properties:
                    resolution:
                      type: string
                      enum:
                        - 720p
                        - 1080p
                      default: 1080p
                    duration:
                      type: integer
                      minimum: 4
                      maximum: 30
                      default: 10
                    aspect_ratio:
                      type: string
                      enum:
                        - '21:9'
                        - '16:9'
                        - '9:16'
                        - '1:1'
                      default: '16:9'
                options:
                  type: object
                  additionalProperties: false
                  description: 省略するか、空のオブジェクトを渡すか、ウォーターマークを明示的に無効化できます。
                  properties:
                    watermark_info:
                      type: object
                      additionalProperties: false
                      required:
                        - enabled
                      properties:
                        enabled:
                          type: boolean
                          enum:
                            - false
                prompt:
                  type: string
                  minLength: 1
            examples:
              kling4_native_720p:
                summary: Kling 720p
                value:
                  settings:
                    resolution: 720p
                    duration: 10
                    aspect_ratio: '16:9'
                  options: {}
                  prompt: A cinematic landscape with natural motion
              kling4_native_1080p:
                summary: Kling 1080p
                value:
                  settings:
                    resolution: 1080p
                    duration: 10
                    aspect_ratio: '16:9'
                  options: {}
                  prompt: A cinematic landscape with natural motion
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - request_id
                  - data
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                  request_id:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: 本サイトのタスクID。照会時にそのまま渡します。
                      status:
                        type: string
                        enum:
                          - submitted
                          - processing
                          - succeeded
                          - failed
                      create_time:
                        type: integer
                        format: int64
                        description: 作成時刻（Unixミリ秒）。
                      update_time:
                        type: integer
                        format: int64
                        description: 更新時刻（Unixミリ秒）。
                      external_id:
                        type: string
                        maxLength: 0
              examples:
                success:
                  summary: 成功
                  value:
                    code: 0
                    message: SUCCEED
                    request_id: request_example
                    data:
                      id: task_example
                      status: submitted
                      create_time: 1792710000000
                      update_time: 1792710000000
                      external_id: ''
        '400':
          description: リクエストパラメータが無効であるか、サポートされていないフィールドが含まれています。
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        Bearer Token を使用して認証します。
        形式: `Authorization: Bearer sk-xxxxxx`

````

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