Skip to main content
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

Request Format

The endpoint accepts application/json requests.

Parameters

ParameterRequiredDescription
modelYesThe model to use for speech generation. Use gpt-4o-mini-tts.
voiceYesVoice to synthesize.
inputYesText to convert into speech.
response_formatNoOutput audio format. Default is wav.
num_stepNoNumber of inference steps. Default is 16.

Available Voices

VoiceDescription
ars_maleSaudi Arabic Male
ars_faresSaudi Arabic Male (Fares)
ars_female_expressiveSaudi Arabic Female

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