メインコンテンツへスキップ
POST
/
kling
/
v1
/
videos
/
text2video
Text to Video
curl --request POST \
  --url https://api.cometapi.com/kling/v1/videos/text2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "A happy scene of a vacation on the beach."
}
'
{
  "code": 123,
  "message": "<string>",
  "request_id": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "created_at": 123,
    "updated_at": 123
  }
}
このエンドポイントを使うと、プロンプトから Kling のテキストから動画タスクを作成できます。完成した動画をすぐに返すのではなく、非同期ジョブを開始します。

最初に動作確認するリクエスト

  • まずは短いプロンプトを送信してください
  • 基本的なフローが動作してから aspect_ratiodurationmode を追加してください
  • 純粋なポーリングではなくプッシュ配信を使いたい場合は、callback_url を設定してください

タスクの流れ

1

生成リクエストを送信

このエンドポイントを通じてタスクを作成し、返された Kling の task id を保存します。
2

タスク状態をポーリング

タスクが終了状態に到達するまで、個別クエリ を通じて進捗を確認します。
3

結果を保存

Kling が完成したアセットのメタデータを返したら、長期保持が必要な場合は結果を自分のストレージに移してください。
完全なパラメータ一覧と model-track の詳細については、Kling 公式ドキュメント を参照してください。このページのリクエストおよびレスポンスの形式は、CometAPI ラッパーのリファレンスとして利用してください。

承認

Authorization
string
header
必須

Bearer token authentication. Use your CometAPI key.

ヘッダー

Content-Type
string

Must be application/json.

ボディ

application/json
prompt
string
デフォルト:Hello
必須

Text prompt describing the video to generate. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

aspect_ratio
string

Output aspect ratio (width:height). Options: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3.

callback_url
string

Webhook URL to receive task status updates when the task completes.

model_name
string

Kling model variant to use. See the Models page for current options.

cfg_scale
number

Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.

mode
enum<string>

Generation mode. std for standard (faster), pro for professional (higher quality).

利用可能なオプション:
std,
pro
duration
string

Output video length in seconds. Options: 5, 10.

camera_control
object

Camera motion preset or manual configuration. Omit for automatic camera movement.

external_task_id
string

Custom task id for your own tracking. Does not replace the system-generated task id but can be used to query tasks. Must be unique per user.

レスポンス

200 - application/json

Successful Response

code
integer

Error code; specifically define the error code

message
string

error message

request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object