Convert text to speech
curl --request POST \
--url https://supertoneapi.com/v1/text-to-speech/{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
},
"include_phonemes": false,
"normalized_text": "<string>"
}
'import requests
url = "https://supertoneapi.com/v1/text-to-speech/{voice_id}"
payload = {
"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>"
}
headers = {
"x-sup-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-sup-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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>'
})
};
fetch('https://supertoneapi.com/v1/text-to-speech/{voice_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://supertoneapi.com/v1/text-to-speech/{voice_id}"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"style\": \"<string>\",\n \"model\": \"sona_speech_1\",\n \"output_format\": \"wav\",\n \"voice_settings\": {\n \"pitch_shift\": 0,\n \"pitch_variance\": 1,\n \"speed\": 1,\n \"duration\": 0,\n \"similarity\": 3,\n \"text_guidance\": 1,\n \"subharmonic_amplitude_control\": 1\n },\n \"include_phonemes\": false,\n \"normalized_text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-sup-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://supertoneapi.com/v1/text-to-speech/{voice_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-sup-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://supertoneapi.com/v1/text-to-speech/{voice_id}")
.header("x-sup-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"style\": \"<string>\",\n \"model\": \"sona_speech_1\",\n \"output_format\": \"wav\",\n \"voice_settings\": {\n \"pitch_shift\": 0,\n \"pitch_variance\": 1,\n \"speed\": 1,\n \"duration\": 0,\n \"similarity\": 3,\n \"text_guidance\": 1,\n \"subharmonic_amplitude_control\": 1\n },\n \"include_phonemes\": false,\n \"normalized_text\": \"<string>\"\n}")
.asString();"<string>"{
"status": "error",
"message": "Invalid request data"
}{
"status": "error",
"message": {
"message": "Invalid API Key",
"error": "Unauthorized"
}
}{
"status": "error",
"message": {
"message": "Not enough credits",
"error": "Payment Required"
}
}{
"status": "error",
"message": {
"message": "Permission denied",
"error": "Forbidden"
}
}{
"status": "error",
"message": {
"message": "Voice not found",
"error": "Not Found"
}
}{
"status": "error",
"message": {
"message": "Request timed out",
"error": "Request Timeout"
}
}{
"status": "error",
"message": {
"message": "rate limit exceeded",
"error": "Too Many Requests"
}
}{
"status": "error",
"message": {
"message": "Failed to convert text to speech",
"error": "Internal Server Error"
}
}Text to speech
Create speech
選択したボイスを使用して、テキストを完全な音声ファイルに変換します。
POST
/
v1
/
text-to-speech
/
{voice_id}
Convert text to speech
curl --request POST \
--url https://supertoneapi.com/v1/text-to-speech/{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
},
"include_phonemes": false,
"normalized_text": "<string>"
}
'import requests
url = "https://supertoneapi.com/v1/text-to-speech/{voice_id}"
payload = {
"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>"
}
headers = {
"x-sup-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-sup-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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>'
})
};
fetch('https://supertoneapi.com/v1/text-to-speech/{voice_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://supertoneapi.com/v1/text-to-speech/{voice_id}"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"style\": \"<string>\",\n \"model\": \"sona_speech_1\",\n \"output_format\": \"wav\",\n \"voice_settings\": {\n \"pitch_shift\": 0,\n \"pitch_variance\": 1,\n \"speed\": 1,\n \"duration\": 0,\n \"similarity\": 3,\n \"text_guidance\": 1,\n \"subharmonic_amplitude_control\": 1\n },\n \"include_phonemes\": false,\n \"normalized_text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-sup-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://supertoneapi.com/v1/text-to-speech/{voice_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-sup-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://supertoneapi.com/v1/text-to-speech/{voice_id}")
.header("x-sup-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"style\": \"<string>\",\n \"model\": \"sona_speech_1\",\n \"output_format\": \"wav\",\n \"voice_settings\": {\n \"pitch_shift\": 0,\n \"pitch_variance\": 1,\n \"speed\": 1,\n \"duration\": 0,\n \"similarity\": 3,\n \"text_guidance\": 1,\n \"subharmonic_amplitude_control\": 1\n },\n \"include_phonemes\": false,\n \"normalized_text\": \"<string>\"\n}")
.asString();"<string>"{
"status": "error",
"message": "Invalid request data"
}{
"status": "error",
"message": {
"message": "Invalid API Key",
"error": "Unauthorized"
}
}{
"status": "error",
"message": {
"message": "Not enough credits",
"error": "Payment Required"
}
}{
"status": "error",
"message": {
"message": "Permission denied",
"error": "Forbidden"
}
}{
"status": "error",
"message": {
"message": "Voice not found",
"error": "Not Found"
}
}{
"status": "error",
"message": {
"message": "Request timed out",
"error": "Request Timeout"
}
}{
"status": "error",
"message": {
"message": "rate limit exceeded",
"error": "Too Many Requests"
}
}{
"status": "error",
"message": {
"message": "Failed to convert text to speech",
"error": "Internal Server Error"
}
}このドキュメントは英語の原文から自動翻訳されています。表現に不自然な箇所がある場合があります。正確な内容は英語の原文もあわせてご確認ください。
エンドポイント
POST https://supertoneapi.com/v1/text-to-speech/{voice_id}
パスパラメータ
| Name | Required | Description |
|---|---|---|
voice_id | ✅ | 対象ボイスの ID です。 |
リクエストボディ
| Name | Required | Description |
|---|---|---|
text | ✅ | 変換対象のテキストです。最大 300 文字。 より長い入力には SDK の利用、またはクライアント側での分割をご検討ください。 |
language | ✅ | 言語コード(例: en、ko、ja)です。ボイスとモデルの両方でサポートされている必要があります。 |
style | — | 感情スタイル(例: neutral、happy)です。未指定の場合はボイスのデフォルトスタイルが適用されます。 |
model | — | TTS モデルです。デフォルトは sona_speech_1。 |
output_format | — | wav(デフォルト)または mp3。 |
voice_settings | — | 高度なボイスパラメータです(下記参照)。 |
include_phonemes | — | true の場合、レスポンスは Base64 オーディオと音素タイミングデータを含む JSON に切り替わります。デフォルト: false。 |
normalized_text | — | 発音正規化された補助テキストです(sona_speech_2 および sona_speech_2_flash で使用され、主に日本語向け)。 |
モデル別対応言語
| Model | Languages |
|---|---|
sona_speech_2, sona_speech_2_flash | en, ko, ja, bg, cs, da, el, es, et, fi, hu, it, nl, pl, pt, ro, ar, de, fr, hi, id, ru, vi |
supertonic_api_3 | en, ko, ja, ar, bg, cs, da, de, el, es, et, fi, fr, hi, hr, hu, id, it, lt, lv, nl, pl, pt, ro, ru, sk, sl, sv, tr, uk, vi |
supertonic_api_1 | en, ko, ja, es, pt |
sona_speech_1 | en, ko, ja |
ボイス設定
サポートされていない設定は警告なく無視されます(エラーにはなりません)。| Name | Range | Default | Description |
|---|---|---|---|
pitch_shift | -24 → 24 | 0 | 半音(semitone)単位のピッチ調整です。 |
pitch_variance | 0 → 2 | 1 | ピッチ変動の度合いです。 |
speed | 0.5 → 2 | 1 | 再生レートの倍率です。duration の後に適用されます。 |
duration | 0 → 60 | 0 | 非ゼロを指定すると、その長さ(秒)に合わせて音声を生成します。 |
similarity | 1 → 5 | 3 | 生成音声が元のキャラクターボイスにどれだけ近いかを制御します。 |
text_guidance | 0 → 4 | 1 | 入力テキストの内容に対して発話特性がどの程度敏感に適応するかを制御します。 |
subharmonic_amplitude_control | 0 → 2 | 1 | 生成音声のサブハーモニック振幅量を制御します。 |
モデル別のボイス設定
| Setting | sona_speech_2 | sona_speech_2_flash | supertonic_api_3 | supertonic_api_1 | sona_speech_1 |
|---|---|---|---|---|---|
pitch_shift, pitch_variance, duration | ✅ | ✅ | — | — | ✅ |
speed | ✅ | ✅ | ✅ | ✅ | ✅ |
similarity, text_guidance | ✅ | — | — | — | ✅ |
subharmonic_amplitude_control | — | — | — | — | ✅ |
レスポンス
デフォルト(include_phonemes=false): ボディにバイナリオーディオを返します。
Content-Type: audio/wavまたはaudio/mpeg(output_formatに対応)。X-Audio-Lengthヘッダー: 生成音声の長さ(秒)です。
include_phonemes=true の場合: Base64 オーディオと音素配列を含む JSON ボディです。
{
"audio_base64": "UklGRnoGAABXQVZF...",
"phonemes": {
"symbols": ["", "h", "ɐ", "ɡ", "ʌ", ""],
"start_times_seconds": [0, 0.092, 0.197, 0.255, 0.29, 0.58],
"durations_seconds": [0.092, 0.104, 0.058, 0.034, 0.29, 0.162]
}
}
注意事項
textが 300 文字を超えると400を返します。自動チャンキングには Python または TypeScript SDK をご利用いただくか、手動で分割してください(長文 を参照)。speedはdurationの後に適用されます。duration=5とspeed=2を指定すると、約 10 秒のオーディオが生成されます。styleを省略した場合は、ボイスのstyles配列の最初の値が使用されます。デフォルトはボイスごとに異なる場合があるため、ボイス取得 で確認してください。
関連項目
Docs: Create speech
SDK サンプル付きの解説。
Stream speech
クリップ全体を待たずに、オーディオチャンクをストリーミングします。
Authorizations
Path Parameters
Body
application/json
The text to convert to speech
Maximum string length:
300The 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 The style of character to use for the text-to-speech conversion
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 The desired output format of the audio file (wav, mp3). Default is wav.
Available options:
wav, mp3 Show child attributes
Show child attributes
Return phoneme timing data with the audio
Pre-normalized text for TTS. Only used with sona_speech_2 and sona_speech_2_flash models.
Response
Returns either binary audio or JSON with phoneme data based on include_phonemes parameter
Binary audio file (when include_phonemes=false or omitted)