Riferimento API di Grok TTS
71 voci in 20 lingue, con tag vocali
Con una sola chiave API di PopNow chiami Grok TTS dal tuo codice. Qui trovi gli ID del modello da inviare, ogni campo di input accettato, quanti crediti costa ogni richiesta e una richiesta da incollare nel terminale così com’è.
Le descrizioni dei parametri provengono dallo schema di input del modello e sono disponibili solo in inglese.
In sintesi
- Sviluppato da
- xAI
- Risultato
- Audio
- Da
- 2.7 crediti ogni 1.000 caratteri ($0.027)
- ID del modello
1 credito = 0,01 $. All’accettazione l’attività trattiene l’importo massimo possibile e alla fine addebita il consumo reale, arrotondato al credito superiore; il resto viene sbloccato. Le attività non riuscite non vengono addebitate. Per conoscere la cifra esatta prima di eseguire, chiama POST /api/v1/jobs/quote.
Sintesi vocale
xai/grok-tts/text-to-speech
Prezzo
| Opzione | Crediti (ogni 1.000 caratteri) | Dollari USA |
|---|---|---|
Predefinito | 2.7 | $0.027 |
Parametri
| Campo | Tipo | Predefinito | Valori ammessi | A cosa serve |
|---|---|---|---|---|
textObbligatorio | string | — | fino a 15.000 caratteri | The words to be spoken, with optional speech tags such as [laugh] or <whisper>…</whisper>. Billed per 1,000 characters, tags included. |
voice_idFacoltativo | 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. |
languageFacoltativo | 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. |
speedFacoltativo | number | 1 | da 0.7 a 1.5 | Speaking speed from 0.7 (slower) to 1.5 (faster). |
output_formatFacoltativo | string | mp3 | mp3, wav, pcm, mulaw, alaw | Audio encoding. pcm, mulaw and alaw are raw streams without a file header, for phone systems. |
sample_rateFacoltativo | integer | 24000 | 8000, 16000, 22050, 24000, 44100, 48000 | Sample rate in Hz. 8000 for phone lines, 44100 or 48000 for studio work. |
bitrateFacoltativo | integer | 128000 | 32000, 64000, 96000, 128000, 192000 | MP3 bit rate in bits per second. Only applies to mp3. |
text_normalizationFacoltativo | boolean | false | — | Rewrite numbers, abbreviations and symbols as spoken words before reading. |
optimize_streaming_latencyFacoltativo | 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. |
Richiesta di esempio
Questa richiesta funziona così com’è; i campi omessi usano il valore predefinito. Prima salva la tua chiave in 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 risposta contiene subito un taskId. Recupera il risultato con GET /api/v1/jobs/recordInfo, oppure aggiungi callBackUrl per ricevere una notifica.
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=TASK_ID_FROM_CREATE_TASK" \
-H "Authorization: Bearer $POPNOW_API_KEY"
