---
title: Kling 画像から動画 | RunAPI
description: 画像から動画へのエンドポイントを使用して、非同期タスクを作成します。
url: https://runapi.ai/ja/docs/api/kling/image-to-video.md
canonical: https://runapi.ai/ja/docs/api/kling/image-to-video
locale: ja
---

> HTML 版: https://runapi.ai/ja/docs/api/kling/image-to-video
> エージェント向けサイトインデックス: https://runapi.ai/llms.txt

# Kling 画像から動画

## 概要

サポートされているモデルで画像から動画へのエンドポイントを使用します。返されたタスクIDを使用してその状態を取得するか、以下に記載されている配信のために callback_url を指定してください。

### クイックスタート

1. APIキーを作成し、RUNAPI_API_KEYとして設定します。
2. サポートされているモデルを選択し、そのモデルのスキーマに一致するボディを持つPOSTリクエストを送信します。
3. 返されたタスクIDを保存し、終了状態になるまでポーリングするか、以下に記載されているコールバックを処理してください。

## エンドポイント

POST /api/v1/kling/image_to_video

ベースURL: https://runapi.ai

API バージョン: v1

認証: Authorization: Bearer YOUR_API_TOKEN

## サポートされているモデル

現在の料金、レート制限、商用利用の詳細については、モデルページを開いてください。

