> For the complete documentation index, see [llms.txt](https://docs.meganova.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meganova.ai/inference-models/audio-generation.md).

# Audio Generation

Use these models for text-to-speech synthesis and speech-to-text transcription.

## Models available

Speech synthesis, and transcription models (filter **`Speech To Text`**).

Model ids, current prices, context lengths and per-tier limits are in the console catalog, which is generated from the same records that bill your requests:

[**console.meganova.ai/serverless**](https://console.meganova.ai/serverless) — filter by **`Text To Speech`**

The same list is available programmatically from [`GET /v1/models`](/api-reference/inference-models.md), including pricing and capability flags.

## Using the Models

### Through API Endpoint

> **NOTE:** Don't forget to use **your** API key. See [Authentication](/api-reference/platform-api/authentication.md) for details on authentication and [Create API Key](/api-reference/platform-api/create-api-key.md) for managing keys.

#### Text-to-Speech

**Using cURL**

```bash
curl -X POST "https://api.meganova.ai/v1/audio/speech" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $MegaNova_API_KEY" \
    --data-raw '{
      "model": "gemini/gemini-2.5-flash-tts",
      "input": "Hello, welcome to MegaNova!",
      "voice": "default"
    }' \
    --output speech.mp3
```

**Using Python**

```python
import requests
import os

url = "https://api.meganova.ai/v1/audio/speech"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {os.environ.get('MegaNova_API_KEY')}"
}

data = {
    "model": "gemini/gemini-2.5-flash-tts",
    "input": "Hello, welcome to MegaNova!",
    "voice": "default"
}

response = requests.post(url, headers=headers, json=data)
with open("speech.mp3", "wb") as f:
    f.write(response.content)
```

**Using JavaScript**

```javascript
const url = 'https://api.meganova.ai/v1/audio/speech';

const headers = {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.MegaNova_API_KEY}`
};

const data = {
    "model": "gemini/gemini-2.5-flash-tts",
    "input": "Hello, welcome to MegaNova!",
    "voice": "default"
};

fetch(url, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify(data)
})
    .then(response => response.arrayBuffer())
    .then(buffer => {
        // Save or play the audio buffer
        console.log('Audio generated successfully');
    })
    .catch(error => console.error('Error:', error));
```

#### Speech-to-Text

**Using cURL**

```bash
curl -X POST "https://api.meganova.ai/v1/audio/transcriptions" \
    -H "Authorization: Bearer $MegaNova_API_KEY" \
    -F "model=Systran/faster-whisper-large-v3" \
    -F "file=@audio.mp3"
```

## API Endpoints

| Endpoint                   | Method | Description                  |
| -------------------------- | ------ | ---------------------------- |
| `/v1/audio/speech`         | POST   | Text-to-Speech generation    |
| `/v1/audio/transcriptions` | POST   | Speech-to-Text transcription |

Feel free to refer to the [API Reference](/api-reference/inference-models.md) for more details.
