xAI : Grok Text to Speech
xAI's Grok text-to-speech: converts text into spoken audio with 26 expressive voices, inline speech tags and output formats from high-fidelity MP3 to telephony-optimized mu-law, selected by endpoint (/v1/tts) rather than by a model parameter.
Fournisseurs
Plusieurs fournisseurs peuvent héberger le même modèle. Choisissez-en un lorsque vous avez besoin d’un backend fixe, ou laissez le routage choisir parmi eux.
Langues prises en charge
en
Voix
Fonctionnalités
Generates spoken audio from text input.
text_to_speech
Bidirectional streaming TTS over WebSocket (wss://api.x.ai/v1/tts).
streaming
Synthesizes speech from fully-submitted text in a single synchronous request.
synchronous
Supports 20 languages (BCP-47) plus automatic detection.
multilingual
Supports inline speech tags for expressive control.
speech_tags
Code
TTS en streaming avec l’ElevenLabs SDK
Fait passer l’ElevenLabs SDK par AllModels et diffuse la réponse audio en streaming.
import { ElevenLabsClient } from "elevenlabs";
const client = new ElevenLabsClient({
apiKey: process.env.ALLMODELS_API_KEY,
baseUrl: "https://api.allmodels.io/el"
});
const stream = await client.textToSpeech.stream("voice_id", {
text: "I'm sorry, Dave. I'm afraid I can't do that.",
modelId: "xai/grok-tts",
outputFormat: "mp3_44100_128"
}, {
queryParams: {
provider: {
"only": [
"grok"
]
}
}
});
const reader = stream.getReader();
for (;;) {
const { done, value } = await reader.read();
if (done) break;
// Write value to your response, file, or audio playback pipeline.
}
