Gemini TTS 2.5 Pro Serverless API

Gemini 2.5 TTS delivers human-like speech synthesis with expressive emotional delivery across multiple languages.

~26.59s
~$0.018
 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

POSThttps://api.segmind.com/v1/gemini-2.5-pro-tts

Parameters

textrequired
string

Input text for voice synthesis. Use styles like: 'soft, calm' or 'excited narration'.

Default: "Narrate softly: I hope you find peace and joy."
temperatureoptional
number

Adjusts speech variance. Use 0.2 for stable narration or 0.7 for dynamic expression.

Default: 0.4Range: 0 - 2
voice_1optional
string

Select a unique voice for Speaker 1. Ideal for character roles or distinct narrator styles.

Default: "Kore"
Allowed values (30 total):
"Zephyr""Puck""Charon""Kore""Fenrir""Leda""Orus""Aoede""Callirrhoe""Autonoe"+20 more
voice_2optional
string

Choose a second speaker voice for dialogues. Use contrasting voices for role distinction.

Default: null
Allowed values (30 total):
"Zephyr""Puck""Charon""Kore""Fenrir""Leda""Orus""Aoede""Callirrhoe""Autonoe"+20 more

Response Type

Returns: Audio

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out