# MusicGen - Core.Today AI API > 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. - **Provider**: Meta - **Model ID**: meta/musicgen - **Category**: Audio & TTS - **Credits**: 94 per 8s — 30.5 + 7.9 × seconds (measured), 30 s about 270 - **Speed**: Medium - **Quality**: Standard ## Features - 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) ## Use Cases - Short instrumental loops and beds - Variations on an existing melody - Extending a clip with continuation ## API Endpoint Base URL: https://api.core.today/v1 Create Prediction: POST /predictions Get Status: GET /predictions/{job_id} ## Authentication Header: X-API-Key: YOUR_API_KEY ## Input Parameters ### Required - **prompt**: string - A description of the music you want to generate ### Optional - **model_version**: string (default: stereo-melody-large) - Model variant. stereo-* produce stereo; melody-* accept input_audio as a melody reference Options: stereo-melody-large, stereo-large, melody-large, large - **duration**: integer (default: 8) - Duration of the generated audio in seconds (1-30). Billed per second - **input_audio**: string - Audio file that influences the output: continued when continuation is true, otherwise its melody is mimicked (melody models) - **continuation**: boolean (default: false) - If true, generated music continues from input_audio - **continuation_start**: integer (default: 0) - Start time (s) of input_audio for continuation - **continuation_end**: integer - End time (s) of input_audio for continuation. Omit for the end of the clip - **multi_band_diffusion**: boolean (default: false) - Decode EnCodec tokens with MultiBand Diffusion (non-stereo models only) - **normalization_strategy**: string (default: loudness) - Strategy for normalizing audio Options: loudness, clip, peak, rms - **top_k**: integer (default: 250) - Reduces sampling to the k most likely tokens - **top_p**: number (default: 0) - Nucleus sampling probability. 0 uses top_k sampling - **temperature**: number (default: 1) - Sampling temperature. Higher means more diversity - **classifier_free_guidance**: integer (default: 3) - Influence of inputs on the output. Higher adheres more to the prompt - **output_format**: string (default: wav) - Output format for generated audio Options: wav, mp3 - **seed**: integer - Seed for the random number generator. Omit or -1 for random ## Examples ### Core.Today theme (instrumental) The same company-theme prompt given to every instrumental model — compare the results side by side ```json { "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 ```json { "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 ```json { "model": "meta/musicgen", "input": { "prompt": "Acoustic guitar folk melody, gentle and warm", "model_version": "large", "duration": 30, "output_format": "mp3" } } ``` ## Response Format ```json { "job_id": "abc123", "status": "pending | processing | completed | failed", "result": "URL or data (when completed)" } ``` ## Usage Flow 1. POST /predictions with model and input -> receive job_id 2. GET /predictions/{job_id} -> poll until status is completed or failed 3. Result contains output URL(s) ## Tips - Billing is 30.5 + 7.9 credits per second of duration (measured): 8 s ≈ 94, 15 s ≈ 150, 30 s ≈ 270 - Use a melody-* variant with input_audio to keep a melody and change the style - Set continuation to true to extend an existing clip instead of mimicking it - multi_band_diffusion only works with the non-stereo variants (melody-large, large)