Perfect Corp. has released the AI Music Generator API, an AI music generation API that turns a song idea, your own lyrics, a music style, or any mix of the three into a complete song. Each task returns a finished mp3 together with a cover image, an auto-generated title, the final lyrics and a synchronized lyrics timeline, so your app gets everything it needs to play, display and share the song.
It is also the first API in the new AI Music category of the YouCam API. Below you will find what the API returns, which inputs you can control, how a request works from start to finish, and how to test it today.
Table of Contents
- What the AI Music Generator API Does
- Songs with Vocals vs. Instrumental Music
- Inputs You Can Control
- Supported Lyrics Languages
- How It Works: From Request to Finished Song
- What You Can Build with a Music Generation API
- How to Get Started: Playground, API Key and Pricing
- What's Next in the AI Music Category
- FAQ
- Conclusion
What the AI Music Generator API Does
The AI Music Generator API is a text to music API: you describe the song in text, and the API composes it. There is no image or audio input, so you don't upload files or create a file before running a task. You send a theme, lyrics or both, add an optional music style, and receive one complete song per task.

Every successful task returns these results:
| Result | What you get |
|---|---|
| Song | A download URL for the generated song in mp3 format |
| Cover image | A download URL for the cover image in jpg format (currently one image per song) |
| Title | A song title generated for you |
| Lyrics | The final lyrics of the song (empty for instrumental music) |
| Duration | The length of the song in seconds |
| Lyrics timestamps | Synchronized lyrics in LRC format, such as [00:08.54] followed by the line (empty for instrumental music) |
The song and cover URLs stay valid for 2 hours, so download and store the files you want to keep.
Songs with Vocals vs. Instrumental Music
The API creates two types of songs. A song with vocals has a singer and lyrics. Instrumental music has no vocals and no lyrics, which makes it a good fit for background music. You choose the type with the instrumental setting.
| Song type | Song with vocals | Instrumental music |
|---|---|---|
| Setting | instrumental: false (default) | instrumental: true |
| Required input | An idea, lyrics, or both | An idea |
| Vocal choice | Female or male | Not used |
| Lyrics and timestamps | Returned | Empty |
If you only send an idea for a song with vocals, the API writes the lyrics for you. If you send your own lyrics, they become the song's lyrics.
Inputs You Can Control
All style settings are optional, so you can start with a single sentence and add detail when you need more control over the result.
| Input | Limit | What it does |
|---|---|---|
| idea | Up to 500 characters | The theme of the song, for example a song about a small café that stays open late. Required for instrumental music. |
| lyrics | Up to 3,000 characters | Your own lyrics. Section tags such as [intro], [verse], [chorus] and [outro] are supported. |
| music_style.genre | Up to 100 characters | The genre, for example Acoustic Pop or Lo-fi Hip Hop |
| music_style.mood | Up to 100 characters | The mood, for example calm or uplifting |
| music_style.vocal | female or male | The singer's voice type. Ignored for instrumental music. |
| music_style.description | Up to 300 characters | Other details such as instruments or rhythm, for example soft piano and brushed drums |
| instrumental | true or false | Set to true for music with no vocals and no lyrics. The default is false. |
Section tags help you shape the structure of a song with vocals. For example, a short [verse] followed by a repeated [chorus] tells the API where the hook belongs.
Supported Lyrics Languages
The AI Music Generator API supports lyrics in 12 languages: English, Japanese, Korean, Portuguese, Spanish, German, French, Italian, Traditional Chinese, Simplified Chinese, Hindi and Turkish.
To get lyrics in a specific language, ask for it in the idea, for example "a song about a small café that stays open late, with Japanese lyrics." You can also write your lyrics directly in the language you want.
How It Works: From Request to Finished Song
The API runs on the YouCam API 2.0 architecture and works as an asynchronous task, so your app doesn't wait while the song is being composed. The full workflow takes three steps.
1. Create a task
Send a POST request to /s2s/v2.0/task/ai-song with your idea, lyrics and music style. The response returns a task_id. The AI Music Generator API documentation has ready-to-copy request examples in cURL, Python, Node.js, JavaScript and other languages.
2. Wait for the result
Use the task_id to check the task at /s2s/v2.0/task/ai-song/{task_id} until its status is success or error. The documentation recommends webhooks when they are available for your integration, and otherwise polling at regular intervals, for example every 10 seconds.
3. Retrieve the song
A successful task returns the song URL, the cover image URL, the title, the lyrics, the duration and the LRC timestamps. Download the files within 2 hours, then use them in your app, your editor or your content pipeline.
If a request is missing the required input, for example no idea for instrumental music, or a field is longer than its limit, the API returns an invalid_parameter error that explains what to fix.
No code needed to start
Write an idea or lyrics, pick a style and generate a song in the API Playground.
What You Can Build with a Music Generation API
Because every song comes with a title, cover image and timed lyrics, the API fits products where people create, edit or share content. Here are a few ideas:
- Background music for video and vlog editors: let users describe the vibe of a clip and add an instrumental track that matches it.
- Personalized songs in social and creator apps: turn a birthday message, a travel memory or a fan's own lyrics into a song with its own cover art.
- Lyric display and sing-along features: use the LRC timestamps to highlight each line as the song plays.
- Marketing and content teams: create quick song drafts for campaigns, short videos or product teasers from a one-line brief.
- Multilingual products: generate lyrics in any of the 12 supported languages for different markets.

