メインコンテンツへスキップ
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

音声タスクを送信

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

タスクをポーリング

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

音声出力を保存

プロバイダーの提供期間を過ぎても必要な場合は、最終的な音声アセットを永続保存してください。
完全なパラメータリファレンスについては、official Kling documentation を参照してください。

承認

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
必須