-
-
Notifications
You must be signed in to change notification settings - Fork 134
API ‐ Server & TTS Engine Status API
This set of endpoints allows you to retrieve information about the current state of the AllTalk server and its loaded TTS engine, including available voices, settings, and server readiness.
Check if the Text-to-Speech (TTS) engine has started and is ready to accept requests.
-
URL:
http://{ipaddress}:{port}/api/ready
-
Method:
GET
Status | Description |
---|---|
Ready |
The TTS engine is ready to process requests. |
Unloaded |
The TTS engine is restarting or not ready. |
curl -X GET "http://127.0.0.1:7851/api/ready"
- Useful when performing reload model/engine requests.
- You can poll this endpoint to confirm a "Ready" status.
- A "Ready" status only indicates that the engine has loaded, not that all models are correctly loaded.
Retrieve a list of available voices for the currently loaded TTS engine and model.
-
URL:
http://{ipaddress}:{port}/api/voices
-
Method:
GET
{
"status": "success",
"voices": ["voice1", "voice2", "voice3"]
}
curl -X GET "http://127.0.0.1:7851/api/voices"
- If the currently loaded TTS engine does not load a model directly (e.g., Piper), the models themselves will be displayed as voices.
Retrieve a list of available RVC voices for further processing your TTS with the RVC pipeline. If RVC is disabled on the server or there are no available voices, the voice returned will just be "Disabled". "Disabled" will always be added as a voice to the list, even if RVC is enabled on the server. This way Disabled can be chosen as a voice to bypass RVC processing, even when RVC is enabled server side.
-
URL:
http://{ipaddress}:{port}/api/rvcvoices
-
Method:
GET
{
"status": "success",
"voices": ["Disabled", "folder1\\voice1.pth", "folder2\\voice2.pth", "folder3\\voice3.pth"]
}
curl -X GET "http://127.0.0.1:7851/api/rvcvoices"
-
Disabled
will always be included in the list. - If the RVC pipeline is globally disabled in AllTalk,
Disabled
will be the only item in the list. - Index files matching their RVC voices will not be displayed; if an index file exists for an RVC voice, it will be automatically selected during generation.
Retrieve the current settings of the currently loaded TTS engine.
-
URL:
http://{ipaddress}:{port}/api/currentsettings
-
Method:
GET
The response is a JSON object containing various settings. Here are some key fields:
Field | Description |
---|---|
engines_available |
List of available TTS engines that can be loaded |
current_engine_loaded |
The currently loaded TTS engine |
models_available |
List of available models for the current TTS engine |
current_model_loaded |
The currently loaded model |
manufacturer_name |
The manufacturer of the current TTS engine |
audio_format |
The primary format in which the current engine produces audio output |
deepspeed_capable |
Whether the current TTS engine supports DeepSpeed |
generationspeed_capable |
Whether the current TTS engine supports generating TTS at different speeds |
pitch_capable |
Whether the current TTS engine supports generating TTS at different pitches |
temperature_capable |
Whether the current TTS engine supports different temperature settings |
languages_capable |
Whether the models within the current TTS engine support multiple languages |
multivoice_capable |
Whether the current model supports multiple voices |
multimodel_capable |
Whether the current TTS engine uses models as voices |
curl -X GET "http://127.0.0.1:7851/api/currentsettings"
{
"engines_available": ["parler", "piper", "vits", "xtts"],
"current_engine_loaded": "xtts",
"models_available": [
{"name": "xtts - xttsv2_2.0.2"},
{"name": "apitts - xttsv2_2.0.2"},
{"name": "xtts - xttsv2_2.0.3"},
{"name": "apitts - xttsv2_2.0.3"}
],
"current_model_loaded": "xtts - xttsv2_2.0.3",
"manufacturer_name": "Coqui",
"audio_format": "wav",
"deepspeed_capable": true,
"deepspeed_available": true,
"deepspeed_enabled": true,
"generationspeed_capable": true,
"generationspeed_set": 1,
"lowvram_capable": true,
"lowvram_enabled": false,
"pitch_capable": false,
"pitch_set": 0,
"repetitionpenalty_capable": true,
"repetitionpenalty_set": 10,
"streaming_capable": true,
"temperature_capable": true,
"temperature_set": 0.75,
"ttsengines_installed": true,
"languages_capable": true,
"multivoice_capable": true,
"multimodel_capable": true
}
- The response includes many more fields detailing the capabilities and current settings of the loaded TTS engine.
- Use this endpoint to dynamically adjust your application's UI based on the current capabilities of the loaded TTS engine.
- Check the server readiness before making other API calls.
- Use the voices and RVC voices endpoints to populate selection menus in your application.
- Use the current settings endpoint to adjust your application's features based on the capabilities of the loaded TTS engine.
- Regularly poll these endpoints if you need to maintain an up-to-date status of the AllTalk server in a long-running application.
import requests
# Base URL for the API
BASE_URL = "http://127.0.0.1:7851/api"
def stop_generation():
"""Stop the current TTS generation process."""
response = requests.put(f"{BASE_URL}/stop-generation")
print(response.json())
def reload_config():
"""Reload the TTS engine's configuration."""
response = requests.get(f"{BASE_URL}/reload_config")
print(response.text)
def reload_model(tts_method):
"""Load or swap to a specific TTS model."""
params = {"tts_method": tts_method}
response = requests.post(f"{BASE_URL}/reload", params=params)
print(response.json())
def switch_deepspeed(enable):
"""Enable or disable DeepSpeed mode."""
params = {"new_deepspeed_value": str(enable).lower()}
response = requests.post(f"{BASE_URL}/deepspeed", params=params)
print(response.json())
def switch_low_vram(enable):
"""Enable or disable Low VRAM mode."""
params = {"new_low_vram_value": str(enable).lower()}
response = requests.post(f"{BASE_URL}/lowvramsetting", params=params)
print(response.json())
# Example usage
if __name__ == "__main__":
stop_generation()
reload_config()
reload_model("xtts - xttsv2_2.0.2")
switch_deepspeed(True)
switch_low_vram(True)
# Note: Replace the BASE_URL with the correct IP address and port if different from the default
# Error handling can be improved for production use
// Base URL for the API
const BASE_URL = "http://127.0.0.1:7851/api";
async function stopGeneration() {
const response = await fetch(`${BASE_URL}/stop-generation`, { method: 'PUT' });
console.log(await response.json());
}
async function reloadConfig() {
const response = await fetch(`${BASE_URL}/reload_config`);
console.log(await response.text());
}
async function reloadModel(ttsMethod) {
const params = new URLSearchParams({ tts_method: ttsMethod });
const response = await fetch(`${BASE_URL}/reload?${params}`, { method: 'POST' });
console.log(await response.json());
}
async function switchDeepspeed(enable) {
const params = new URLSearchParams({ new_deepspeed_value: enable });
const response = await fetch(`${BASE_URL}/deepspeed?${params}`, { method: 'POST' });
console.log(await response.json());
}
async function switchLowVRAM(enable) {
const params = new URLSearchParams({ new_low_vram_value: enable });
const response = await fetch(`${BASE_URL}/lowvramsetting?${params}`, { method: 'POST' });
console.log(await response.json());
}
// Example usage
async function runExamples() {
try {
await stopGeneration();
await reloadConfig();
await reloadModel("xtts - xttsv2_2.0.2");
await switchDeepspeed(true);
await switchLowVRAM(true);
} catch (error) {
console.error("An error occurred:", error);
}
}
runExamples();
// Note: Replace the BASE_URL with the correct IP address and port if different from the default
// This example uses async/await for better readability, but you can also use .then() chains if preferred
// Error handling can be improved for production use
// For browser usage, ensure CORS is properly configured on the server side