POST
/
v1
/
text-to-speech
/
{voice_id}
curl --request POST \
  --url https://supertoneapi.com/v1/text-to-speech/{voice_id} \
  --header 'Content-Type: application/json' \
  --header 'x-sup-api-key: <x-sup-api-key>' \
  --data '{
  "text": "<string>",
  "language": "en",
  "style": "<string>",
  "model": "sona_speech_1",
  "voice_settings": {
    "pitch_shift": 0,
    "pitch_variance": 1,
    "speed": 1
  }
}'
This response does not have an example.

指定したボイスでテキストを音声に変換するTTS(Text-to-Speech)APIです。
このAPIを通じて、希望する文章を自然な音声で生成できます。

基本使用方式

  • {voice_id}キャラクター単位のIDのみ使用可能
  • languagestylemodelなどのパラメータはRequest Bodyに含まれます

Request Body項目説明

項目必須説明
text変換するテキスト。最大300文字まで入力可能
languageテキストの言語。koenjaのうち一つ
style感情スタイル。例:neutralhappysadなど。指定しない場合、そのキャラクターのデフォルトスタイルが適用
model使用モデル。デフォルト値はsona_speech_1。現在はこのモデルのみ使用可能
voice_settingsピッチ/速度調節。pitch_shiftpitch_variancespeedフィールド含む(デフォルト値:0、1、1)

使用例

POST /v1/text-to-speech/{voice_id}
Content-Type: application/json
x-sup-api-key: [YOUR_API_KEY]

{
  "text": "Thank you for calling.",
  "language": "en",
  "style": "happy",
  "model": "sona_speech_1",
  "voice_settings": {
    "pitch_shift": 0,
    "pitch_variance": 1,
    "speed": 1
  }
}

レスポンス

  • レスポンス本文はbinary audio fileとして返され、基本フォーマットはwav
  • output_format=mp3をクエリパラメータとして渡すとmp3形式でもレスポンス可能
  • X-Audio-Lengthヘッダーを通じて音声の長さ(秒)を確認可能

注意事項

  • textの長さが300文字を超過すると400エラーが発生します。
  • styleがない場合でも呼び出し可能ですが、キャラクターによってdefault styleが異なる可能性があるため、Get Voices APIを呼び出してデフォルトスタイルを確認してください(スタイル配列の最初の値がデフォルト)。
  • レスポンスの音声ファイルは直接保存または再生できます(クライアントに応じて適切な処理が必要)。

Headers

x-sup-api-key
string
required

API key for the service

Path Parameters

voice_id
string
required

Query Parameters

output_format
enum<string>
default:wav

The desired output format of the audio file (wav, mp3). Default is wav.

Available options:
wav,
mp3

Body

application/json

Response

200
audio/wav

Audio file converted from text. The response includes an X-Audio-Length header with the duration in seconds.

The response is of type file.