The dual API interfaces provided by the project support a variety of integration options:
- Standard REST API: By
/ttsThe interface receives a request in JSON format (text/voice parameter) and returns a WAV audio stream. - OpenAI-compatible interface::
/v1/audio/speechFully compatible with OpenAI TTS API specification, alternative to official services
Specific implementation steps:
- Enable it in config.yaml
api_keyAuthentication guarantees security - Sample code using the Python requests module:
response = requests.post('http://localhost:8005/v1/audio/speech', json={'input':'文本内容','voice':'female1'}) - set up
timeout=30Coping with long text generation
The testing phase can be accomplished through the Swagger documentation (http://localhost:8005/docs) Fast verification of interface parameters.
This answer comes from the articleKitten-TTS-Server: a self-deployable lightweight text-to-speech serviceThe































