Gemini 3.1 Flash TTS Serverless API
Expressive, controllable TTS with 70+ language support.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/gemini-3.1-flash-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Welcome to Segmind — the fastest API platform for AI image and video generation. Explore hundreds of models, build powerful workflows, and ship your ideas in minutes.",
12 "voice_1": "Kore",
13 "temperature": 0.4
14}
15
16response = requests.post(url, headers=headers, json=data)
17
18if response.status_code == 200:
19 result = response.json()
20 print(json.dumps(result, indent=2))
21else:
22 print(f"Error: {response.status_code}")
23 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/gemini-3.1-flash-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Welcome to Segmind — the fastest API platform for AI image and video generation. Explore hundreds of models, build powerful workflows, and ship your ideas in minutes.",
12 "voice_1": "Kore",
13 "temperature": 0.4
14}
15
16response = requests.post(url, headers=headers, json=data)
17
18if response.status_code == 200:
19 result = response.json()
20 print(json.dumps(result, indent=2))
21else:
22 print(f"Error: {response.status_code}")
23 print(response.text)API Endpoint
https://api.segmind.com/v1/gemini-3.1-flash-ttsParameters
textrequiredstringInput text to convert to speech. Supports audio tags for style control. Use natural language prompts for expressive results.
"Welcome to Segmind — the fastest API platform for AI image and video generation. Explore hundreds of models, build powerful workflows, and ship your ideas in minutes."temperatureoptionalnumberExpressiveness level (0.0–2.0). Use 0.2–0.5 for professional narration; 0.8–1.4 for emotional delivery.
0.4Range: 0 - 2voice_1optionalstringPrimary speaker voice name. Options: Kore, Puck, Charon, Aoede, Fenrir, Zephyr. Kore is neutral and professional.
"Kore"voice_2optionalstringSecond speaker voice for multi-character dialogue. Leave empty for single-speaker. Max 2 speakers supported.
Response 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