Generate Gemini Speech
POST/gemini-tts/generate
Generate single-speaker speech using Gemini TTS with automatic fallback to OpenAI. Fallback occurs silently when: - User doesn't have Gemini access (FREE tier) - Daily limit exceeded (100/day for PRO/TRIAL) - Per-minute limit exceeded (10/min) - Gemini API errors Args: request: Gemini TTS generation request current_user: Authenticated user service: Gemini TTS service instance (for voice profiles) history_service: TTS history service Returns: Generated audio as streaming response
Authentication
Authorization: Bearer vm_sk_… with the media.write permission (or all.write). See Authentication.
Request body
application/json
| Field | Type | Description |
|---|---|---|
save_to_history | boolean | Save generated audio to history |
style_prompt | string | Natural language style instructions |
text* | string | Text to convert to speech |
voice | string | Voice profile name |
Response
200 application/json
any
Errors
401 | Missing, wrong, revoked or expired key. |
403 | The key lacks media.write, the route is not available to keys, or the key's IP allow-list refuses this client. |
402 | Not enough credits, or the key reached its spending cap. |
422 | The request failed validation; `detail` lists the fields. |
429 | Over a rate limit; retry after `Retry-After` seconds. |
All statuses: Errors.
Example
curl -X POST "https://api.voicemint.io/api/v1/gemini-tts/generate" \
-H "Authorization: Bearer $VOICEMINT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"save_to_history": false,
"style_prompt": "string",
"text": "string",
"voice": "kore"
}'