Skip to main content
POST
/
v1
/
predict-duration
/
{voice_id}
Predict text-to-speech duration
curl --request POST \
  --url https://supertoneapi.com/v1/predict-duration/{voice_id} \
  --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
  }
}
'
{
  "duration": 123
}
このドキュメントは英語の原文から自動翻訳されています。表現に不自然な箇所がある場合があります。正確な内容は英語の原文もあわせてご確認ください。
指定された入力から生成される音声の予想される長さ(秒)を返します。コスト見積もり、UI のヒント表示、バッチジョブの事前チェックなどに有用です。
このエンドポイントは クレジットを消費しません。300 文字の上限は適用され、自動チャンキングは行われません。

エンドポイント

POST https://supertoneapi.com/v1/predict-duration/{voice_id}

パスパラメータ

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

リクエストボディ

音声生成 と同じ形式で、textlanguagestylemodelvoice_settings を指定します。長さに影響しない output_formatinclude_phonemesnormalized_text は含まれません。
NameRequiredDescription
text解析対象のテキストです。最大 300 文字。
language言語コードです。ボイスとモデルの両方でサポートされている必要があります。
style感情スタイルです。デフォルトはボイスの最初のスタイルです。
modelTTS モデルです。デフォルトは sona_speech_1
voice_settingsspeedduration を通じて長さに影響します。全項目は 音声生成 のテーブルをご参照ください。

リクエスト例

POST /v1/predict-duration/20160a4c5ba38967330c84
x-sup-api-key: $SUPERTONE_API_KEY
Content-Type: application/json

{
  "text": "This is a long-form sentence for duration prediction.",
  "language": "en",
  "style": "neutral"
}

レスポンス

{
  "duration": 3.57
}
長さは float 型の秒数で返されます。

注意事項

  • 予測時には、実際の create_speech 呼び出しと 同じ modelspeed を指定してください。両方が結果に影響します。異なる速度で予測と生成を行うと、長さに不整合が生じます。
  • クレジットは差し引かれません。 UI のヒント表示や予算の事前チェックに安全にご利用いただけます。

関連項目

Docs: Cost and usage

予測と予算管理に predict_duration を活用する方法。

Create speech

見積もりを確認したうえで、実際にオーディオを生成します。

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. Max length is 300 characters.

Maximum string length: 300
language
enum<string>
required

Language code of the voice

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

Response

Returns predicted duration of the audio in seconds

duration
number