docs
API

Audio

Markdown

Text-to-speech (TTS) and speech-to-text (STT) using the OpenAI Audio format.

Full guide
POSThttps://api.ailoot.ai/v1/audio/speech
Audio
# speech synthesis
curl https://api.ailoot.ai/v1/audio/speech \
  -H "Authorization: Bearer $AILOOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen-audio-3.0-tts-plus", "input": "Good afternoon! This is a text-to-speech example.", "voice": "longanlingxin"}' \
  --output speech.mp3

# transcription
curl https://api.ailoot.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $AILOOT_API_KEY" \
  -F model=qwen-asr \
  -F file=@meeting.wav
200 OK · transcription
{
  "text": "Good afternoon, everyone. Let us start with the results for the week…"
}

Authentication

  • Authorizationheaderrequired

    The key in the format Bearer sk-…. The following headers also work: x-api-key or x-goog-api-key.

Text-to-speech: request body

  • modelstringrequired

    Text-to-speech model: gemini-3.8-flash-tts, qwen-audio-3.0-tts-plus, speech-2.8-turbo, gemini-3.8-flash-lite-tts, speech-2.8-hd, gemini-3.1-flash-tts-preview, speech-2.6-turbo, speech-2.6-hd, speech-02-turbo, speech-02-hd.

  • inputstringrequired

    Text to convert to speech. MiniMax models accept fewer than 10,000 characters; qwen-audio-3.0-tts-plus accepts up to 600.

  • voicestring

    Voice. Required for MiniMax models (speech-2.8-hd and other models matching speech-…): a MiniMax voice ID (Latin letters, digits, _ and -, up to 128 characters). For qwen-audio-3.0-tts-plus the default is longanlingxin; for Gemini TTS models, it is Kore.

  • response_formatstringoptional

    MiniMax supports only mp3; qwen-audio-3.0-tts-plus — mp3, wav or pcm; Gemini TTS supports wav or json (a link to the file).

The response is an audio file (for MiniMax, audio/mpeg). Billing is per text character or per token, as listed in the catalog.

Speech-to-text

POSThttps://api.ailoot.ai/v1/audio/transcriptions
  • filefilerequired

    A WAV audio file in multipart/form-data. qwen-asr, qwen-asr-latest and qwen-audio-3.0-asr-flash: a complete, uncompressed PCM WAV file up to 5 minutes long and approximately 7.5 MB (up to 10 MB in base64). asr-1.0: PCM WAV up to 500 seconds and 50 MB. gemini-3.5-transcribe: WAV up to 64 MB.

  • modelstringrequired

    Speech-to-text model: gemini-3.5-transcribe, qwen-audio-3.0-asr-flash, asr-1.0.

  • response_formatstringoptional

    Only json (or omit it).

The field language is not used by these models. Response: {"text": "…"}. Billing is based on recording duration (seconds, minutes, or hours — each model uses its own unit).

Realtime voice

For qwen-audio-3.0-realtime-plus open a WebSocket wss://api.ailoot.ai/v1/realtime?model=qwen-audio-3.0-realtime-plus with the header Authorization: Bearer <API_KEY>. Send the key from your server: keys in the query string are not accepted. Wait for session.created with your chosen model, then send the settings, a message, and response.create. Below are three consecutive JSON text frames for a text response in an audio session:

{"type":"session.update","session":{"modalities":["text"],"turn_detection":null,"max_history_turns":20,"instructions":"Be brief."}}

Read response events until you receive response.done and its final usage; errors arrive in an event of type error. Billing is based on the text and audio tokens in each confirmed response. Audio input: send an event of type input_audio_buffer.append with audio — base64 PCM16 mono 16 kHz; then input_audio_buffer.commit and response.create. Audio output is PCM16 mono 24 kHz. Binary frames are not accepted in this session.

Supported client events: session.update, input_audio_buffer.append/commit/clear, response.create/cancel, conversation.item.create/retrieve/delete. Conversation items support only messages/text; function tools, web search, and voiceprint are not supported. Session limits: 600 seconds, 20 responses, 20 history turns, 2000 bytes of instructions, and 8000 bytes of client text. The idle timeout depends on the configuration (60 seconds by default).

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.Contact support