メインコンテンツへスキップ
POST
/
kling
/
v1
/
audio
/
text-to-audio
Create a Kling text-to-audio task
curl --request POST \
  --url https://api.cometapi.com/kling/v1/audio/text-to-audio \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "Soft ambient ocean waves at sunrise.",
  "duration": 5
}
'
{
  "code": 0,
  "message": "SUCCEED",
  "data": {
    "task_id": "861254119619698760",
    "task_status": "submitted",
    "task_info": {},
    "created_at": 1773367502225,
    "updated_at": 1773367502225
  }
}
このエンドポイントを使用すると、Kling を通じてテキストプロンプトから短い音声クリップを生成できます。

呼び出す前に

  • prompt は簡潔かつ明確にしてください
  • duration は 3〜10 秒の範囲から始めてください
  • callback_urlexternal_task_id は必須要件ではなく、任意の連携補助として扱ってください

タスクフロー

1

音声タスクを送信

テキストプロンプトと duration を送信し、返された task id を保存します。
2

タスクをポーリング

タスクが終了状態に達するまで、Kling の音声クエリパスを使って 個別クエリ を続けてください。
3

音声出力を保存

プロバイダーの配信保持期間を超えて必要な場合は、最終的な音声アセットを永続保存してください。
2026-03-13 の実運用検証では、promptduration のみを含む最小限のリクエストが受け付けられ、task_status: submitted が返されることが確認されました。
完全なパラメータリファレンスについては、Kling の公式ドキュメント を参照してください。

承認

Authorization
string
header
必須

Bearer token authentication. Use your CometAPI key.

ボディ

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

Text prompt describing the audio to generate. Max 200 characters.

duration
integer
デフォルト:5
必須

Duration of the generated audio in seconds. Range: 3.0–10.0, supports one decimal place.

external_task_id
string
デフォルト:audio-text-task-001

Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

callback_url
string
デフォルト:https://example.com/webhook

Webhook URL for task status notifications. The server sends a callback when the task status changes.

レスポンス

200 - application/json

Task accepted.

code
integer
必須

Error code; specific error code definition

message
string
必須

Error message

data
object
必須