Skip to content

Audio

Text-to-speech (TTS) and speech-to-text (STT) endpoints.


Text to Speech

Convert text into spoken audio.

Endpoint

POST /v1/audio/speech

Request Body

Parameter Type Required Description
model string TTS model (e.g. tts-1, tts-1-hd)
input string Text to convert to speech (max ~4096 chars)
voice string Voice: alloy, echo, fable, onyx, nova, shimmer
response_format string Audio format: mp3 (default), opus, aac, flac, wav, pcm
speed number Speed multiplier: 0.25–4.0. Default: 1.0

Example

curl https://ai.moducompia.com/v1/audio/speech \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "tts-1", "input": "Hello world!", "voice": "alloy"}' \
  --output speech.mp3

Speech to Text (Transcription)

Transcribe audio files into text.

Endpoint

POST /v1/audio/transcriptions

Request Body (multipart/form-data)

Parameter Type Required Description
file file Audio file (mp3, mp4, mpeg, mpga, m4a, wav, webm)
model string Model (e.g. whisper-1)
language string ISO-639-1 language code (e.g. en, ru)
response_format string json (default), text, srt, verbose_json, vtt
temperature number Sampling temperature (0–1)

Example

curl https://ai.moducompia.com/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -F file="@recording.mp3" \
  -F model="whisper-1" \
  -F language="en"

Response

{
  "text": "Hello, this is a test recording."
}