Skip to main content
MetaMediumStandard

MusicGen

Meta's MusicGen via Replicate. Generates music from a text prompt or a reference melody (stereo / melody / large variants), can continue an input clip, and outputs MP3 or WAV. Billed per second of requested duration.

94 credits
per 8s — 30.5 + 7.9 × seconds (measured), 30 s about 270
Text-to-music and melody-conditioned generation
Continuation of an input audio clip
Four model variants (stereo-melody-large, stereo-large, melody-large, large)
Up to 30 seconds per generation
Sampling controls (top_k, top_p, temperature, CFG)

Run it right now

Test this model instantly in the Console Playground — no code required

Sign in to try

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

Quick Start

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "meta/musicgen",
  "input": {
    "prompt": "Upbeat K-pop electro-pop company jingle instrumental, 128 BPM, synth brass stabs, punchy drums, bright synth lead, catchy hook, fun and playful",
    "model_version": "stereo-melody-large",
    "duration": 30,
    "output_format": "mp3"
  }
}'

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYes-A description of the music you want to generate
model_versionstringNostereo-melody-largeModel variant. stereo-* produce stereo; melody-* accept input_audio as a melody reference
stereo-melody-largestereo-largemelody-largelarge
durationintegerNo8Duration of the generated audio in seconds (1-30). Billed per second
input_audiostringNo-Audio file that influences the output: continued when continuation is true, otherwise its melody is mimicked (melody models)
continuationbooleanNofalseIf true, generated music continues from input_audio
continuation_startintegerNo0Start time (s) of input_audio for continuation
continuation_endintegerNo-End time (s) of input_audio for continuation. Omit for the end of the clip
multi_band_diffusionbooleanNofalseDecode EnCodec tokens with MultiBand Diffusion (non-stereo models only)
normalization_strategystringNoloudnessStrategy for normalizing audio
loudnessclippeakrms
top_kintegerNo250Reduces sampling to the k most likely tokens
top_pnumberNo0Nucleus sampling probability. 0 uses top_k sampling
temperaturenumberNo1Sampling temperature. Higher means more diversity
classifier_free_guidanceintegerNo3Influence of inputs on the output. Higher adheres more to the prompt
output_formatstringNowavOutput format for generated audio
wavmp3
seedintegerNo-Seed for the random number generator. Omit or -1 for random

How to Provide File Input

There are 3 ways to provide files for the input_audio parameter:

Recommended

Image URL

Pass a publicly accessible URL directly. With the Storage API (POST /v1/files/upload-url) the file uploads straight to S3 (50MB per file) and you pass the returned file_url.

{
  "model": "meta/musicgen",
  "input": {
    "prompt": "your prompt here",
    "input_audio": "https://example.com/image.jpg"
  }
}

Direct Upload (Multipart)

Attach files directly to POST /v1/predictions/upload. No separate upload step, but the bytes pass through the API server so the whole request is capped at 10MB.

curl -X POST "https://api.core.today/v1/predictions/upload" \
  -H "X-API-Key: cdt_your_api_key" \
  -F "model=meta/musicgen" \
  -F 'input={"prompt":"your prompt here"}' \
  -F "file:input_audio=@your_file.png"
See the File Upload docs for more upload methods including Presigned URLs.

Common Parameters

Common parameters used when calling POST /v1/predictions.

ParameterTypeRequiredDefaultDescription
modelstringYes-Model identifier
inputobjectYes-Object containing the model-specific parameters from the table above
output_folderstringNo-Folder path for output files (max 256 chars, '..' not allowed)
webhook_urlstringNo-Webhook URL to call on completion
is_publicbooleanNofalseIf true, output files are also available via permanent public URLs

Examples

Core.Today theme (instrumental)

The same company-theme prompt given to every instrumental model — compare the results side by side

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "meta/musicgen",
  "input": {
    "prompt": "Upbeat K-pop electro-pop company jingle instrumental, 128 BPM, synth brass stabs, punchy drums, bright synth lead, catchy hook, fun and playful",
    "model_version": "stereo-melody-large",
    "duration": 30,
    "output_format": "mp3"
  }
}'

Cinematic 8-second cue

Default duration with the stereo-large variant and MP3 output

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "meta/musicgen",
  "input": {
    "prompt": "Triumphant cinematic orchestral melody in G major leading to a crescendo",
    "model_version": "stereo-large",
    "duration": 8,
    "output_format": "mp3"
  }
}'

30-second folk melody (large)

Maximum duration with the mono large variant — about 270 credits

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "meta/musicgen",
  "input": {
    "prompt": "Acoustic guitar folk melody, gentle and warm",
    "model_version": "large",
    "duration": 30,
    "output_format": "mp3"
  }
}'

Tips & Best Practices

1Billing is 30.5 + 7.9 credits per second of duration (measured): 8 s ≈ 94, 15 s ≈ 150, 30 s ≈ 270
2Use a melody-* variant with input_audio to keep a melody and change the style
3Set continuation to true to extend an existing clip instead of mimicking it
4multi_band_diffusion only works with the non-stereo variants (melody-large, large)

Use Cases

Short instrumental loops and beds
Variations on an existing melody
Extending a clip with continuation