> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elumenta.ru/llms.txt
> Use this file to discover all available pages before exploring further.

# Audio Generation Guide

> Text-to-speech, speech-to-text, and music generation with ElevenLabs, OpenAI TTS, MiniMax, and MusicGen

Elumenta supports three types of audio: **Text-to-Speech (TTS)**, **Speech-to-Text (STT)**, and **Music Generation**, all via the same `/api/v2/generate` endpoint.

## Text-to-Speech

Convert text to natural-sounding speech:

```python theme={null}
import requests

response = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "model": "elevenlabs-v2",
        "text": "Welcome to Elumenta. Your AI platform for every task.",
        "voice_id": "21m00Tcm4TlvDq8ikWAM"
    }
)

audio_url = response.json()["output_url"]
```

## TTS Model Comparison

| Slug               | Name            | Tier   | Cost   | Best for                      |
| ------------------ | --------------- | ------ | ------ | ----------------------------- |
| `minimax-tts`      | MiniMax TTS     | Basic+ | 1 tkn  | Chinese/English, high volume  |
| `openai-tts`       | OpenAI TTS      | Basic+ | 3 tkn  | Standard English voices       |
| `openai-tts-hd`    | OpenAI TTS HD   | Basic+ | 6 tkn  | Podcasts, narration           |
| `gpt-4o-mini-tts`  | GPT-4o Mini TTS | Basic+ | 3 tkn  | Natural conversation          |
| `elevenlabs-flash` | EL Flash        | Basic+ | 18 tkn | Real-time, low latency        |
| `elevenlabs-v2`    | EL ML v2        | Basic+ | 35 tkn | Multilingual, highest quality |

<Tip>
  For real-time applications use `elevenlabs-flash`. For pre-rendered content (podcasts, audiobooks) use `elevenlabs-v2` or `openai-tts-hd`.
</Tip>

## Speech-to-Text

Transcribe audio files:

```python theme={null}
response = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "model": "whisper",
        "audio_url": "https://example.com/audio.mp3",
        "language": "en"
    }
)

print(response.json()["content"])
```

| Slug                | Name              | Tier    | Cost  |
| ------------------- | ----------------- | ------- | ----- |
| `whisper`           | Whisper STT       | Starter | 2 tkn |
| `gpt-4o-transcribe` | GPT-4o Transcribe | Basic+  | 2 tkn |
| `elevenlabs-scribe` | EL Scribe         | Basic+  | 2 tkn |

## Music Generation

Two music models for different needs:

| Slug               | Provider   | Tier    | Cost   | Best for                             |
| ------------------ | ---------- | ------- | ------ | ------------------------------------ |
| `musicgen`         | Replicate  | Starter | 9 tkn  | Quick drafts, no subscription needed |
| `elevenlabs-music` | ElevenLabs | Basic+  | 58 tkn | Professional quality, longer tracks  |

### MusicGen (Replicate)

```python theme={null}
response = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "model": "musicgen",
        "prompt": "Upbeat jazz with piano and double bass, 120 BPM, swing feel",
        "duration": 30
    }
)
```

### ElevenLabs Music

```python theme={null}
response = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "model": "elevenlabs-music",
        "prompt": "Epic cinematic orchestral score, rising tension, full strings and brass",
        "duration": 60
    }
)
```

### Music Prompt Tips

| Element     | Examples                                                                     |
| ----------- | ---------------------------------------------------------------------------- |
| Genre       | `lo-fi hip hop`, `cinematic orchestral`, `electronic house`, `acoustic folk` |
| Instruments | `piano`, `electric guitar`, `synthesizer`, `violin`, `drums`                 |
| Tempo       | `80 BPM`, `fast-paced`, `slow and mellow`                                    |
| Mood        | `energetic`, `melancholic`, `uplifting`, `tense`, `relaxing`                 |
