Chatterbox TTS Serverless API
Chatterbox transforms text into rich, natural speech with adjustable emotional expressiveness for diverse applications.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/chatterbox-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Welcome to Chatterbox TTS, where your text turns into captivating audio effortlessly.",
12 "reference_audio": "https://segmind-resources.s3.amazonaws.com/input/ef2a2b5c-3e3a-4051-a437-20a72bf175de-sample_audio.mp3",
13 "exaggeration": 0.5,
14 "temperature": 0.8,
15 "seed": 42,
16 "cfg_weight": 0.5,
17 "min_p": 0.05,
18 "top_p": 1,
19 "repetition_penalty": 1.2
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/chatterbox-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Welcome to Chatterbox TTS, where your text turns into captivating audio effortlessly.",
12 "reference_audio": "https://segmind-resources.s3.amazonaws.com/input/ef2a2b5c-3e3a-4051-a437-20a72bf175de-sample_audio.mp3",
13 "exaggeration": 0.5,
14 "temperature": 0.8,
15 "seed": 42,
16 "cfg_weight": 0.5,
17 "min_p": 0.05,
18 "top_p": 1,
19 "repetition_penalty": 1.2
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)API Endpoint
https://api.segmind.com/v1/chatterbox-ttsParameters
textrequiredstringThe input text is synthesized into speech. Use longer text for detailed narration, shorter for concise messages.
"Welcome to Chatterbox TTS, where your text turns into captivating audio effortlessly."cfg_weightoptionalnumberBalances creativity and adherence to text. Use lower for strict interpretation, higher for flexibility.
0.5Range: 0 - 2exaggerationoptionalnumberAdjusts speech expressiveness. Use lower values for neutrality, higher for dramatic effect.
0.5Range: 0 - 2min_poptionalnumberEnsures minimum probability for content inclusion. Useful for removing unlikely phrases.
0.05Range: 0 - 1reference_audiooptionalstring (uri)Provides a sample audio for voice style matching
"https://segmind-resources.s3.amazonaws.com/input/ef2a2b5c-3e3a-4051-a437-20a72bf175de-sample_audio.mp3"repetition_penaltyoptionalnumberPenalizes repeated words in speech. Higher values reduce redundancy.
1.2Range: 1 - 2seedoptionalintegerEnsures consistent output with the same input. Adjust for diverse generations.
42temperatureoptionalnumberControls speech variation. Use lower for consistent tone, higher for diverse expressions.
0.8Range: 0 - 2top_poptionalnumberDetermines output randomness. Lower for focused content, higher for creative diversity.
1Range: 0 - 1Response Type
Returns: Audio
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out