Learn how to instantly generate lifelike audio from text.
The Groq API speech endpoint provides fast text-to-speech (TTS), enabling you to convert text to spoken audio in seconds with our available TTS models.
With support for 23 voices, 19 in English and 4 in Arabic, you can instantly create life-like audio content for customer support agents, characters for game development, and more.
Endpoint | Usage | API Endpoint |
---|---|---|
Speech | Convert text to audio | https://api.groq.com/openai/v1/audio/speech |
Model ID | Model Card | Supported Language(s) | Description |
---|---|---|---|
playai-tts | Card | English | High-quality TTS model for English speech generation. |
playai-tts-arabic | Card | Arabic | High-quality TTS model for Arabic speech generation. |
The speech endpoint takes four key inputs:
playai-tts
or playai-tts-arabic
"wav"
The Groq SDK package can be installed using the following command:
pip install groq
The following is an example of a request using playai-tts
. To use the Arabic model, use the playai-tts-arabic
model ID and an Arabic prompt:
1import os
2from groq import Groq
3
4client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
5
6speech_file_path = "speech.wav"
7model = "playai-tts"
8voice = "Fritz-PlayAI"
9text = "I love building and shipping new features for our users!"
10response_format = "wav"
11
12response = client.audio.speech.create(
13 model=model,
14 voice=voice,
15 input=text,
16 response_format=response_format
17)
18
19response.write_to_file(speech_file_path)
Parameter | Type | Required | Value | Description |
---|---|---|---|---|
model | string | Yes | playai-tts playai-tts-arabic | Model ID to use for TTS. |
input | string | Yes | - | User input text to be converted to speech. Maximum length is 10K characters. |
voice | string | Yes | See available English and Arabic voices. | The voice to use for audio generation. There are currently 26 English options for playai-tts and 4 Arabic options for playai-tts-arabic . |
response_format | string | Optional | "wav" | Format of the response audio file. Defaults to currently supported "wav" . |
The playai-tts
model currently supports 19 English voices that you can pass into the voice
parameter (Arista-PlayAI
, Atlas-PlayAI
, Basil-PlayAI
, Briggs-PlayAI
, Calum-PlayAI
,
Celeste-PlayAI
, Cheyenne-PlayAI
, Chip-PlayAI
, Cillian-PlayAI
, Deedee-PlayAI
, Fritz-PlayAI
, Gail-PlayAI
,
Indigo-PlayAI
, Mamaw-PlayAI
, Mason-PlayAI
, Mikail-PlayAI
, Mitch-PlayAI
, Quinn-PlayAI
, Thunder-PlayAI
).
Experiment to find the voice you need for your application:
The playai-tts-arabic
model currently supports 4 Arabic voices that you can pass into the voice
parameter (Ahmad-PlayAI
, Amira-PlayAI
, Khalid-PlayAI
, Nasser-PlayAI
).
Experiment to find the voice you need for your application: