Papatono API
Ka whakaurua a TTS.ai ki ōna taupānga me a tātau REST API. He āhua ōrite OpenAI mō te hekenga ngāwari.
Whakamāramatanga
Ka homai e te TTS.ai API te āheitanga papatono ki ngā āhuahira papatono katoa: te whakakotahitanga kupu-ki-rongo, te whakawhitinga reo-ki-rongo, te tārua reo, te whakarei oro, me ētahi atu.
Papamahi API
Ki te whiwhi i tātou kī API mai i Ka taea te whakawātea te kāwanatanga o te kāwanatanga.. Kei te wātea i runga i ngā mahere Pro me Enterprise.
URL taketake
https://api.tts.ai/v1/
Ka whakaaetia
Mā te tohu kaihautū Authorization kaipupuru
Tuakiritanga
/v1/tts/ Ka mahi me te kore mana, tae atu ki te 5,000 ngā tohu/rohe i ia IP, mā te whakamahi i tētahi o a tātau tauira wātea (piper, vits, melotts, kokoro). Ka whakaingoatia he kāwanatanga ā iwi ā iwi i te tau kotahi mano e 15,000 tau ki mua o te wā o te wā o te wā o te wā.
E hiahiatia ana e ngā tono API katoa te manatoko mā tētahi tohu Bearer i roto i te Authorization kaipupuru.
Authorization: Bearer sk-tts-your-api-key-here
SDKs
Ko ngā SDK ā-ture e ngāwari ai te whakauru i te TTS.ai ki roto i tō rātou taupānga. He pūtake tūwhera rāua, ā, ka wātea ki te GitHub.
Python
pip install ttsai
from tts_ai import TTSClient
client = TTSClient(api_key="sk-tts-...")
audio = client.generate(
text="Hello world!",
model="kokoro"
)
client.save(audio, "output.wav")
JavaScript / Node.js
npm install @ttsainpm/ttsai
const { TTSClient } = require('@ttsainpm/ttsai');
const client = new TTSClient({
apiKey: 'sk-tts-...'
});
const audio = await client.generate({
input: 'Hello world!',
model: 'kokoro'
});
await client.saveToFile(audio, 'output.wav');
URL taketake
E pā ana ngā wāhi mutunga katoa ki tēnei URL taketake. Hei tauira, ko te wāhi mutunga TTS:
Te mokatere o ngā tepe
He rerekē ngā tepe ine API e ai ki te mahere:
| Rārangi | E hiahiatia ana/min | E ōrite ana | Te roa rawa o te kupu |
|---|---|---|---|
| Waihoki | 10 | 2 | 500 ngā pūāhua |
| Ka tīmata | 30 | 3 | 1,000,000 ngā pūāhua |
| Pro | 60 | 5 | 1,000,000 ngā pūāhua |
| Kaupapa | 300 | 20 | 50,000 ngā pūāhua |
Kei roto i ia urupare nga taitapa tepe o te mokatere: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.
Ko ngā utu pūtea
| Waihoki | Ko te utu | Waihoki |
|---|---|---|
| TTS (ngā tauira wātea: Piper, VITS, MeloTTS) | 1 pūpū | i ia 1,000 ngā tohu |
| TTS (ngā tauira paerewa: Kokoro, CosyVoice 2, etc.) | 2 ngā uara | i ia 1,000 ngā tohu |
| TTS (Wāhi tauira: Tortoise, Chatterbox, etc.) | 4 ngā uara | i ia 1,000 ngā tohu |
| Ka kōrerorerotia te kuputuhi | 2 ngā uara | i ia minu o te oro |
| Ko te tāruatanga reo | 4 ngā uara | i ia 1,000 ngā tohu |
| Kaitautoko reo | 3 ngā uara | i ia minu o te oro |
| Whakarei ake reo | 2 ngā uara | i ia minu o te oro |
| Ka tangohia te pūoro / Te whakawehenga pūoro | 3-4 ngā uara | i ia minu o te oro |
| Whakamāoritanga kōrero | 5 ngā uara | i ia minu o te oro |
| Pāpāho reo | 3 ngā uara | i ia huringa |
| Ka kitea te kī BPM | Waihoki | -- |
| Ka whakarerekētia te oro | Waihoki | -- |
Waihoki ki te kōrero
Ka tahuri te kupu ki te oro reo. Ka hoki te faila oro ki te hanga e hiahiatia ana.
Ka tono te tinana
| Parameter | Kāhua | E hiahiatia ana | Whakamāramatanga |
|---|---|---|---|
| model | string | Kāore | Tau tauira (hei tauira, kokoro, chatterbox, piper) |
| text | string | He | Te kupu hei tahuri ki te kōrero (ki te 5,000 ngā pūāhua mō Pro, 50,000 mō Enterprise) |
| voice | string | He | Voice ID (ka whakamahia te /v1/voices/ hei whakarārangi i ngā reo e wātea ana) |
| format | string | Kāore | Kāhua huaputa: mp3 (matatū), wav, flac, ogg |
| speed | float | Kāore | Ka whakarea te tere kōrero. Papatono: 1.0. Rārangi: 0.5 ki 2.0 |
| language | string | Kāore | Ko te waehere reo (hei tauira, en, es). Ka kitea-māori mēnā ka waihotia. |
| instructions | string | Kāore | Ka mahi / tuku i ngā tohu (≤500 ngā pūāhua). hei tauira |
| pronunciations | object | array | Kāore | Ka whakakāhoretia te kōrero-whakahaeretanga. {\ |
| stream | boolean | Kāore | Whakahaere i te urupare rerenga. Tūturu: whakahaere |
Ka tono tauira
curl -X POST https://api.tts.ai/v1/tts/ \
-H "Authorization: Bearer sk-tts-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "kokoro",
"text": "Hello from TTS.ai! This is a test.",
"voice": "af_bella",
"format": "mp3"
}' \
--output output.mp3
Taga SSML
Ka whakaroa ngā tau, ngā rā, ngā moni, ngā tau tāpu, me ngā whakaroa i roto i Ko te hanga rā o te rā he The TTS endpoint queues your request and returns a JSON response with a job UUID. You then poll for the result. Poll this endpoint every 1-2 seconds until Fetch the Streaming alternative: For supported models (Kokoro, MeloTTS), use
Whakamārama Input I kōrerotia hei cardinal1234one thousand two hundred thirty-four ordinal21twenty-first date1999-12-31Tērā tekau mā kotahi tekau mā iwa o Tepiripa, tekau mā iwa tekau mā iwa time14:30two thirty PM telephone+1-555-867-5309plus one five five five eight six seven… currency$1,234.56one thousand two hundred thirty-four dollars and fifty-six cents spell-outNASAN A S A mdy mō te reo Ingarihi me dmy i ētahi atu wāhi; whakahōu me format=\{
"model": "kokoro",
"voice": "af_bella",
"text": "Your appointment is on <say-as interpret-as=\"date\">2026-04-26</say-as> at <say-as interpret-as=\"time\">14:30</say-as>. Please call <say-as interpret-as=\"telephone\">+1-555-867-5309</say-as> if you need to reschedule."
}Ka urupare
Step 1: Submit request
{
"uuid": "77b71db532874ce98e84a69a2d740d4c",
"job_id": "f21316bb-aefa-480d-8523-701d1e3184ce",
"status": "queued",
"credits_used": 11,
"credits_remaining": 15000
}Step 2: Poll for result
status is completed or failed.{
"status": "completed",
"result_url": "https://api.tts.ai/static/downloads/77b71db5.../output.mp3"
}{
"status": "processing"
}Step 3: Download audio
result_url from the completed response to download the audio file.Hei tauira katoa
import requests, time
API_KEY = "sk-tts-your-key"
BASE = "https://api.tts.ai"
# 1. Submit TTS request
resp = requests.post(f"{BASE}/v1/tts/", json={
"model": "kokoro",
"text": "Hello from TTS.ai!",
"voice": "af_bella"
}, headers={"Authorization": f"Bearer {API_KEY}"})
data = resp.json()
uuid = data["uuid"]
# 2. Poll for result
while True:
result = requests.get(f"{BASE}/v1/speech/results/",
params={"uuid": uuid}).json()
if result["status"] == "completed":
# 3. Download audio
audio = requests.get(result["result_url"])
with open("output.mp3", "wb") as f:
f.write(audio.content)
break
elif result["status"] == "failed":
raise Exception(result.get("error", "Generation failed"))
time.sleep(1.5)POST /v1/tts/stream/ for real-time Server-Sent Events (SSE) streaming — no polling needed.
Ka kōrerorerotia te kuputuhi
Ka whakawhiti reo ki te kupu. E tautoko ana i ngā reo 99 me te kitenga aunoa.
Ka tono te tinana (multipart/form-data)
| Parameter | Kāhua | E hiahiatia ana | Whakamāramatanga |
|---|---|---|---|
| file | file | He | Ko te pūkete oro (MP3, WAV, FLAC, OGG, M4A, MP4, WebM). Tūtohu 100MB. |
| model | string | Kāore | Tauira STT: whisper (matatū), faster-whisper, sensevoice
|
| language | string | Kāore | Ko te waehere reo. auto mō te kitenga aunoa (whakahaere). |
| timestamps | boolean | Kāore | Kei roto ko ngā tohu wā o te taumata-wā. Tūturu: pūnaha |
| diarize | boolean | Kāore | Mā te whakahohe kaikōrero i te kaikōrero. Tūturu: whakahē |
Ka urupare
{
"text": "Hello, this is a transcription test.",
"language": "en",
"duration": 3.5,
"segments": [
{
"start": 0.0,
"end": 1.8,
"text": "Hello, this is",
"speaker": "SPEAKER_00"
},
{
"start": 1.8,
"end": 3.5,
"text": "a transcription test.",
"speaker": "SPEAKER_00"
}
]
}
Ko te tāruatanga reo
Ka whakaputaina te kōrero i roto i tētahi reo tārua. Whakahauhau i tētahi oro tohutoro me te kupu.
Ka tono te tinana (multipart/form-data)
| Parameter | Kāhua | E hiahiatia ana | Whakamāramatanga |
|---|---|---|---|
| reference_audio | file | He | Ko te oro oro tohutoro (10-30 sekon i whakaritea). 20MB te nui rawa. |
| text | string | He | Ka kōrerotia te kupu i roto i te reo tārua. |
| model | string | Kāore | Kāhua tārua: chatterbox (matatū), cosyvoice2, gpt-sovits
|
| format | string | Kāore | Hanganga huaputa: mp3 (matatū), wav, flac |
| language | string | Kāore | Ko te waehere reo ūnga. Me tautokona e te tauira i kōwhiria. |
Ka urupare
Ka hoki te pūkete oro hei raraunga ā-rua, pērā ki te wāhi mutunga TTS.
Kaitautoko reo
Ka tahuri te oro hei oro pēnei i tētahi atu reo. Whakahauhau i te oro pūtake me te kōwhiri i tētahi reo ūnga.
Ka tono te tinana (multipart/form-data)
| Parameter | Kāhua | E hiahiatia ana | Whakamāramatanga |
|---|---|---|---|
| file | file | He | Ko te pūtake o te pūkete oro (MP3, WAV, FLAC). Tūtohu 50MB. |
| target_voice | string | He | Ko te tuakiri reo ūnga hei tahuri ki (ka whakamahia te /v1/voices/ hei whakarārangi i ngā reo e wātea ana) |
| model | string | Kāore | Tauira tahuri reo: openvoice (matatū), knn-vc |
| format | string | Kāore | Hanganga huaputa: wav (matatū), mp3, flac |
Ka tono tauira
curl -X POST https://api.tts.ai/v1/voice-convert/ \
-H "Authorization: Bearer sk-tts-your-key" \
-F "file=@source_audio.mp3" \
-F "target_voice=af_bella" \
-F "model=openvoice" \
-o converted.wav
Ka urupare
Ka hoki te faila oro i tahuri hei raraunga ā-rua.
Whakamāoritanga kōrero
Ka whakamāori i te oro i kōrerotia mai i tētahi reo ki tētahi atu. Ka whakakotahi i te kōrero ki te kupu, te whakamāoritanga, me te kupu-ki-te-kōrero i roto i tētahi kīanga kotahi.
Ka tono te tinana (multipart/form-data)
| Parameter | Kāhua | E hiahiatia ana | Whakamāramatanga |
|---|---|---|---|
| file | file | He | Ko te pūtake o te pūkete oro i roto i te reo taketake. 100MB te nui rawa. |
| target_language | string | He | Ko te waehere reo ūnga (hei tauira, es, fr, de, ja) |
| voice | string | Kāore | Ko te reo mō te huaputa whakamāoritia. Ka tīpakotia mēnā ka waihotia. |
| preserve_voice | boolean | Kāore | Ka ngana ki te pupuri i te kaikōrero taketake |
Ka urupare
{
"original_text": "Hello, how are you?",
"translated_text": "Hola, como estas?",
"source_language": "en",
"target_language": "es",
"audio_url": "https://api.tts.ai/v1/results/translate_abc123.mp3",
"credits_used": 5
}
Whakawhitiwhiti ki te kōrero
Ka whakarerekē te kāhua kōrero, te āhuahira, te whakarato rānei i te wā e pupuri ana i ngā ihirangi. Ka whai painga mō te whakarerekētanga o te tono, te whakatere, me te whakamāramatanga.
Ka tono te tinana (multipart/form-data)
| Parameter | Kāhua | E hiahiatia ana | Whakamāramatanga |
|---|---|---|---|
| file | file | He | Ko te pūtake o te pūkete oro. Te nui rawa 50MB. |
| voice | string | He | Ko te tuakiri reo ūnga mō te kōrero huaputa |
| model | string | Kāore | Tauira: openvoice (matatū), chatterbox
|
| emotion | string | Kāore | Āhuatanga whāinga: |
| speed | float | Kāore | Ka whakaritea te tere. Papatono: 1.0. Rārangi: 0.5 ki 2.0 |
Ka urupare
Ka whakahokia te pūranga oro hei raraunga ā-rua.
Huakaʻi oro
Ko ngā wāhi mutunga o te tukanga oro mō te whakarei ake, te tango i te reo, te whakawehenga rākau, me ētahi atu.
Mā te whakarei ake i te āhuatanga oro: te whakarerekētanga, te whakarei ake i te mārama, te whakamāramatanga tino pai.
| file file | Ko te faila oro e whakarei ake ai |
| denoise boolean | Whakahaere i te whakakoretanga (whakahaere: pono) |
| enhance_clarity boolean | Whakarei ake i te mārama o te kōrero (whakarere: pono) |
| super_resolution boolean | Mā te whakapiki i te āhuatanga oro (whakahaere: hē) |
| strength integer | 1-3 (māmā, waenganui, kaha). Papatono: 2 |
Mā te wehe i ngā pūoro mai i ngā utauta pūoro (hoatu pūoro), ka wehe rānei ki ngā rākau.
| file file | Ko te pūkete oro e wehe ana |
| model string | demucs (Papatono) rānei spleeter |
| stems integer | Te tau o ngā rākau: 2, 4, 5, 6 rānei (whakahitu: 2) |
| format string | Hanganga huaputa: wav, mp3, flac |
Ka tangohia te whakairo me te whakairo mai i ngā pūkete oro.
| file file | Ko te faila oro e mahia ana |
| type string | echo or reverb (default: both) |
| intensity integer | 1-5 (default: 3) |
Ka tātari i te oro hei kite i te kī, te BPM, me te tohu wā.
| file file | Ko te pūkete oro hei tātari |
{
"key": "C",
"scale": "Major",
"bpm": 120.0,
"time_signature": "4/4",
"camelot": "8B",
"compatible_keys": ["C Major", "G Major", "F Major", "A Minor"]
}
Ka tahuri te oro i waenganui i ngā hanga.
| file file | Ko te faila oro e tahuri ana |
| format string | Hanganga ūnga: mp3, wav, flac, ogg, m4a, aac |
| bitrate integer | Ko te bitrate huaputa i roto i ngā kbps: 64, 128, 192, 256, 320 |
| sample_rate integer | Te mokatere tauira: 22050, 44100, 48000 |
| channels string | mono rānei stereo |
Pāpāho reo
Ka tukuna te oro, te kupu rānei me te whiwhi whakautu AI me te kōrero i whakakotahitia.
Ka tono te tinana (multipart/form-data rānei JSON)
| Parameter | Kāhua | E hiahiatia ana | Whakamāramatanga |
|---|---|---|---|
| audio | file | Kāore* | Ka hiahiatia te tāuru oro (oro, tuhi rānei) |
| text | string | Kāore* | Ka hiahiatia te tāuru kupu (audio, text rānei) |
| voice | string | Kāore | Whakapānga mō te urupare AI. Papatono: af_bella |
| tts_model | string | Kāore | Tauira TTS mō te urupare. Papatono: kokoro |
| system_prompt | string | Kāore | Ka tono te pūnaha kāwanatanga mō te AI |
| conversation_id | string | Kāore | Ka haere tonu tētahi kōrero tīariari |
Ka urupare
{
"conversation_id": "conv_abc123",
"user_text": "What is the capital of France?",
"ai_text": "The capital of France is Paris.",
"audio_url": "https://api.tts.ai/v1/audio/tmp/resp_xyz.mp3",
"credits_used": 3
}
Ko te rōpū TTS
Ka tukuna he maha ngā kupu mō te whakanaotanga TTS whakarara. Ka whiwhi anō i tētahi whakarerekētanga webhook ina oti ngā mahi katoa.
Parameter
| Parameter | Kāhua | Whakamāramatanga |
|---|---|---|
| texts | array | Array of objects: {text, model, voice}. Max 50 items. |
| webhook_url | string | URL kōwhiria ki ngā hua POST ina oti te rōpū. |
Ka urupare
{
"batch_id": "abc123",
"total": 3,
"completed": 0,
"status": "processing"
}
Ka haere tonu te pātai ki te GET /v1/tts/batch/result/?batch_id=abc123
Te whakatūnga reo
Ka tātaitai i mua i tētahi whakataki reo mai i te oro tohutoro. Ka whakamahia te embed_id i hoki mai i roto i ngā tono tārua reo o muri ake mō te whakatūnga tata tonu.
Parameter
| Parameter | Kāhua | Whakamāramatanga |
|---|---|---|
| file | file | Reference audio file (WAV, MP3, FLAC). |
| model | string | Cloning model (default: chatterbox). Supported: chatterbox, cosyvoice2, openvoice, gpt-sovits, spark, indextts2, qwen3-tts. |
Ka urupare
{
"embed_id": "emb_abc123",
"model": "chatterbox",
"duration_ms": 450
}
Ka whakamātautau te hauora
Ka tirotirohia te tūnga o te pūnaha GPU, ngā tauira i whakarewa, me te rahi o te kōaro. Kāore he manatoko e hiahiatia ana. Kua penapenatia mo te 30 sekona.
Ka urupare
{
"status": "online",
"latency_ms": 45,
"queue_size": 3,
"models_loaded": ["kokoro", "chatterbox", "cosyvoice2"]
}
Tautuhi ngā tauira
Ka hoki tētahi rārangi o ngā tauira katoa e wātea ana me ō rātou kaha.
Ka urupare
{
"models": [
{
"id": "kokoro",
"name": "Kokoro",
"type": "tts",
"tier": "standard",
"languages": ["en", "ja", "ko", "zh", "fr"],
"supports_cloning": false,
"supports_streaming": true,
"credits_per_1k_chars": 2
},
{
"id": "chatterbox",
"name": "Chatterbox",
"type": "tts",
"tier": "premium",
"languages": ["en"],
"supports_cloning": true,
"supports_streaming": true,
"credits_per_1k_chars": 4
}
]
}
Ko nga oro o te rārangi
Ka whakahokia tētahi rārangi o ngā reo katoa e wātea ana, e tātaritia ana e te tauira, e te reo rānei.
Pānga uiui
| Parameter | Kāhua | Whakamāramatanga |
|---|---|---|
| model | string | Tōrō e te tauira ID (hei tauira, kokoro) |
| language | string | Tōrō e te waehere reo (hei tauira, en) |
| gender | string | Tōrō e te ira tangata: tāne, whanaunga, kore
|
Ka urupare
{
"voices": [
{
"id": "af_bella",
"name": "Bella",
"model": "kokoro",
"language": "en",
"gender": "female",
"preview_url": "https://api.tts.ai/v1/voices/preview/af_bella.mp3"
}
],
"total": 142
}
Whakatuhi whakarongo (SRT / VTT) hou
Ka whakaputaina ngā whakarārangi whakahuahua mō ētahi mahi TTS kua oti. Ka haere te Whisper aligning i runga i te oro, ā, ka hoki mai te SRT, te WebVTT rānei. Ka penapenatia te hua ki runga i te pūrere kia taea ai e tētahi whakarongo tuarua mō te uuid ōrite te whakaako i te pūrere.
Pānga uiui
| Parameter | E hiahiatia ana | Whakamāramatanga |
|---|---|---|
| uuid | He | Ko te UUID mahi i hoki mai e /v1/tts/, /v1/voice-clone/ rānei. |
| format | Kāore | srt (whakahitu), vtt rānei. |
| download | Kāore | 1 ki te tukuna Content-Disposition: attachment kia tiakina e te mātākōrero i te wā ka whakaaturia. |
| language | Kāore | E tohu ana ki te tauira whakawhāititanga (ka kitea-māori mēnā ka waihotia). |
curl "https://api.tts.ai/v1/speech/subtitles/?uuid=$UUID&format=srt&download=1" -o subtitles.srt
Kaitiaki Whakahua hou
E kī ana ki te mīhini TTS me pēhea te whakahua i ngā kupu tauwhāiti. Ka hoatu ngā tāurunga i tiakina ki ia tono TTS e mahia ana e koe. Te tepe tāurunga 200-kōrero-kōrero.
Ka tono te tinana (POST)
| Parameter | Kāhua | Whakamāramatanga |
|---|---|---|
| word | string | Ka ōrite te rohe-wānanga-wānanga ki te kupu hei whakahōu (hei tauira, GIF, Anthropic). |
| replacement | string | He pēhea te tātai i te tauira (hei tauira |
| language | string | Ko te waehere ISO ā-pātahi. Ko te mokowā = e pā ana ki ngā reo katoa. |
| case_sensitive | boolean | whakahē te pūnoa. He ōrite te take ina pono. |
# Save an entry
curl -X POST https://tts.ai/api/v1/pronunciations/ \
-H "Authorization: Bearer sk-tts-..." \
-H "Content-Type: application/json" \
-d '{"word": "GIF", "replacement": "jiff"}'
# List your entries
curl https://tts.ai/api/v1/pronunciations/ -H "Authorization: Bearer sk-tts-..."
# Delete entry by id
curl -X DELETE "https://tts.ai/api/v1/pronunciations/?id=42" -H "Authorization: Bearer sk-tts-..."
You can also pass per-request overrides without saving them — include pronunciations on any /v1/tts/ call as either an object or an array (see the TTS endpoint params).
Ka kōrerorerotia te tuhipānui hou
Ka whakawātea tētahi tohu kotahi i runga i tētahi pou tuhipānui, ā, ka whiwhi ngā kaiwhaiwhai i tētahi pātū kaimātautau pūmau e kōrero ana i te pou i te kaitiaki. Ka kitea ā-pūmau te tinana o te tuhipānui, e tautoko ana i te reo / tauira / tūnga / tae whakahuahua.
<script src="https://tts.ai/narrator.js"
data-pk="pk-tts-your-publishable-key"
data-voice="af_bella"
data-model="kokoro"
data-extract="auto"
data-position="bottom"
data-color="#e60000"
data-locale="en"></script>
Ko ngā kōwhiringa
| Parameter | Whakamāramatanga |
|---|---|
data-pk | Ko te kī whakapuakina (pk-tts-...). Ko ngā whakawhāiti rohe i whakahaua mā te āpure allowed_domains o te kī. |
data-voice | Tau reo. af_bella tōmua. |
data-model | TTS tauira ID. kokoro tōmua. |
data-extract | auto (whakahiutu) — e ngana ana ki te tuhipoka/pūmatua/.post-content/.entry-content ngā kōwhiringa, ka hoki ki te rōpū waeine tino mārō. Ka haere rānei tētahi kōwhiringa CSS ki te ūnga i tētahi huānga tauwhāiti. |
data-position | bottom (whakahitu), top rānei. |
data-color | Ko te tae whakahua (he tae CSS). #e60000 tōmua. |
data-min-chars / data-max-chars | Ka whakateretia te pae mēnā he poto ake te tuhipānui i ngā pūāhua iti (whakahitu 200). Ka whakatū i te tāuru ki ngā pūāhua nui rawa (whakahitu 50,000). |
Te widget o te cānau Whakahauhau
I roto i te āhua o te kōkuhu-ki-te-rārangi. Ka whakarārangi i te taha o tōna tohu , ā, ka whakapāpāho i tētahi tātari poto i whakaohohia e te kōkuhu. He āhua rerekē mai i te Kaipāhua Whakaputanga Waihoki i runga ake nei (e whakatū ana i tētahi pae pātaka-pātaka, ā, ka kōrerotia te tuhipānui katoa).
<script src="https://tts.ai/widget.js"
data-voice="af_bella"
data-model="kokoro"
data-style="full"
data-theme="light"></script>
Whakatakia ngā oro (Ko ngā tārua tūturu)
Ka whakarewa tētahi oro tohutoro kotahi, ka whiwhi anō i tētahi aho_id pūmau, kātahi ka tohutoro ki taua tuakiri i roto i ngā tono TTS i te wā o te whakarewa anō i te oro i ia whakarongo. He pai ki ngā whakakotahitanga nui.
Whakapupuri i tētahi reo
POST
https://tts.ai/api/v1/user-voices/
E hiahiatia ana te mana whakaū
He maha ngā āpure: ngā tāpare (e hiahiatia ana, 5-30s oroiti), ingoa (e hiahiatia ana), reo (whakahaere, pūnoa en), tauira (whakahaere — e kōwhiri ana i te pūoro2 mō zh/ja/ko mēnā kāore), consent_confirmed (e hiahiatia ana, he uara pono).
curl -X POST https://tts.ai/api/v1/user-voices/ \
-H "Authorization: Bearer sk-tts-your-key" \
-F "file=@reference.wav" \
-F "name=My Narrator" \
-F "language=en" \
-F "consent_confirmed=true"
# Response:
{
"public_id": "uv_a1b2c3d4e5f6",
"id": 42,
"name": "My Narrator",
"model_name": "openvoice",
"language": "en",
"reference_audio_url": "https://tts.ai/media/user-voices/....wav",
"storage_status": "active",
"created_at": "2026-04-17T03:45:00+00:00"
}
Ka whakamahia te reo i tiakina i roto i te TTS
POST ki te /api/v1/tts/ (Tirohia: VPS whare rārangi, ehara i te api.tts.ai) me te user_voice_id. Ka whakataka mai tātau i tō tātau oro me te ara ki te pūtau whakairo.
curl -X POST https://tts.ai/api/v1/tts/ \
-H "Authorization: Bearer sk-tts-your-key" \
-H "Content-Type: application/json" \
-d '{"text":"Hello from my saved voice","user_voice_id":"uv_a1b2c3d4e5f6"}'
# Returns a queued job — poll /v1/speech/results/?uuid=... for the audio URL.
Tatauranga / Whakahōutia
GET https://tts.ai/api/v1/user-voices/ # list your saved voices + quota info
DELETE https://tts.ai/api/v1/user-voices/?public_id=uv_a1b2c3d4e5f6
Ko te pūranga / whakahohe (whāiti)
Ka noho ngā oro i roto i tōmu kāwanatanga engari kāore e taea te whakamahi i roto i te TTS. He whai hua mō ngā kaimahi mutunga kore, nā reira ka noho mārama tōmu rārangi.
POST https://tts.ai/api/v1/user-voices/uv_a1b2c3d4e5f6/archive/
POST https://tts.ai/api/v1/user-voices/uv_a1b2c3d4e5f6/reactivate/
Ko ngā tauira waehere
Waihoki ki te kōrero
import requests
API_KEY = "sk-tts-your-key"
# Text to Speech
response = requests.post(
"https://api.tts.ai/v1/tts/",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "kokoro",
"text": "Hello from TTS.ai!",
"voice": "af_bella",
"format": "mp3"
}
)
with open("output.mp3", "wb") as f:
f.write(response.content)
print(f"Credits used: {response.headers.get('X-Credits-Used')}")
Ka kōrerorerotia te kuputuhi
# Speech to Text
with open("recording.mp3", "rb") as f:
response = requests.post(
"https://api.tts.ai/v1/stt/",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"file": f},
data={"model": "faster-whisper", "timestamps": "true"}
)
result = response.json()
print(result["text"])
Ko te tāruatanga reo
# Voice Cloning
with open("reference.wav", "rb") as ref:
response = requests.post(
"https://api.tts.ai/v1/tts/clone/",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"reference_audio": ref},
data={
"text": "This speech uses a cloned voice.",
"model": "chatterbox"
}
)
with open("cloned_output.mp3", "wb") as f:
f.write(response.content)
Waihoki ki te kōrero
const API_KEY = 'sk-tts-your-key';
// Text to Speech
const response = await fetch('https://api.tts.ai/v1/tts/', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'kokoro',
text: 'Hello from TTS.ai!',
voice: 'af_bella',
format: 'mp3'
})
});
const audioBlob = await response.blob();
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();
Ka kōrerorerotia te kuputuhi
// Speech to Text
const formData = new FormData();
formData.append('file', audioFile);
formData.append('model', 'faster-whisper');
const response = await fetch('https://api.tts.ai/v1/stt/', {
method: 'POST',
headers: { 'Authorization': `Bearer ${API_KEY}` },
body: formData
});
const result = await response.json();
console.log(result.text);
Waihoki ki te kōrero
# Text to Speech
curl -X POST https://api.tts.ai/v1/tts/ \
-H "Authorization: Bearer sk-tts-your-key" \
-H "Content-Type: application/json" \
-d '{"model":"kokoro","text":"Hello!","voice":"af_bella","format":"mp3"}' \
-o output.mp3
Ka kōrerorerotia te kuputuhi
# Speech to Text
curl -X POST https://api.tts.ai/v1/stt/ \
-H "Authorization: Bearer sk-tts-your-key" \
-F "file=@recording.mp3" \
-F "model=faster-whisper" \
-F "timestamps=true"
Ko te tāruatanga reo
# Voice Cloning
curl -X POST https://api.tts.ai/v1/tts/clone/ \
-H "Authorization: Bearer sk-tts-your-key" \
-F "reference_audio=@reference.wav" \
-F "text=This uses a cloned voice." \
-F "model=chatterbox" \
-o cloned.mp3
Whakarei ake reo
# Audio Enhancement
curl -X POST https://api.tts.ai/v1/audio/enhance/ \
-H "Authorization: Bearer sk-tts-your-key" \
-F "file=@noisy_audio.mp3" \
-F "denoise=true" \
-F "enhance_clarity=true" \
-o enhanced.mp3
Ko ngā waehere hapa
Ka hoki ngā hapa katoa ki tētahi urupare JSON me tētahi error te āpure.
{
"error": {
"code": "insufficient_credits",
"message": "You do not have enough characters for this request.",
"characters_required": 4000,
"characters_available": 2000
}
}
| Kāwanatanga HTTP | Ko te waehere hapa | Whakamāramatanga |
|---|---|---|
| 400 | bad_request |
Parametera tono tē tika. Tirohia te karere hapa mō ngā taipitopito. |
| 401 | unauthorized |
Kua ngaro, kāore rānei i tika te kī API. |
| 402 | insufficient_credits |
Kāore i tino nui ngā pūtea. Kei te hoko anō i te /price/. |
| 403 | forbidden |
Kāore i te whakaaetanga ki te uru ki tēnei rauemi (hei tauira, te poho i te mahi o tētahi atu kaiwhakaari). Kei roto hoki te uru ki te API i ia mahere. |
| 404 | not_found |
Kāore i kitea te tauira, te reo rānei. |
| 413 | file_too_large |
Kua hipa te rārangi rahinga o te faila whakarewa. |
| 429 | rate_limited |
He maha rawa ngā tono. Tirohia ngā pūmatua tepe. |
| 500 | internal_error |
He hapa server. Ka ngana anō ā muri ake nei. |
| 503 | model_loading |
E kawe ana te tauira. Ka whakamātau anō i roto i ētahi waeine. |
Webhooks
Mō ngā taumahi roa (whakahaeretanga pūtake, TTS rōpū), ka taea e koe te hoatu tētahi tohuāhua webhook_url. Ina oti te taumahi, ka POST tātau i te hua ki tōtou URL.
{
"event": "task.completed",
"task_id": "task_abc123",
"status": "success",
"result_url": "https://api.tts.ai/v1/results/task_abc123",
"credits_used": 12,
"created_at": "2025-01-15T10:30:00Z",
"completed_at": "2025-01-15T10:30:45Z"
}
E whakaritea ana?
Ki te whiwhi i tōkou kī API me te tīmata ki te whakauru i te TTS.ai ki roto i ōna taupānga.