POST Synthèse vocale
Transforme un texte en voix naturelle. Choisis parmi les voix bambara publiées, ou une voix internationale. Réponse : un fichier audio WAV.
POST/v1/audio/speech
Corps JSON. Autorisation requise : tts.
Transforme un texte en voix naturelle. Choisis parmi les voix bambara publiées, ou une voix internationale. Réponse : un fichier audio WAV.
Corps JSON. Autorisation requise : tts.
| Nom | Type | Description |
|---|---|---|
inputrequis | string | Le texte à lire (5 000 caractères max). |
voiceoption | string | Identifiant de voix (voir Voix). Défaut modibo. |
tgtoption | string | Langue du texte/de la voix (voir Langues). Défaut bam_Latn. |
srcoption | string | Traduire le texte avant lecture : langue source, ou auto. Défaut same (pas de traduction). |
speedoption | number | Débit de parole, de 0.5 à 2.0. Absent = 1.0 (même rendu que le Studio). |
response_formatoption | string | Format audio de sortie. wav (défaut, sans perte — recommandé, identique au Studio) ou mp3 (128 kbps mono). |
Le corps est le fichier audio brut (Content-Type: audio/wav), pas du JSON. Écris-le directement sur disque.
Facturé au caractère. Les voix personnalisées (clonées) sont facturées à un tarif supérieur.
curl https://api.kooma.ai/v1/audio/speech \
-H "Authorization: Bearer sk-intermo-VOTRE_CLE" \
-H "Content-Type: application/json" \
-d '{
"input": "I ni ce, i ka kɛnɛ wa?",
"voice": "aminata",
"tgt": "bam_Latn",
"speed": 1.0
}' \
--output sortie.wav
import requests
r = requests.post(
"https://api.kooma.ai/v1/audio/speech",
headers={"Authorization": "Bearer sk-intermo-VOTRE_CLE"},
json={
"input": "I ni ce, i ka kɛnɛ wa?",
"voice": "aminata",
"tgt": "bam_Latn",
},
)
open("sortie.wav", "wb").write(r.content)
const r = await fetch("https://api.kooma.ai/v1/audio/speech", {
method: "POST",
headers: {
"Authorization": "Bearer sk-intermo-VOTRE_CLE",
"Content-Type": "application/json",
},
body: JSON.stringify({
input: "I ni ce, i ka kɛnɛ wa?",
voice: "aminata",
tgt: "bam_Latn",
}),
});
const wav = await r.arrayBuffer();
RIFF....WAVEfmt ............ # fichier audio
{
"error": {
"message": "Insufficient prepaid credits for 'tts'.",
"type": "insufficient_credits",
"code": "insufficient_credits"
}
}