Référence API de Grok TTS
71 voix dans 20 langues, avec balises d’expression
Une seule clé API PopNow suffit pour appeler Grok TTS depuis votre code. Vous trouverez ici les identifiants de modèle à envoyer, chaque champ d’entrée accepté, le coût d’une requête en crédits et une requête à coller telle quelle dans un terminal.
Les descriptions des paramètres proviennent du schéma d’entrée du modèle et ne sont disponibles qu’en anglais.
En bref
- Éditeur
- xAI
- Résultat
- Audio
- À partir de
- 2.7 crédits pour 1 000 caractères ($0.027)
- Identifiants de modèle
1 crédit = 0,01 $. À l’acceptation, une tâche réserve le montant maximal possible, puis facture la consommation réelle à la fin, arrondie au crédit supérieur ; le reste est libéré. Une tâche en échec n’est pas facturée. Pour connaître le montant exact avant de lancer, appelez POST /api/v1/jobs/quote.
Synthèse vocale
xai/grok-tts/text-to-speech
Prix
| Option | Crédits (pour 1 000 caractères) | Dollars US |
|---|---|---|
Par défaut | 2.7 | $0.027 |
Paramètres
| Champ | Type | Valeur par défaut | Valeurs admises | Rôle |
|---|---|---|---|---|
textObligatoire | string | — | jusqu’à 15 000 caractères | The words to be spoken, with optional speech tags such as [laugh] or <whisper>…</whisper>. Billed per 1,000 characters, tags included. |
voice_idFacultatif | string | eve | ara, eve, leo, rex, sal, jpi39icg, d18jlf6v, 33g9t0jl, 26w6ihxi, dr8gqysu, wy0m9l5w, om17cury, x7avnu1k, bcs7l2c3, … (+57) | Preset voice. Eve, Ara, Leo, Rex and Sal speak every supported language; the others are tuned for one language. |
languageFacultatif | string | auto | auto, en, zh, ar-EG, ar-SA, ar-AE, bn, fr, de, hi, id, it, ja, ko, … (+7) | Reading language, or auto to detect it from the text. |
speedFacultatif | number | 1 | de 0.7 à 1.5 | Speaking speed from 0.7 (slower) to 1.5 (faster). |
output_formatFacultatif | string | mp3 | mp3, wav, pcm, mulaw, alaw | Audio encoding. pcm, mulaw and alaw are raw streams without a file header, for phone systems. |
sample_rateFacultatif | integer | 24000 | 8000, 16000, 22050, 24000, 44100, 48000 | Sample rate in Hz. 8000 for phone lines, 44100 or 48000 for studio work. |
bitrateFacultatif | integer | 128000 | 32000, 64000, 96000, 128000, 192000 | MP3 bit rate in bits per second. Only applies to mp3. |
text_normalizationFacultatif | boolean | false | — | Rewrite numbers, abbreviations and symbols as spoken words before reading. |
optimize_streaming_latencyFacultatif | integer | 0 | 0, 1, 2 | Streaming latency level: 0 best quality, 1 smaller first chunk, 2 smallest first chunk with more quality trade-off at chunk boundaries. |
Exemple de requête
Cette requête fonctionne telle quelle ; les champs omis gardent leur valeur par défaut. Placez d’abord votre clé dans POPNOW_API_KEY.
curl -X POST "https://api.popnow.ai/api/v1/jobs/createTask" \
-H "Authorization: Bearer $POPNOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "xai/grok-tts/text-to-speech",
"input": {
"text": "Hi there! This voice was created with the PopNow API in just a few seconds."
}
}'La réponse contient tout de suite un taskId. Récupérez le résultat avec GET /api/v1/jobs/recordInfo, ou ajoutez callBackUrl pour être prévenu.
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=TASK_ID_FROM_CREATE_TASK" \
-H "Authorization: Bearer $POPNOW_API_KEY"
