Source: https://ailoot.ai/docs/en/api/audio/
Canonical: https://ailoot.ai/docs/en/api/audio/
Language: en

[API](https://ailoot.ai/docs/en/) 

# Audio

[Markdown](https://ailoot.ai/docs/en/api/audio/index.md)

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

POST`https://api.ailoot.ai/v1/audio/speech`

Audio

```bash
# 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
```

```python
# speech transcription
with open("meeting.wav", "rb") as f:
    tr = client.audio.transcriptions.create(model="qwen-asr", file=f)
print(tr.text)
```

200 OK · transcription

```json
{
  "text": "Good afternoon, everyone. Let us start with the results for the week…"
}
```

## Authentication

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `Authorization` | header | required | 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

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `model` | string | required | 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`. |
| `input` | string | required | Text to convert to speech. MiniMax models accept fewer than 10,000 characters; `qwen-audio-3.0-tts-plus` accepts up to 600. |
| `voice` | string |  | 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_format` | string | optional | 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

POST`https://api.ailoot.ai/v1/audio/transcriptions`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `file` | file | required | 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. |
| `model` | string | required | Speech-to-text model: `gemini-3.5-transcribe`, `qwen-audio-3.0-asr-flash`, `asr-1.0`. |
| `response_format` | string | optional | 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:

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

```json
{"type":"conversation.item.create","item":{"type":"message","role":"user","content":[{"type":"input_text","text":"Say yes."}]}}
```

```json
{"type":"response.create"}
```

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).

This page describes the voice mode for `qwen-audio-3.0-realtime-plus`; other realtime models follow their own rules. The endpoint `/v1/realtime/sessions` and ephemeral tokens are not supported.

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.[Contact support](mailto:support@ailoot.ai)

## Ailoot · The company and its project portfolio





Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.





The company and its project portfolio: millions of customers; monthly sales in the billions.





Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
