Voice Selector
This endpoint group provides methods for interacting with Text-to-Speech (TTS) voice selection, including retrieving available voices, generating audio samples, and estimating speech duration.
Endpoints
POST /api/rpc (Method: VoiceSelectorRpc.getVoices)
Description: Gets a list of all available TTS voices from all configured models.
Request Body:
{ "method": "VoiceSelectorRpc.getVoices", "params": {} }Parameters:
Name Type Required Description paramsObjectYes An empty object. Response:
{ "success": true, "data": [ { "value": "voiceId::modelId", "label": "Voice Name (Model Name)", "id": "voiceId", "name": "Voice Name", "gender": "male/female", "description": "A brief description of the voice.", "provider": "ProviderName" } ] }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "VoiceSelectorRpc.getVoices", "params": {} }'
POST /api/rpc (Method: VoiceSelectorRpc.getVoiceSample)
Description: Generates or retrieves a sample audio file for a given voice.
Request Body:
{ "method": "VoiceSelectorRpc.getVoiceSample", "params": { "voiceId": "alloy-tts-1-hd" } }Parameters:
Name Type Required Description voiceIdStringYes The composite voice ID (e.g., 'alloy-tts-1-hd'). Response:
{ "success": true, "data": { "relativePath": "global/voice-samples/alloy-tts-1-hd.mp3" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "VoiceSelectorRpc.getVoiceSample", "params": { "voiceId": "alloy-tts-1-hd" } }'
POST /api/rpc (Method: VoiceSelectorRpc.estimateSpeechDuration)
Description: Estimates the speaking duration for a given text.
Request Body:
{ "method": "VoiceSelectorRpc.estimateSpeechDuration", "params": { "text": "Hello, how are you today?", "voiceId": "alloy-tts-1-hd" } }Parameters:
Name Type Required Description textStringYes The text for which to estimate speech duration. Minimum length is 1 character. voiceIdStringNo The composite voice ID (e.g., 'alloy-tts-1-hd'). This might affect timing in the future. Response:
{ "success": true, "data": { "durationSeconds": 2.54, "metadata": { "charCount": 25, "baseDuration": 2.08, "punctuationPause": 0.46, "modelId": "tts-1-hd", "calibrationUsed": "tts-1-hd" } } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "VoiceSelectorRpc.estimateSpeechDuration", "params": { "text": "Hello, how are you today?", "voiceId": "alloy-tts-1-hd" } }'