AI Music Generator API
Generate full songs, vocals and instrumentals from text prompts, lyrics and style tags with one API call. Build AI music into your app, game, video pipeline or AI agent.
API access is provided by APIstable, our recommended API partner. Pay as you go, no subscription.
Everything you need to generate music programmatically
A developer-friendly AI music generator API with the same kind of studio-quality output you hear on our web app.
Text to song
Describe the mood, genre and theme in plain language and get a complete song back, including vocals and arrangement.
Custom lyrics
Send your own lyrics with section tags like [Verse] and [Chorus], plus a title and style, for full creative control.
Instrumental mode
Generate background music without vocals for videos, games, podcasts and ads.
Style and length control
Steer genre, instruments, tempo, vocal gender and duration with request parameters.
Webhooks or polling
Tasks run asynchronously. Get results pushed to your callback URL, or poll the task endpoint.
Only pay for success
Billing is per request with no monthly commitment, and failed tasks are not charged.
Generate your first song in 3 steps
A standard REST API with Bearer authentication. Works from any language: Node.js, Python, PHP, Go, or no-code tools like n8n and Make.
1. Create an API key
Sign up on APIstable, top up a small balance and copy your key from the console.
2. Create a generation task
POST your prompt or lyrics, style and title to the create_task endpoint. You receive a task_id right away.
3. Get the audio
Poll the task by ID or receive a webhook. When the status is succeeded, download the generated tracks.
- View the full API reference
curl -X POST https://apistable.ai/api/v1/tasks/create_task \
-H "Authorization: Bearer $APISTABLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<MUSIC_MODEL_ID>",
"input": {
"custom_mode": true,
"instrumental": false,
"title": "Neon Nights",
"style": "synthwave, female vocals, 110 bpm",
"lyrics": "[Verse]\nCity lights are calling me..."
},
"callback_url": "https://your-app.com/webhooks/music"
}'
# => {"code":200,"msg":"success","data":{"task_id":"..."}}import os, time, requests
API = "https://apistable.ai/api/v1/tasks"
HEADERS = {"Authorization": f"Bearer {os.environ['APISTABLE_API_KEY']}"}
task = requests.post(f"{API}/create_task", headers=HEADERS, json={
"model": "<MUSIC_MODEL_ID>",
"input": {
"custom_mode": True,
"instrumental": True,
"title": "Morning Focus",
"style": "lofi hip hop, warm piano, relaxed",
},
}).json()["data"]
while True:
data = requests.get(f"{API}/{task['task_id']}", headers=HEADERS).json()["data"]
if data["status"] in ("succeeded", "failed"):
break
time.sleep(10)
print(data["status"], data["result"])Replace <MUSIC_MODEL_ID> with the music model ID listed in the API docs. Keep your API key on your server, never in client-side code.
What developers build with the AI music API
Music apps
Let your users create personalized songs, birthday tracks or ringtones inside your own app.
Games
Generate soundtracks and adaptive background music for levels, menus and trailers.
Video automation
Add original background music to short videos generated at scale.
Marketing and ads
Create jingles and product-video music variations for A/B testing.
AI agents
Give your agent a music tool through the REST API or the MCP server.
Agencies and platforms
Offer music generation to your clients with usage-based costs that scale with demand.
Web app or API: which one is right for you?
MusicGeneratorAI web app
- • Create songs yourself in the browser
- • No code needed
- • Editing tools: extend, replace, vocal remover
- • Library, playlists and sharing
AI Music Generator API
- • Generate music from your own code
- • Integrate into apps, games and workflows
- • High-volume and automated generation
- • Usage-based pricing per request
API usage is billed separately from MusicGeneratorAI plans. See API pricing
AI Music Generator API FAQ
What is an AI music generator API?
It is a web API that turns text prompts, lyrics and style tags into finished audio tracks. Instead of creating songs by hand in a web app, your code sends a request and receives generated music it can store, play or sell inside your product.
Who provides the API?
Developer API access is provided by APIstable, our recommended API partner. You create your API key and manage billing on APIstable, and you can follow its documentation to integrate.
How much does the AI music API cost?
It is pay as you go, billed per request, with no subscription. Each request can return up to two tracks, and failed tasks are not charged. Check the API pricing page for current rates.
Can I use my MusicGeneratorAI credits or subscription with the API?
No. The API is billed separately. MusicGeneratorAI plans cover the web app, while API usage is paid through your API account balance.
Can I generate instrumentals and use my own lyrics?
Yes. Use custom mode to send your own lyrics, title and style, or turn on instrumental mode to generate music without vocals.
Do I need to keep a connection open while a song is generated?
No. Generation is asynchronous: you receive a task ID immediately, then either poll the task endpoint or provide a callback URL to be notified when the tracks are ready.
Start building with the AI Music Generator API
Create an API key in minutes and generate your first song with a single request.
Get API Key