Skip to main content
POST
/
v1
/
text-to-speech
/
{voice_id}
/
stream
Convert text to speech with streaming response
curl --request POST \
  --url https://supertoneapi.com/v1/text-to-speech/{voice_id}/stream \
  --header 'Content-Type: application/json' \
  --header 'x-sup-api-key: <api-key>' \
  --data '
{
  "text": "<string>",
  "style": "<string>",
  "model": "sona_speech_1",
  "output_format": "wav",
  "voice_settings": {
    "pitch_shift": 0,
    "pitch_variance": 1,
    "speed": 1,
    "duration": 0,
    "similarity": 3,
    "text_guidance": 1,
    "subharmonic_amplitude_control": 1
  },
  "include_phonemes": false,
  "normalized_text": "<string>"
}
'
"<string>"
このドキュメントは英語の原文から自動翻訳されています。表現に不自然な箇所がある場合があります。正確な内容は英語の原文もあわせてご確認ください。
生成された音声をチャンク単位でストリーミングして返すため、クリップ全体の生成完了を待たずに再生を開始できます。ストリーミングと高速な非ストリーミングモデルの使い分けについては、Docs: 音声ストリーミング および レイテンシ最適化 をご参照ください。
ストリーミングは現在 sona_speech_1 のみでサポートされています。

エンドポイント

POST https://supertoneapi.com/v1/text-to-speech/{voice_id}/stream

パスパラメータ

NameRequiredDescription
voice_id対象ボイスの ID です。

リクエストボディ

Content-Type: application/json
NameRequiredDescription
text変換対象のテキストです。最大 300 文字。
language言語コードです。サポート: enkoja
style感情スタイル(例: neutralhappy)です。未指定の場合はボイスのデフォルトスタイルが適用されます。
modelsona_speech_1 である必要があります(ストリーミングをサポートする唯一のモデル)。
output_formatwav(デフォルト)または mp3
voice_settings高度なボイスパラメータです。フィールドと値の範囲は 音声生成 と同じです。
include_phonemestrue の場合、レスポンスはチャンクごとに音素データを含む NDJSON となります。デフォルト: false

レスポンス

デフォルト(include_phonemes=false): バイナリオーディオストリームを返します。
  • Content-Type: audio/wav または audio/mpegoutput_format に対応)。
  • 最初のチャンクにはオーディオファイルヘッダーが含まれ、以降のチャンクは生のオーディオデータです。
include_phonemes=true の場合: 改行区切りの JSON(NDJSON)で、1 チャンクにつき 1 オブジェクトを返します。
{"audio_base64":"...","phonemes":{"symbols":["","h"],"start_times_seconds":[0,0.05],"durations_seconds":[0.05,0.08]}}
{"audio_base64":"...","phonemes":{"symbols":["ɐ","ɡ"],"start_times_seconds":[0.13,0.19],"durations_seconds":[0.06,0.04]}}

注意事項

  • 音声ストリーミングは現在 ベータ 版で、sona_speech_1 のみをサポートします。
  • text が 300 文字を超えると 400 を返します。SDK は長い入力を自動でチャンキングし、イテレーターにチャンクを転送します。
  • speedduration の後に適用されます(例: duration=5 + speed=2 で約 10 秒)。
  • style を省略した場合はボイスのデフォルトスタイルが適用されます。デフォルトは ボイス取得 で確認できます。

関連項目

Docs: Stream speech

ストリーミングを使うべき場面と、各 SDK でのチャンク消費方法。

LLM streaming TTS

OpenAI および Anthropic を用いたエンドツーエンドのレシピ。

Authorizations

x-sup-api-key
string
header
required

Path Parameters

voice_id
string
required

Body

application/json
text
string
required

The text to convert to speech

Maximum string length: 300
language
enum<string>
required

The language code of the text

Available options:
en,
ko,
ja,
bg,
cs,
da,
el,
es,
et,
fi,
hu,
it,
nl,
pl,
pt,
ro,
ar,
de,
fr,
hi,
id,
ru,
vi,
hr,
lt,
lv,
sk,
sl,
sv,
tr,
uk
style
string

The style of character to use for the text-to-speech conversion

model
enum<string>
default:sona_speech_1

The model type to use for the text-to-speech conversion

Available options:
sona_speech_1,
sona_speech_2,
sona_speech_2_flash,
supertonic_api_1,
supertonic_api_3
output_format
enum<string>
default:wav

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

Available options:
wav,
mp3
voice_settings
object
include_phonemes
boolean
default:false

Return phoneme timing data with the audio

normalized_text
string

Pre-normalized text for TTS. Only used with sona_speech_2 and sona_speech_2_flash models.

Response

Streaming audio data in binary format or NDJSON format with phoneme data based on includePhonemes parameter

Binary audio stream (when includePhonemes=false or omitted)