コンテンツへスキップ
APIリファレンス
APIリファレンス

Suno テキスト読み上げ

説明や指定した台本から音声を生成します。声のスタイルや背景音楽も指定できます。

01

概要

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

クイックスタート

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

エンドポイント

POST /api/v1/suno/text_to_speech
ベースURL
https://runapi.ai
API バージョン
v1
認証
Authorization: Bearer YOUR_API_TOKEN
02

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

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

03

リクエストスキーマ

JSONボディ

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

suno-speechフィールド9件
background_musicboolean
任意

背景音楽を追加するかどうか。custom_mode が true の場合のみ指定できます。

許可される値: true, false
callback_urlstring
任意

非同期通知用のWebhook URL。

custom_modeboolean
必須

必須のモード切り替え。false は prompt から台本を作成し、true は script に指定された文章を読み上げます。

許可される値: true, false
modelstring
必須

モデルスラッグ。

promptstring
任意

場面の説明。検証前に前後の空白を除去します。custom_mode が false の場合は必須、true の場合は禁止です。

範囲: 1 - 3000
scriptstring
任意

読み上げる文章。検証前に前後の空白を除去します。custom_mode が true の場合は必須、false の場合は禁止です。

範囲: 1 - 5000
tonestring
任意

口調、リズム、感情、場面。検証前に前後の空白を除去します。custom_mode が true の場合のみ指定できます。

範囲: 0 - 1000
varietyinteger
任意

忠実なスタイルから大きな変化までの多様性。custom_mode が true の場合のみ指定できます。

許可される値: 0, 1, 2, 3, 4 範囲: 0 - 4
vocal_genderstring
任意

声の性別。custom_mode が true の場合のみ指定できます。

許可される値: male, female

条件付きルール

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

  1. 条件 custom_mode = false
    必須
    prompt
    使用不可
    script, tone, variety, vocal_gender, background_music
  2. 条件 custom_mode = true
    必須
    script
    使用不可
    prompt
04

承認を作成する

HTTP 202

POST /api/v1/suno/text_to_speech

レスポンススキーマ
JSON
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
05

ポーリング処理中

HTTP 200

GET /api/v1/suno/text_to_speech/:id

レスポンススキーマ
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
06

ポーリング完了

HTTP 200

GET /api/v1/suno/text_to_speech/:id

レスポンススキーマ
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready",
        "all_audios_ready",
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "id",
    "status",
    "audios",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-speech.mp3",
      "duration": 2.5,
      "id": "speech_reference"
    }
  ],
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  }
}
07

ポーリング失敗

HTTP 200

GET /api/v1/suno/text_to_speech/:id

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
08

顧客コールバック: 処理中

HTTP 200

POST callback_url

レスポンススキーマ
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
09

顧客コールバック: 完了

HTTP 200

POST callback_url

レスポンススキーマ
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready",
        "all_audios_ready",
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "id",
    "status",
    "audios",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-speech.mp3",
      "duration": 2.5,
      "id": "speech_reference"
    }
  ],
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  }
}
10

顧客コールバック: 失敗

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"
}
11

エラー

HTTP 401

POST /api/v1/suno/text_to_speech

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Authentication required"
}
12

エラー

HTTP 401

GET /api/v1/suno/text_to_speech/:id

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Authentication required"
}
13

エラー

HTTP 400

POST /api/v1/suno/text_to_speech

レスポンススキーマ
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": "Validation failed",
  "errors": {
    "custom_mode": [
      "is required"
    ]
  }
}
14

エラー

HTTP 402

POST /api/v1/suno/text_to_speech

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Insufficient balance"
}
15

エラー

HTTP 429

POST /api/v1/suno/text_to_speech

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "API key credit limit exceeded"
}
16

エラー

HTTP 409

POST /api/v1/suno/text_to_speech

レスポンススキーマ
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"
}
17

エラー

HTTP 429

POST /api/v1/suno/text_to_speech

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Rate limit reached. Please retry later."
}
18

エラー

HTTP 503

POST /api/v1/suno/text_to_speech

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Service under maintenance, please try again later"
}
19

エラー

HTTP 503

POST /api/v1/suno/text_to_speech

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "The request timed out"
}
20

エラー

HTTP 404

GET /api/v1/suno/text_to_speech/:id

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
21

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

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

インストール

Shell
pip install runapi-suno
PYTHON
import os
from runapi.suno import SunoClient

client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_speech.create(
  model="suno-speech",
  custom_mode=True,
  script="Welcome to our morning briefing.",
  tone="Warm and calm",
  variety=1,
  vocal_gender="female",
  background_music=False
)