Skip to content

API ‐ Control and Configuration API

erew123 edited this page Sep 30, 2024 · 2 revisions

This set of endpoints allows you to control various aspects of the AllTalk server, including stopping generation, reloading configurations, switching models, and adjusting performance settings.

1. Stop Generation Endpoint

Interrupt the current TTS generation process, if the currently loaded TTS engine & method supports it. Currently only XTTS Streaming supports this.

  • URL: http://{ipaddress}:{port}/api/stop-generation
  • Method: PUT

Response

{
    "message": "Cancelling current TTS generation"
}

Example Request

curl -X PUT "http://127.0.0.1:7851/api/stop-generation"

Notes

  • This sets tts_stop_generation in the model_engine to True.
  • Stop requests will only be honored if the current TTS engine is capable of handling and can honor a stop request partway through generation.

2. Reload Configuration Endpoint

Reload the TTS engine's configuration and scan for new voices and models.

  • URL: http://{ipaddress}:{port}/api/reload_config
  • Method: GET

Response

Config file reloaded successfully

Example Request

curl -X GET "http://127.0.0.1:7851/api/reload_config"

Notes

  • This ensures that subsequent calls to /api/currentsettings, /api/voices, and /api/rvcvoices return up-to-date information.

3. Reload/Swap Model Endpoint

Load or swap to one of the models presented by /api/currentsettings in the models_available list.

  • URL: http://{ipaddress}:{port}/api/reload
  • Method: POST

Parameters

Parameter Type Description
tts_method string The name of the model to load

Response

{"status": "model-success"}

or

{"status": "model-failure"}

Example Request

curl -X POST "http://127.0.0.1:7851/api/reload?tts_method=xtts%20-%20xttsv2_2.0.2"

4. Switch DeepSpeed Endpoint

Enable or disable DeepSpeed mode, is the currently loaded TTS engine supports it.

  • URL: http://{ipaddress}:{port}/api/deepspeed
  • Method: POST

Parameters

Parameter Type Description
new_deepspeed_value boolean True to enable DeepSpeed, False to disable

Response

{
    "status": "deepspeed-success"
}

Example Request

curl -X POST "http://127.0.0.1:7851/api/deepspeed?new_deepspeed_value=True"

5. Switch Low VRAM Endpoint

Enable or disable Low VRAM mode. Will only benefit TTS Engines that support CUDA.

  • URL: http://{ipaddress}:{port}/api/lowvramsetting
  • Method: POST

Parameters

Parameter Type Description
new_low_vram_value boolean True to enable Low VRAM mode, False to disable

Response

{
    "status": "lowvram-success"
}

Example Request

curl -X POST "http://127.0.0.1:7851/api/lowvramsetting?new_low_vram_value=True"

Usage Tips

  1. Use the Stop Generation endpoint when you need to cancel an ongoing TTS generation process.
  2. The Reload Configuration endpoint is useful after making changes to the AllTalk configuration or adding new voice models.
  3. Use the Reload/Swap Model endpoint to change the active TTS model dynamically.
  4. The DeepSpeed and Low VRAM endpoints allow you to adjust performance settings based on your system's capabilities and current needs.
  5. Always check the response status to ensure your configuration changes were applied successfully.
  6. After making configuration changes, it's a good practice to use the status endpoints (from the AllTalk Server and TTS Engine Status API) to verify the new state of the server.
Clone this wiki locally