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

# Music Generation

> Generate music with MusicGen (Replicate) and ElevenLabs Music

## Models

| Slug               | Provider   | Tier    | Cost   |
| ------------------ | ---------- | ------- | ------ |
| `musicgen`         | Replicate  | Starter | 9 tkn  |
| `elevenlabs-music` | ElevenLabs | Basic+  | 58 tkn |

## Request

<ParamField header="Authorization" type="string" required>
  `Authorization: Bearer nb_YOUR_API_KEY`
</ParamField>

<ParamField body="model" type="string" required>
  `musicgen` or `elevenlabs-music`
</ParamField>

<ParamField body="prompt" type="string" required>
  Text description of the music — genre, mood, instruments, tempo.

  Example: `"Upbeat electronic dance track with synthesizers, 128 BPM, energetic"`
</ParamField>

<ParamField body="duration" type="integer" default="30">
  Duration in seconds. Range: `15`–`120`.
</ParamField>

## Response

```json theme={null}
{
  "id": "gen_01j9x2abc123",
  "status": "completed",
  "type": "audio",
  "model": "elevenlabs-music",
  "output_url": "https://cdn.elumenta.ru/audio/gen_01j9x2abc123.mp3",
  "duration_seconds": 30,
  "tokens_used": 58,
  "created_at": "2026-03-01T12:00:00Z"
}
```

## Code Examples

<CodeGroup>
  ```python MusicGen theme={null}
  import requests

  response = requests.post(
      "https://elumenta.ru/api/v2/generate",
      headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
      json={
          "model": "musicgen",
          "prompt": "Calm lo-fi hip hop, vinyl crackle, piano, 80 BPM, for studying",
          "duration": 30
      }
  )
  print(response.json()["output_url"])
  ```

  ```python ElevenLabs Music theme={null}
  import requests

  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
      }
  )
  print(response.json()["output_url"])
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://elumenta.ru/api/v2/generate", {
    method: "POST",
    headers: {
      "Authorization": "Bearer nb_YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "elevenlabs-music",
      prompt: "Upbeat jazz with piano and double bass, 120 BPM, swing feel",
      duration: 45
    })
  });
  const result = await response.json();
  console.log(result.output_url);
  ```
</CodeGroup>

## Prompt Tips

| Goal       | Prompt example                                                                |
| ---------- | ----------------------------------------------------------------------------- |
| Background | `"Soft ambient background music, minimal, piano and pads"`                    |
| Workout    | `"High energy rock, electric guitar riff, 140 BPM, motivational"`             |
| Cinematic  | `"Epic orchestral film score, rising tension, full strings and brass"`        |
| Lo-fi      | `"Lo-fi hip hop, vinyl crackle, Rhodes piano, 75 BPM, relaxing"`              |
| Corporate  | `"Uplifting corporate background music, light piano, positive, professional"` |
