# MusicGen > Meta's MusicGen via Replicate. Generates music from a text prompt or a reference melody (stereo / melody / large variants), with continuation of an input clip and MP3 / WAV output. - **Provider**: replicate - **Model ID**: meta/musicgen - **Category**: music_generation - **Credits**: from 94 for the default configuration — varies by input, see Pricing - **Pricing Type**: formula ## API Endpoint Base URL: https://api.core.today/v1 ### Create Prediction POST /predictions ### Get Status GET /predictions/{job_id} ### Cancel DELETE /predictions/{job_id} ## Authentication Header: `X-API-Key: YOUR_API_KEY` ## Input Parameters - `prompt` (string, **required**): A description of the music you want to generate. - `continuation_end` (integer, optional): End time (s) of input_audio for continuation. Omit for the end of the clip. (Range: min: 0) - `model_version` (string, optional): Model to use. stereo-* produce stereo output; melody-* accept input_audio as a melody reference. (Default: `stereo-melody-large`; Options: `stereo-melody-large`, `stereo-large`, `melody-large`, `large`) - `seed` (integer, optional): Seed for the random number generator. Omit or -1 for random. - `multi_band_diffusion` (boolean, optional): Decode EnCodec tokens with MultiBand Diffusion (non-stereo models only). (Default: `false`) - `continuation_start` (integer, optional): Start time (s) of input_audio to use for continuation. (Default: `0`; Range: min: 0) - `duration` (integer, optional): Duration of the generated audio in seconds (1-30). (Default: `8`; Range: min: 1, max: 30) - `top_p` (number, optional): Nucleus sampling probability. 0 uses top_k sampling. (Default: `0`) - `input_audio` (string, optional): An audio file that will influence the generated music. With continuation it is continued; otherwise its melody is mimicked (melody models only). - `output_format` (string, optional): Output format for generated audio. (Default: `wav`; Options: `wav`, `mp3`) - `top_k` (integer, optional): Reduces sampling to the k most likely tokens. (Default: `250`) - `temperature` (number, optional): Sampling temperature. Higher means more diversity. (Default: `1`) - `normalization_strategy` (string, optional): Strategy for normalizing audio. (Default: `loudness`; Options: `loudness`, `clip`, `peak`, `rms`) - `classifier_free_guidance` (integer, optional): Influence of inputs on the output. Higher adheres more to the prompt. (Default: `3`) - `continuation` (boolean, optional): If true, generated music continues from input_audio. (Default: `false`) ## Example Request ```json { "model": "meta/musicgen", "input": { "duration": 8, "model_version": "stereo-large", "output_format": "mp3", "prompt": "Edo25 major g melodies that sound triumphant and cinematic, leading up to a crescendo that resolves in a 9th harmonic" } } ``` ## Response Format ```json { "job_id": "abc123", "status": "pending", "provider": "replicate", "model": "meta/musicgen", "created_at": "2026-01-01T00:00:00Z", "result": null, "error": null, "credits_used": null } ``` Status values: `pending`, `processing`, `completed`, `failed`, `cancelled` When the job is `completed`, `result` holds the output URL(s) or data and `credits_used` the net credits charged. When it is `failed`, `error` and `error_code` say why and the charge is refunded. ## Usage Flow 1. POST /predictions with model and input → receive job_id 2. Poll GET /predictions/{job_id} until status is `completed` or `failed` 3. Result contains output URL(s) or data ## Pricing - Formula: `base + rate * duration` credits - `base`: 30.5 - `duration`: the `duration` input (default 8) - `rate`: 7.92 Default configuration: 94 credits. These are list prices. The amount charged is rounded, and large charges are discounted progressively. `POST /predictions/estimate` with the same `model` and `input` returns the charge for that input without creating a job (an estimate when the price depends on the output). ## Output Type url ## Tags music-generation, text-to-music, melody-conditioning, instrumental, open-source, meta ## Documentation https://replicate.com/meta/musicgen