Veena TTS Serverless API
Veena transforms text into high-fidelity, expressive speech in Hindi and English for real-time applications.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/veena-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Kya tumne kabhi socha hai... ki hum sab sirf waqt ke musafir hain?",
12 "speaker": "kavya",
13 "temperature": 0.4,
14 "top_p": 0.9,
15 "repetition_penalty": 1.05
16}
17
18response = requests.post(url, headers=headers, json=data)
19
20if response.status_code == 200:
21 result = response.json()
22 print(json.dumps(result, indent=2))
23else:
24 print(f"Error: {response.status_code}")
25 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/veena-tts"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "text": "Kya tumne kabhi socha hai... ki hum sab sirf waqt ke musafir hain?",
12 "speaker": "kavya",
13 "temperature": 0.4,
14 "top_p": 0.9,
15 "repetition_penalty": 1.05
16}
17
18response = requests.post(url, headers=headers, json=data)
19
20if response.status_code == 200:
21 result = response.json()
22 print(json.dumps(result, indent=2))
23else:
24 print(f"Error: {response.status_code}")
25 print(response.text)API Endpoint
https://api.segmind.com/v1/veena-ttsParameters
textrequiredstringProvide input text for speech synthesis. Use simple phrases for clarity, complex for detailed expressions.
"Kya tumne kabhi socha hai... ki hum sab sirf waqt ke musafir hain?"repetition_penaltyoptionalnumberMinimize word repetition. Use 1.2 for minimal repeats.
1.05Range: 1 - 2speakeroptionalstringChoose speaker for voice style. Kavya for warmth, Agastya for depth.
"kavya""kavya""agastya""maitri""vinaya"temperatureoptionalnumberSet speech variation. Use 0.2 for monotone, 0.7 for lively expression.
0.4Range: 0 - 2top_poptionalnumberControl output randomness. Set 0.5 for focused, 0.95 for diverse speech.
0.9Range: 0 - 1Response 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