If you are building with AI agents or the command line, the YouCam API can also be used outside your own code. Read how the YouCam API CLI works, or see the MCP documentation.
How to Get Started: Playground, API Key and Pricing
The fastest way to hear the results is the API Playground. Open AI Music Generator under the Audio category, choose Vocals & Instrumental or Instrumental Only, enter a song idea or lyrics, and set the genre, mood and vocal. The Playground shows the request payload and code samples in several languages, and new users can test the API with free trials.

When you are ready to integrate, follow these steps:
- Get your API key in the YouCam API Console.
- Try your own ideas and lyrics in the AI Music Generator API Playground.
- Follow the API documentation to create tasks and retrieve results in your app.
See the YouCam API pricing page for unit plans.
What's Next in the AI Music Category
The AI Music Generator API is the first of several audio APIs. These are coming soon to the same category:
- AI Text to Speech (coming soon)
- AI Speech to Text (coming soon)
- AI Audio Denoise (coming soon)
Looking for other recent launches? See the AI Watermark Removal API and the AI Retake API for fixing facial expressions in photos.
FAQ
What is an AI music generation API?
It is an API that composes music from text input. With the AI Music Generator API, you send a song idea, lyrics and an optional music style, and you get back a complete song in mp3 with a cover image, title, lyrics and timed lyrics.
How do I get an API key for the AI Music Generator API?
Sign in to the YouCam API Console and create a key under API Keys. You can use the same key in the API Playground and in your own code.
Can I try the AI Music Generator API for free?
Yes. The API Playground includes free trials, so you can generate test songs before you integrate the API.
Can I use my own lyrics?
Yes. Send up to 3,000 characters of lyrics, with section tags such as [verse] and [chorus] if you want to control the structure. You can also send only an idea and let the API write the lyrics.
Can the API create music without vocals?
Yes. Set instrumental to true and include an idea. The song has no vocals and no lyrics, and the vocal setting is ignored.
Do I need to upload an audio file?
No. The API has no image or audio input, so there is no file upload step. You only send text.
What file formats does the API return?
The song is an mp3 and the cover image is a jpg. Both download URLs are valid for 2 hours.
How much does it cost?
A song with vocals consumes different units than just an instrumental music. For more information check the YouCam API pricing page for unit plans.
Conclusion
The AI Music Generator API gives your product a full song from a single text request: the mp3, a cover image, a title, the lyrics and synchronized timestamps, in 12 lyrics languages and with or without vocals. Start in the Playground to hear what it creates, then add it to your app with one task endpoint, and watch the AI Music category for the text to speech, speech to text and audio denoise APIs coming next.
Songs from ideas and lyrics
Create your API key in the YouCam API Console and generate your first song.
This article was edited and reviewed by the Perfect Corp. editorial team. Welcome to contact us or give us more suggestions.
Author: 


