SelamGPT PlatformSelamGPT
docs v1.0.0
POST
/audio/speechText-to-Speech
Convert text to natural-sounding speech. Supports multiple voices, languages, and audio formats.
OpenAI Compatible
This endpoint is fully compatible with OpenAI's text-to-speech API. Simply change the base URL and use your Selam API key.
Request
Request Body
1{
2 "model": "tts-1",
3 "input": "Hello! Welcome to SelamGPT text-to-speech.",
4 "voice": "alloy",
5 "response_format": "mp3",
6 "speed": 1.0
7}Parameters
modelstringrequiredThe TTS model to use. Options: "tts-1" (standard), "tts-1-hd" (high quality).
inputstringrequiredThe text to convert to speech. Maximum length is 4096 characters.
voicestringrequiredThe voice to use. Options: "alloy", "echo", "fable", "onyx", "nova", "shimmer". Use /audio/voices to see all available voices.
response_formatstringoptionalThe audio format. Options: "mp3", "opus", "aac", "flac". Default is "mp3".
speednumberoptionalThe speed of the generated audio. Range: 0.25 to 4.0. Default is 1.0.
Response
Returns the audio file as binary data with the appropriate Content-Type header.
Examples
1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY",
5 base_url="https://api.selamgpt.com/v1"
6)
7
8response = client.audio.speech.create(
9 model="tts-1",
10 voice="alloy",
11 input="Hello! Welcome to SelamGPT."
12)
13
14response.stream_to_file("speech.mp3")Was this page helpful?