The Text-to-Speech API converts text into natural, high-quality speech with low latency. It supports multiple voices and voice cloning for creating custom voices from reference audio.
OpenAI Compatibility
The Text-to-Speech API is fully compatible with the OpenAI Speech API. Existing OpenAI integrations can switch to Sarj by updating the base URL and API key while using the same request format and response structure.
Base URL
https://sarj-omni-tts.sarj.ai/v1
Endpoint
POST /audio/speech
Authentication
All requests require an API key.
Include your API key in the Authorization header of every request.
Authorization: Bearer YOUR_API_KEY
The endpoint accepts application/json requests.
Parameters
Available Voices
Voice Cloning
The Text-to-Speech API supports voice cloning using a reference audio sample.
Endpoint:
POST /audio/speech/clone
For best results:
- Use clean audio with minimal background noise.
- Use a 6–10 second reference recording.
- Provide the matching reference text.
Example Request
Send a POST request to:
https://sarj-omni-tts.sarj.ai/v1/audio/speech
Include:
- An
Authorization header containing your API key.
- An
application/json request body containing the speech generation parameters.
Response
The API returns the generated audio as a binary audio file. By default, the output format is WAV. Last modified on July 7, 2026