Music API
ai-music-api / generate

Kie.ai Music API is a unified AI music API that uses POST /api/v1/jobs/createTask to generate vocal and instrumental songs with V6, V6_MINI, and V6_WILD, plus lyrics, covers, extensions, 2- to 12-stem separation, WAV conversion, MIDI, and MP4 music videos.

Model Type:
Pricing: Generate Music costs 12 credits per request (≈ $0.06). High-tier top-ups (+10% bonus) bring effective pricing down to ~$0.054 per request.
Input
Custom Mode
0/80
0/1000
0/1000
Instrumental
0/5000
Output
music

Transform your thoughts into songs instantly and unleash your creativity!

README

Complete guide to using Music API

Music API & AI Music API: Full-Song Generation, Stem Separation & Audio Remixing

model Field ValueWhat It DoesPrice per Request
ai-music-api/generateGenerate vocal or instrumental songs (V6, V6_MINI, V6_WILD; custom_mode & instrumental required)12 credits ($0.06)
ai-music-api/extendContinue a generated track from a timestamp using V6, V6_MINI, or V6_WILD12 credits ($0.06)
ai-music-api/upload-and-cover-audioPass an external audio upload_url and re-render it in a new style while preserving melody12 credits ($0.06)
ai-music-api/upload-and-extend-audioPass an external audio upload_url and extend it seamlessly with optional lyrics and style12 credits ($0.06)
ai-music-api/add-vocals & add-instrumentalAdd AI vocals to an instrumental track or build backing music around vocals12 credits ($0.06) each
ai-music-api/mashupBlend tracks into a 10–360s mashup with text, first, and complete callbacks12 credits ($0.06)
ai-music-api/replace-sectionRegenerate a selected time window (up to 50% of original track duration)5 credits ($0.025)
ai-music-api/separate-vocalsseparate_vocal (2 stems) | split_stem_advanced (stem_name) | split_stem (up to 12 stems)10 / 20 / 50 credits ($0.05 / $0.10 / $0.25)
ai-music-api/generate-midi-from-audioExtract MIDI notes from a completed separate-vocals task_id (optional stem audio_id)Free (0 credits / $0)
ai-music-api/convert-to-wav-formatConvert a generated song or separated stem (task_id + audio_id) to WAV format0.4 credits ($0.002)
ai-music-api/generate-lyrics & boost-music-styleGenerate standalone lyrics from a prompt or expand short style tags0.4 credits ($0.002) each
ai-music-api/timeStamped-lyricsFetch aligned lyric timestamps for karaoke and synchronized players0.5 credits ($0.0025)
ai-music-api/create-music-videoRender a shareable MP4 music visualization video from task_id + audio_id2 credits ($0.01)
ai-music-api/sounds & speechShort sound loops/samples (sounds) or spoken-word audio (speech)2.5 cr ($0.0125) / 12 cr ($0.06)
ai-music-api/generate-persona & voice toolsCreate reusable persona_id (style_persona / voice_persona) and voice utilitiesFree (0 credits / $0)
Parameter / RuleCustom Mode (custom_mode: true)Non-Custom Reference Mode (custom_mode: false)
Required Content Fieldstitle (<=80 chars) + at least one of style (<=1,000 chars), lyrics (<=5,000 chars), or negative_tagsAt least one of style, lyrics, image_urls, video_urls, audio_urls, or midi_urls (total attachments <=10)
How prompt & lyrics WorkWhen instrumental: false, lyrics takes priority over prompt (falls back to prompt if lyrics is omitted)prompt (<=3,000 chars) guides automatic lyric generation when instrumental: false; lyrics can be attached alongside prompt
Multimodal Reference FilesNot accepted in Custom Mode (omit image_urls, video_urls, audio_urls, midi_urls)image_urls (<=5 files, <=10 MB each), video_urls (1 file <=100 MB, <=241s), audio_urls (6s–30 min, <=500 MB), midi_urls (1 file <=256 KB, MThd header, V6_WILD)
Duration & Vocal Controlsduration (10–360s on V6/V6_MINI/V6_WILD), vocal_gender ('m' or 'f' preference), style_weight (0–1), weirdness_constraint (0–1), audio_weight (0–1, vocal only), variety (0–4, default 1)Do not send duration, vocal_gender, style_weight, weirdness_constraint, audio_weight, or variety
Personas (V6 / V6_MINI / V6_WILD)Optional persona_id + persona_model ('style_persona' or 'voice_persona')Use Custom Mode when applying persona_id

How to Integrate the Kie.ai Music API