- [kling-o1](https://runapi.ai/ja/models/kling/o1)
- [kling-v2.1-master-image-to-video](https://runapi.ai/ja/models/kling/v2.1-master-image-to-video)
- [kling-v2.1-pro](https://runapi.ai/ja/models/kling/v2.1-pro)
- [kling-v2.1-standard](https://runapi.ai/ja/models/kling/v2.1-standard)
- [kling-v2.5-turbo-image-to-video-pro](https://runapi.ai/ja/models/kling/v2.5-turbo-image-to-video-pro)
- [kling-v2.6](https://runapi.ai/ja/models/kling/v2.6)
- [kling-v3-omni](https://runapi.ai/ja/models/kling/v3-omni)
- [kling-v3-turbo-image-to-video](https://runapi.ai/ja/models/kling/v3-turbo-image-to-video)

## リクエストスキーマ

フィールドと許可される値は選択したモデルによって異なります。指定した場合、callback_urlは以下に記載されたTask配信を受信します。

### kling-o1

```json
{
  "aspect_ratio": {
    "default": "16:9",
    "description": "出力アスペクト比。",
    "enum": [
      "16:9",
      "9:16",
      "1:1"
    ],
    "type": "string"
  },
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "再生時間（秒単位）。",
    "enum": [
      5
    ],
    "type": "integer"
  },
  "enable_sound": {
    "default": false,
    "description": "サウンド生成は無効のままにしておく必要があります。",
    "type": "boolean"
  },
  "first_frame_image_url": {
    "description": "公開 HTTP(S) の JPG、JPEG、または PNG 最初のフレーム画像 URL。",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "公開 HTTP(S) の JPG、JPEG、または PNG 最終フレーム画像 URL。reference_image_urls または reference_video_url と同時に指定することはできません。",
    "type": "string"
  },
  "mode": {
    "default": "std",
    "description": "生成モード。",
    "enum": [
      "std",
      "pro"
    ],
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "preserve_reference_video_audio": {
    "default": false,
    "description": "参照動画の元の音声を保持する。",
    "type": "boolean"
  },
  "prompt": {
    "description": "動画の説明。番号付きマーカーで参照メディアを示します。",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "reference_image_urls": {
    "description": "順序付きの公開HTTP(S) JPG、JPEG、またはPNG参照画像URL。last_frame_image_urlと組み合わせることはできません。",
    "items": {
      "type": "string"
    },
    "max_items": 7,
    "min_items": 1,
    "type": "array"
  },
  "reference_video_type": {
    "default": "base",
    "description": "動画をベース編集または特徴参照として使用します。",
    "enum": [
      "base",
      "feature"
    ],
    "type": "string"
  },
  "reference_video_url": {
    "description": "公開 HTTP(S) の MP4 または MOV 参照動画 URL。last_frame_image_url と同時に指定することはできません。",
    "type": "string"
  }
}
```

### kling-v2.1-master-image-to-video

```json
{
  "aspect_ratio": {
    "description": "出力アスペクト比。",
    "type": "string"
  },
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "cfg_scale": {
    "description": "ガイダンススケール（0〜1）。",
    "type": "number"
  },
  "duration_seconds": {
    "description": "再生時間（秒単位）。",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "最初のフレームの画像URL。",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "サポートされている画像から動画へのモデル向けの最終フレーム画像URL。",
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "ネガティブプロンプト。",
    "type": "string"
  },
  "prompt": {
    "description": "動画の説明。",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.1-pro

```json
{
  "aspect_ratio": {
    "description": "出力アスペクト比。",
    "type": "string"
  },
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "cfg_scale": {
    "description": "ガイダンススケール（0〜1）。",
    "type": "number"
  },
  "duration_seconds": {
    "description": "再生時間（秒単位）。",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "最初のフレームの画像URL。",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "サポートされている画像から動画へのモデル向けの最終フレーム画像URL。",
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "ネガティブプロンプト。",
    "type": "string"
  },
  "prompt": {
    "description": "動画の説明。",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.1-standard

```json
{
  "aspect_ratio": {
    "description": "出力アスペクト比。",
    "type": "string"
  },
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "cfg_scale": {
    "description": "ガイダンススケール（0〜1）。",
    "type": "number"
  },
  "duration_seconds": {
    "description": "再生時間（秒単位）。",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "最初のフレームの画像URL。",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "サポートされている画像から動画へのモデル向けの最終フレーム画像URL。",
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "ネガティブプロンプト。",
    "type": "string"
  },
  "prompt": {
    "description": "動画の説明。",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.5-turbo-image-to-video-pro

```json
{
  "aspect_ratio": {
    "description": "出力アスペクト比。",
    "type": "string"
  },
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "cfg_scale": {
    "description": "ガイダンススケール（0〜1）。",
    "type": "number"
  },
  "duration_seconds": {
    "description": "再生時間（秒単位）。",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "最初のフレームの画像URL。",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "サポートされている画像から動画へのモデル向けの最終フレーム画像URL。",
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "negative_prompt": {
    "description": "ネガティブプロンプト。",
    "type": "string"
  },
  "prompt": {
    "description": "動画の説明。",
    "required": true,
    "type": "string"
  }
}
```

### kling-v2.6

```json
{
  "aspect_ratio": {
    "default": "16:9",
    "description": "出力アスペクト比。",
    "enum": [
      "16:9",
      "9:16",
      "1:1"
    ],
    "type": "string"
  },
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "再生時間（秒単位）。",
    "enum": [
      5,
      10
    ],
    "type": "integer"
  },
  "enable_sound": {
    "default": false,
    "description": "サウンド生成を有効にします。Proモードが必要です。",
    "type": "boolean"
  },
  "first_frame_image_url": {
    "description": "最初のフレームの画像URL。",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "最終フレームの画像URL。Proモードと5秒が必要です。",
    "type": "string"
  },
  "mode": {
    "default": "std",
    "description": "生成モード。",
    "enum": [
      "std",
      "pro"
    ],
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "動画の説明。",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  }
}
```

### kling-v3-omni

```json
{
  "aspect_ratio": {
    "default": "16:9",
    "description": "出力アスペクト比。",
    "enum": [
      "16:9",
      "9:16",
      "1:1"
    ],
    "type": "string"
  },
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "再生時間（秒単位）。",
    "enum": [
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15
    ],
    "type": "integer"
  },
  "enable_sound": {
    "default": false,
    "description": "同期サウンド生成を有効にします。",
    "type": "boolean"
  },
  "first_frame_image_url": {
    "description": "最初のフレームの画像URL。",
    "required": true,
    "type": "string"
  },
  "last_frame_image_url": {
    "description": "最終フレームの画像URL。5秒の長さが必要です。",
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "output_resolution": {
    "default": "720p",
    "description": "出力解像度。",
    "enum": [
      "720p",
      "1080p",
      "4k"
    ],
    "type": "string"
  },
  "prompt": {
    "description": "動画の説明。",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  }
}
```

### kling-v3-turbo-image-to-video

```json
{
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "再生時間（秒単位）。",
    "enum": [
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15
    ],
    "type": "integer"
  },
  "first_frame_image_url": {
    "description": "最初のフレームの画像URL。",
    "required": true,
    "type": "string"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "output_resolution": {
    "default": "720p",
    "description": "出力解像度。",
    "enum": [
      "720p",
      "1080p"
    ],
    "type": "string"
  },
  "prompt": {
    "description": "動画の説明。",
    "length": true,
    "max": 2500,
    "min": 1,
    "required": true,
    "type": "string"
  }
}
```

#### 条件付きルール

これらの要件は、列挙されたすべての条件が一致する場合に適用されます。

- **条件**: `model` = `kling-o1`; **使用不可**: `output_resolution`, `negative_prompt`, `cfg_scale`
- **条件**: `model` = `kling-v2.1-master-image-to-video`; **使用不可**: `output_resolution`, `enable_sound`, `reference_image_urls`, `reference_video_url`, `reference_video_type`, `preserve_reference_video_audio`
- **条件**: `model` = `kling-v2.1-pro`; **使用不可**: `output_resolution`, `enable_sound`, `reference_image_urls`, `reference_video_url`, `reference_video_type`, `preserve_reference_video_audio`
- **条件**: `model` = `kling-v2.1-standard`; **使用不可**: `output_resolution`, `enable_sound`, `reference_image_urls`, `reference_video_url`, `reference_video_type`, `preserve_reference_video_audio`
- **条件**: `model` = `kling-v2.5-turbo-image-to-video-pro`; **使用不可**: `output_resolution`, `enable_sound`, `reference_image_urls`, `reference_video_url`, `reference_video_type`, `preserve_reference_video_audio`
- **条件**: `model` = `kling-v2.6`; **使用不可**: `output_resolution`, `negative_prompt`, `cfg_scale`, `reference_image_urls`, `reference_video_url`, `reference_video_type`, `preserve_reference_video_audio`
- **条件**: `model` = `kling-v3-omni`; **使用不可**: `negative_prompt`, `cfg_scale`, `reference_image_urls`, `reference_video_url`, `reference_video_type`, `preserve_reference_video_audio`
- **条件**: `model` = `kling-v3-turbo-image-to-video`; **使用不可**: `enable_sound`, `aspect_ratio`, `negative_prompt`, `cfg_scale`, `last_frame_image_url`, `reference_image_urls`, `reference_video_url`, `reference_video_type`, `preserve_reference_video_audio`

## 承認を作成する

HTTP 202 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## ポーリング処理中

HTTP 200 - GET /api/v1/kling/image_to_video/:id

### レスポンススキーマ

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## ポーリング完了

HTTP 200 - GET /api/v1/kling/image_to_video/:id

### レスポンススキーマ

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed",
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## ポーリング失敗

HTTP 200 - GET /api/v1/kling/image_to_video/:id

### レスポンススキーマ

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## 顧客コールバック: 完了

HTTP 200 - POST callback_url

### レスポンススキーマ

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## 顧客コールバック: 失敗

HTTP 200 - POST callback_url

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## エラー

HTTP 401 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Authentication required"
}
```

## エラー

HTTP 401 - GET /api/v1/kling/image_to_video/:id

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Authentication required"
}
```

## エラー

HTTP 400 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "人が読めるエラーメッセージ。",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "人間が読める形式のバリデーションサマリー。",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "公開リクエストフィールドをキーとするバリデーションメッセージ。各フィールドに対して人間が読める文字列の配列が含まれます。",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### レスポンス例

```json
{
  "error": "model must be one of: kling-o1, kling-v2.1-master-image-to-video, kling-v2.1-pro, kling-v2.1-standard, kling-v2.5-turbo-image-to-video-pro, kling-v2.6, kling-v3-omni, kling-v3-turbo-image-to-video"
}
```

## エラー

HTTP 402 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Insufficient balance"
}
```

## エラー

HTTP 429 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "API key credit limit exceeded"
}
```

## エラー

HTTP 409 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## エラー

HTTP 429 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## エラー

HTTP 503 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## エラー

HTTP 504 - POST /api/v1/kling/image_to_video

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "The request timed out"
}
```

## エラー

HTTP 404 - GET /api/v1/kling/image_to_video/:id

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
```

## 生成されたコードサンプル

cURLを直接使用するか、お使いの言語向けのSDKをインストールしてください。各サンプルは、このリファレンスに示されたバリデーション済みリクエストを送信します。

### curl

```curl
curl -X POST https://runapi.ai/api/v1/kling/image_to_video \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"kling-o1","prompt":"A gentle camera pan across the scene.","first_frame_image_url":"https://file.runapi.ai/first-frame.png"}'
```

### javascript

#### インストール

```bash
npm install @runapi.ai/kling
```

```javascript
import { KlingClient } from "@runapi.ai/kling";

const client = new KlingClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.imageToVideo.create({
  "model": "kling-o1",
  "prompt": "A gentle camera pan across the scene.",
  "first_frame_image_url": "https://file.runapi.ai/first-frame.png"
});
```

### python

#### インストール

```bash
pip install runapi-kling
```

```python
import os
from runapi.kling import KlingClient

client = KlingClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.image_to_video.create(
  model="kling-o1",
  prompt="A gentle camera pan across the scene.",
  first_frame_image_url="https://file.runapi.ai/first-frame.png"
)
```

### go

#### インストール

```bash
go get github.com/runapi-ai/kling-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  kling "github.com/runapi-ai/kling-sdk/go/kling"
)

func main() {
  client, err := kling.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  task, err := client.ImageToVideo.Create(context.Background(), kling.ImageToVideoParams{
    Model: kling.ImageToVideoModel("kling-o1"),
    Prompt: "A gentle camera pan across the scene.",
    FirstFrameImageURL: "https://file.runapi.ai/first-frame.png",
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = task
}
```

### ruby

#### インストール

```bash
gem install runapi-kling
```

```ruby
require "runapi/kling"

client = RunApi::Kling::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.image_to_video.create(
  model: "kling-o1",
  prompt: "A gentle camera pan across the scene.",
  first_frame_image_url: "https://file.runapi.ai/first-frame.png"
)
```

### java

#### インストール

```kotlin
implementation("ai.runapi:runapi-kling")
```

```java
import ai.runapi.kling.KlingClient;
import ai.runapi.kling.types.ImageToVideoParams;
import ai.runapi.core.polling.TaskCreateResponse;

public final class Example {
  public static void main(String[] args) {
    KlingClient client = KlingClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TaskCreateResponse task = client.imageToVideo().create(
        ImageToVideoParams.builder()
        .model("kling-o1")
        .prompt("A gentle camera pan across the scene.")
        .firstFrameImageUrl("https://file.runapi.ai/first-frame.png")
            .build()
    );
  }
}
```

### php

#### インストール

```bash
composer require runapi-ai/kling
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\Kling\KlingClient;

$client = new KlingClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->imageToVideo->create([
  "model" => "kling-o1",
  "prompt" => "A gentle camera pan across the scene.",
  "first_frame_image_url" => "https://file.runapi.ai/first-frame.png"
]);
```

## 関連ガイド

- [認証](https://runapi.ai/ja/docs/guides/authentication.md)
- [クイックスタート](https://runapi.ai/ja/docs/guides/task-api/quickstart.md)

---

## RunAPI のその他の情報

- [ホーム](https://runapi.ai/ja/.md)
- [モデルカタログ](https://runapi.ai/ja/models.md)
- [料金](https://runapi.ai/ja/pricing.md)
- [プロバイダー](https://runapi.ai/ja/models)
- [ドキュメント](https://runapi.ai/ja/docs/guides)
- [SDK](https://runapi.ai/ja/sdk.md)
- [CLI](https://runapi.ai/ja/cli.md)
- [MCP Server](https://runapi.ai/ja/mcp.md)
- [Claude Code と Cursor](https://runapi.ai/ja/claude-code-vs-cursor.md)
- [Cursor API セットアップ](https://runapi.ai/ja/cursor-api-setup.md)
- [RunAPI と OpenRouter の比較](https://runapi.ai/ja/openrouter-alternative.md)
- [エンタープライズ](https://runapi.ai/ja/contact.md)
- [お問い合わせ](https://runapi.ai/ja/contact.md)
- [利用規約](https://runapi.ai/ja/terms.md)
- [プライバシー](https://runapi.ai/ja/privacy.md)
- [エージェント向けサイトインデックス](https://runapi.ai/llms.txt)

お問い合わせ: contact@runapi.ai

## 構造化データ

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/ja/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/jaicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "TechArticle",
    "headline": "Kling 画像から動画",
    "description": "画像から動画へのエンドポイントを使用して、非同期タスクを作成します。",
    "url": "https://runapi.ai/ja/docs/api/kling/image-to-video",
    "mainEntityOfPage": "https://runapi.ai/ja/docs/api/kling/image-to-video"
  }
]
```
