Gemini TTS 2.5 Pro Serverless API
Gemini 2.5 TTS delivers human-like speech synthesis with expressive emotional delivery across multiple languages.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/gemini-2.5-pro-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Narrate softly: I hope you find peace and joy.",
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-2.5-pro-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Narrate softly: I hope you find peace and joy.",
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-2.5-pro-ttsParameters
textrequiredstringInput text for voice synthesis. Use styles like: 'soft, calm' or 'excited narration'.
"Narrate softly: I hope you find peace and joy."temperatureoptionalnumberAdjusts speech variance. Use 0.2 for stable narration or 0.7 for dynamic expression.
0.4Range: 0 - 2voice_1optionalstringSelect a unique voice for Speaker 1. Ideal for character roles or distinct narrator styles.
"Kore""Zephyr""Puck""Charon""Kore""Fenrir""Leda""Orus""Aoede""Callirrhoe""Autonoe"+20 morevoice_2optionalstringChoose a second speaker voice for dialogues. Use contrasting voices for role distinction.
null"Zephyr""Puck""Charon""Kore""Fenrir""Leda""Orus""Aoede""Callirrhoe""Autonoe"+20 moreResponse 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