Authenticate with one Bearer token, submit music generation or audio processing jobs, and collect results via webhooks or polling.
  1. 1

    1. Create Your API Key & Test with 80 Free Credits

    Sign up on Kie.ai to receive 80 free credits (enough for six $0.06 song generation calls plus lyric and WAV tests), create an API key at kie.ai/api-key with optional hourly, daily, or total usage caps, and pass Authorization: Bearer YOUR_API_KEY.
  2. 2

    2. Submit a Music Task to POST /api/v1/jobs/createTask

    Send JSON with your target model ID (for example "ai-music-api/generate"), optional callBackUrl, and input parameters—such as custom_mode, instrumental, model ("V6", "V6_MINI", or "V6_WILD"), title, style, and lyrics (or upload local reference files first via https://docs.kie.ai/file-upload-api/quickstart.md).
  3. 3

    3. Handle Webhook Callbacks or Poll Task Status

    For song generation and mashup tasks, your callBackUrl receives notifications at three stages: text (lyrics/metadata), first (initial track ready with streaming URL), and complete (all variations finished). Verify webhook signatures with HMAC in your handler, or poll GET /api/v1/jobs/recordInfo?taskId=… for task results.
  4. 4

    4. Chain Stems, WAV Conversion, MIDI, or Video Exports

    Use your generated track's task_id and audio_id with ai-music-api/separate-vocals ($0.05–$0.25), convert-to-wav-format ($0.002), or create-music-video ($0.01). For free MIDI extraction ($0), first complete stem separation, then pass that separation task_id (and optional stem audio_id) to generate-midi-from-audio, and store final files in your own bucket within the 14-day retention window.

What You Can Build with the Kie.ai AI Music API

You can build consumer song-making apps, DAW plugins, and game-audio pipelines by combining generation, stem separation, WAV conversion, and MIDI through one endpoint—explore broader audio options in our Text to Music API catalog.

AI Song & Lyric Generator SaaS Applications

Power web and mobile song creation apps by pairing ai-music-api/generate-lyrics ($0.002) and boost-music-style ($0.002) with V6 full-song generation ($0.06) and stream_audio_url playback.

Karaoke, Stem Remixing & DAW Production Tools

Separate generated tracks into up to 12 stems—including vocals, instruments, and FX—via ai-music-api/separate-vocals ($0.05–$0.25), extract MIDI note data from completed stem separations via generate-midi-from-audio ($0), and sync lyrics with timeStamped-lyrics ($0.0025).

Demo Restyling, Audio Covers & Song Extension

You can let users pass hummed melodies, voice memos, or demos as upload_url to ai-music-api/upload-and-cover-audio ($0.06), extend external audio via upload_url on ai-music-api/upload-and-extend-audio ($0.06), and replace selected segments within an existing song via ai-music-api/replace-section ($0.025).

Video Scoring, Game Soundtracks & Social MP4 Clips

Score gameplay or short-form video scenes using image_urls or video_urls in non-custom mode, generate loopable textures via ai-music-api/sounds ($0.0125), and export WAV files ($0.002) or MP4 visualizers ($0.01).

Why Integrate the Music API on Kie.ai

01

Music & Audio Workflows Under One API Key

Submit song generation, custom personas, covers, extensions, mashups, section replacement, 2- to 12-stem separation, WAV conversion, MIDI extraction, lyrics, and MP4 visualizers through POST /api/v1/jobs/createTask.
02

Transparent Per-Request Pay-As-You-Go Pricing

Pay as you go with no monthly subscription: lyrics and WAV conversion cost $0.002/request, full-song generation, covers, extensions, and mashups cost $0.06, stem separation costs $0.05–$0.25, and MIDI extraction plus persona/voice utilities cost $0, with 80 free sign-up credits and balance checks via GET /api/v1/chat/credit.
03

Production Webhooks, Rate Limits & Key Caps

Submit up to 20 new task requests per 10 seconds per account by default on /api/v1/jobs/createTask, verify webhook callbacks using HMAC signatures, and configure per-key hourly, daily, and total credit limits at kie.ai/api-key.
4.8/ 5
32,899 ratings
Tap a star to rate

Frequently Asked Questions About the Kie.ai Music API

What is the Kie.ai Music API and which generation tiers does it support?

The Kie.ai Music API is a hosted REST API that uses POST https://api.kie.ai/api/v1/jobs/createTask for full-song generation, standalone lyrics, audio covers, track extensions, stem separation, WAV conversion, MIDI extraction, and MP4 music videos. For ai-music-api/generate and ai-music-api/extend, choose among three active generation tiers in input.model: V6 (expressive vocals and rich musical detail), V6_MINI (lightweight generation), and V6_WILD (experimental arrangements and MIDI reference support).

How much does the AI Music API cost on Kie.ai, and is there a free tier?

Kie.ai uses pay-as-you-go credit billing with no monthly subscription. There is no free API or free plan, but new users receive 80 free credits upon sign-up (enough for six full-song generation requests plus lyric or WAV calls). Full-song generation (ai-music-api/generate), Extend Music, Upload and Cover Audio, Upload and Extend Audio, Add Vocals, Add Instrumental, Mashup, and Speech each cost 12 credits ($0.06) per request; Replace Music Section costs 5 credits ($0.025); Stem Separation costs 10, 20, or 50 credits ($0.05, $0.10, or $0.25); Sounds costs 2.5 credits ($0.0125); Create Music Video costs 2 credits ($0.01); Timestamped Lyrics costs 0.5 credits ($0.0025); Generate Lyrics, Boost Music Style, and Convert to WAV each cost 0.4 credits ($0.002); and Generate MIDI from Audio plus the persona and voice utility endpoints are free ($0). Prices may change, so check the pricing card at the top of the page for current rates.

What is the difference between Custom Mode (custom_mode: true) and Non-Custom Mode (custom_mode: false)?

In Custom Mode (custom_mode: true), you must pass title (up to 80 characters) and at least one of style (up to 1,000 characters), lyrics (up to 5,000 characters; takes priority over prompt when instrumental is false), or negative_tags, and you can set custom-only controls such as duration (10–360 seconds), vocal_gender ('m' or 'f' probabilistic preference), style_weight, weirdness_constraint, audio_weight (vocal tracks only), variety (0–4), and persona_id. In Non-Custom Mode (custom_mode: false), you must provide at least one of style, lyrics, image_urls (up to 5 images, <=10 MB each), video_urls (1 file <=100 MB, <=241s), audio_urls (6s–30 min, <=500 MB), or midi_urls (1 file <=256 KB with an MThd header)—up to 10 total attachments. When instrumental is false, prompt (up to 3,000 characters) can guide automatic lyric generation, and lyrics can be supplied alongside it. MIDI references are supported on V6_WILD; if another tier is selected, the request switches to V6_WILD. Omit custom-only controls when custom_mode is false.

How do 2-stem and 12-stem vocal separation and MIDI extraction work?

Call ai-music-api/separate-vocals with task_id and audio_id and set type to separate_vocal (default, 2 stems: vocals + accompaniment at 10 credits / $0.05), split_stem_advanced (specifies a target stem_name and returns isolated extract + stem-removed mix at 20 credits / $0.10), or split_stem (up to 12 stems including vocals, backing vocals, drums, bass, guitar, keyboard, strings, brass, woodwinds, percussion, synth, and FX at 50 credits / $0.25; there is no server-side stem cache, so repeat calls bill again). Once stem separation succeeds, pass that separation task_id (and optional stem audio_id) to ai-music-api/generate-midi-from-audio at 0 credits ($0) and fetch note data via callBackUrl or GET /api/v1/midi/record-info?taskId=….

How do I download generated audio or convert tracks and stems to WAV format?

Music generation results return track fields including audio_url, stream_audio_url, image_url, id, and duration—use audio_url to download the track or stream_audio_url for streaming playback. To export a generated song or a separated stem to WAV format, call ai-music-api/convert-to-wav-format (0.4 credits / $0.002) with the source task_id and audio_id.

Can I upload my own audio for covers and extensions, or replace a section of a song?

Yes. Upload local audio through the Kie.ai File Upload API (https://docs.kie.ai/file-upload-api/quickstart.md) to obtain a file URL, then pass upload_url to ai-music-api/upload-and-cover-audio ($0.06) to re-style a recording while keeping its core melody, or pass upload_url and model to ai-music-api/upload-and-extend-audio ($0.06) to extend external audio seamlessly. To edit a section within an existing song, call ai-music-api/replace-section ($0.025) on a time segment covering no more than 50% of the track's total duration.

How do webhook callbacks, rate limits, and file retention work in production?

When you pass callBackUrl on song generation or mashup tasks, Kie.ai sends notifications at three stages—text, first (initial streaming URL), and complete—which your endpoint can verify using HMAC signatures. By default, each account can submit up to 20 new task requests per 10 seconds on POST /api/v1/jobs/createTask (excess requests return JSON code 429; always inspect the JSON code field even on HTTP 200 responses), configure per-key caps at kie.ai/api-key, and download generated media within 14 days before server retention expires.

Are open-source weights or a desktop app available for the Kie.ai Music API?

No. The Kie.ai Music API is delivered exclusively through cloud REST endpoints and the browser Playground on this page—there are no downloadable local model weights or desktop/mobile apps to install.