Skip to content

Speech (TTS / STT)

Text-to-speech (TTS)

POST /v1/audio/speech

Converts text into speech and returns an audio binary stream.

Request parameters

ParameterTypeRequiredDescription
modelstringTTS model, e.g. tts-1 (standard), tts-1-hd (HD)
inputstringText to synthesize (up to 4096 characters)
voicestringVoice, see options below
response_formatstringAudio format: mp3 (default), opus, aac, flac, wav, pcm
speednumberSpeed, range 0.25–4.0 (default 1.0)

Available voices

VoiceStyle
alloyNeutral, balanced
echoRich, steady
fableWarm, narrative
onyxDeep, authoritative
novaLively, friendly
shimmerSoft, clear

Example

bash
curl https://api.idreame.ai/v1/audio/speech \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -d '{
    "model": "tts-1",
    "input": "Welcome to iDreame Cloud, your one-stop entry to AI.",
    "voice": "nova"
  }' \
  --output welcome.mp3
python
from pathlib import Path
from openai import OpenAI

client = OpenAI(
    base_url="https://api.idreame.ai/v1",
    api_key="sk-xxxxxxxx",
)

response = client.audio.speech.create(
    model="tts-1",
    voice="nova",
    input="Welcome to iDreame Cloud, your one-stop entry to AI.",
)

Path("welcome.mp3").write_bytes(response.content)

Speech-to-text (STT)

POST /v1/audio/transcriptions

Converts an audio file into text (transcription). Upload the file with multipart/form-data.

Request parameters

ParameterTypeRequiredDescription
filefileAudio file (mp3, mp4, mpeg, mpga, m4a, wav, webm; up to 25MB)
modelstringRecognition model, e.g. whisper-1
languagestringLanguage code (e.g. zh, en); auto-detected if omitted
promptstringOptional prompt to guide style or correct proper nouns
response_formatstringOutput format: json (default), text, srt, vtt, verbose_json
temperaturenumberSampling temperature 0–1

Example

bash
curl https://api.idreame.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -F "file=@recording.mp3" \
  -F "model=whisper-1" \
  -F "language=en"
python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.idreame.ai/v1",
    api_key="sk-xxxxxxxx",
)

with open("recording.mp3", "rb") as audio_file:
    transcript = client.audio.transcriptions.create(
        model="whisper-1",
        file=audio_file,
        language="en",
    )

print(transcript.text)

Response example

json
{
  "text": "Welcome to iDreame Cloud."
}

Subtitle output

Set response_format=srt to output an SRT subtitle file directly:

bash
curl https://api.idreame.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -F "file=@video_audio.mp3" \
  -F "model=whisper-1" \
  -F "response_format=srt"

Output:

1
00:00:00,000 --> 00:00:02,500
Welcome to iDreame Cloud.

2
00:00:02,800 --> 00:00:05,200
Your one-stop entry to AI.

OpenAI-compatible · Multimodal AI gateway