Text to music

Text to music API

The models that write music from a description: background tracks for videos, jingles, songs with vocals and your own lyrics. Generate in the browser or through the API on one MegaBrain key, paid per track or per minute from a prepaid US-dollar balance.

The short answer

MegaBrain runs 6 music generation models on one API key: MiniMax Music 2.6, ElevenLabs Music, Lyria 2, Suno V6, Suno V6 Mini and Suno V6 Wild. At default settings the lowest price is Suno V6 at $0.072 per track; the highest is ElevenLabs Music at $0.72 per minute of audio. Prices are in US dollars from the live MegaBrain catalogue; a job the provider fails is refunded in full.

Music generation models and prices

Prices in US dollars from the MegaBrain catalogue; they update automatically. Each model’s page has examples, every parameter and a playground.

ModelTaskPrice
MiniMax Music 2.6
minimax-music/v2.6
Text to music$0.18 per track
ElevenLabs Music
elevenlabs/music
Text to music$0.72 per minute of audio
Lyria 2
lyria2
Text to music$0.12 per track
Suno V6
suno/v6
Text to music$0.072 per track
Suno V6 Mini
suno/v6-mini
Text to music$0.072 per track
Suno V6 Wild
suno/v6-wild
Text to music$0.072 per track

Which music model to pick

MiniMax Music 2.6 makes full songs with vocals from your lyrics, or writes the lyrics itself, at one price per track. ElevenLabs Music makes tracks from 3 seconds to 10 minutes with or without vocals, priced per started minute. Lyria 2 from Google DeepMind makes 30-second instrumental clips.

Lyrics and instrumentals

Pass lyrics with structure tags like [Verse] and [Chorus] to MiniMax Music 2.6, or set is_instrumental for music without vocals. ElevenLabs Music takes force_instrumental, and the length in music_length_ms.

Music for a clip

Turn a video model’s sound off and lay your own track under the clip: one key covers both.

Image to video: models

First request

Generation runs through a queue: a POST request submits the job, then the script polls status_url and fetches the result from response_url. Create the key on the API key page after you sign up.

import os, time, requests

BASE = "https://getmegabrain.com/api/gateway/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['MEGABRAIN_API_KEY']}"}

job = requests.post(f"{BASE}/queue/minimax-music/v2.6", headers=HEADERS, json={
  "prompt": "warm lo-fi hip hop with soft piano chords and vinyl crackle"
}).json()

while requests.get(job["status_url"], headers=HEADERS).json()["status"] not in ("COMPLETED", "FAILED"):
    time.sleep(2)

print(requests.get(job["response_url"], headers=HEADERS).json())

Questions and answers

How much does AI music generation cost through an API?

MegaBrain runs 6 music generation models on one API key: MiniMax Music 2.6, ElevenLabs Music, Lyria 2, Suno V6, Suno V6 Mini and Suno V6 Wild. At default settings the lowest price is Suno V6 at $0.072 per track; the highest is ElevenLabs Music at $0.72 per minute of audio. Prices are in US dollars from the live MegaBrain catalogue; a job the provider fails is refunded in full.

Do I need an account with each model’s maker?

No. Sign up on MegaBrain, top up the balance by card and create one API key: it works for every model in the table, for the other image, video and audio models and for the text models.

How is generation paid for?

From a prepaid US-dollar balance at the price in the table, with no subscription. The price of a job is held when it is submitted and refunded in full if the provider fails it.

Can I use the music commercially?

The models’ makers allow commercial use of the tracks they generate; check each maker’s terms for your use, and do not prompt for imitations of real artists or songs.

How do I call it from code?

A POST request to https://getmegabrain.com/api/gateway/v1/queue/<model id> submits the job; then poll status_url until it is COMPLETED and fetch the audio link from response_url. There is a Python example below, and every model’s parameters are on its page.

Get your API key

Sign-up is open. Create an account, top up the balance by card and create a key: it works for every text, image, video and audio model in the catalogue. Credits never expire.

Questions? Write to team@getmegabrain.com