Gemini TTS Series
Brief: Convert text to speech using Gemini TTS models.
Overview
- Method:
POST - Path:
/v1/audio/speech - Content-Type:
application/json
Authentication
- Header:
Authorization: Bearer <token> - Supports bearer token authentication
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name, choose gemini-2.5-flash-preview-tts or gemini-2.5-pro-preview-tts |
| input | string | Yes | Text to convert to speech, up to 10000 characters |
| voice | string | Yes | Voice style, see official docs for available voices such as achernar, leda, zubenelgenubi |
| response_format | string | No | Audio format, default wav. Supported values: mp3, opus, aac, flac, wav, pcm |
| temperature | number | No | Temperature control, range 0 to 2. Lower values produce more consistent speech |
Tip:
wavorpcmis usually the most efficient format.
curl Example
bash
curl -X POST "https://api.gpt.ge/v1/audio/speech" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{
"model": "gemini-2.5-flash-preview-tts",
"input": "Hello, I am the v-api TTS assistant. Welcome to our API service!",
"voice": "leda",
"response_format": "mp3",
"temperature": 1.0
}'JavaScript (fetch) Example
javascript
fetch('https://api.gpt.ge/v1/audio/speech', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-xxxx'
},
body: JSON.stringify({
model: 'gemini-2.5-flash-preview-tts',
input: 'Hello, I am the v-api TTS assistant. Welcome to our API service!',
voice: 'leda',
response_format: 'mp3',
temperature: 1.0
})
}).then(r => r.blob()).then(console.log);Python (requests) Example
python
import requests
response = requests.post(
'https://api.gpt.ge/v1/audio/speech',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-xxxx'
},
json={
'model': 'gemini-2.5-flash-preview-tts',
'input': 'Hello, I am the v-api TTS assistant. Welcome to our API service!',
'voice': 'leda',
'response_format': 'mp3',
'temperature': 1.0
}
)
print(response.status_code)
print(response.content[:20])Response Example (200)
text
<binary audio data returned directly, such as WAV or MP3 file content>Note: The response typically returns the audio content directly in the selected
response_format, and may include usage metadata in response headers such asX-Usage.