Skip to main content

Text-to-Music

POST /api/v1/music/text2music

Generate complete musical compositions with vocals from text prompts and lyrics.
from audiopod import AudioPod

client = AudioPod(api_key="ap_your_api_key")

# Generate a pop song with lyrics
job = client.music.song(
    prompt="upbeat pop, female vocals, catchy melody, electronic beats",
    lyrics="""[Verse 1]
Walking down the street on a sunny day
Everything feels right in every way

[Chorus]
This is our time to shine
Leave the worries behind
Dancing through the night
Everything's gonna be alright""",
    duration=120,
    wait_for_completion=True
)
print(f"Music URL: {job['output_url']}")

# Advanced generation with AudioMusic V2 parameters
job = client.music.generate(
    prompt="epic orchestral soundtrack with dramatic crescendos",
    task="text2music",
    duration=180,
    inference_steps=64,
    guidance_scale=10.0,
    thinking=True,
    generate_lrc=True,
    format="flac",
    wait_for_completion=True
)
Request Parameters:
ParameterTypeRequiredDescription
captionstringYesText description of desired music style (0-2048 chars). Also accepts prompt
lyricsstringNoSong lyrics with structure tags: [verse], [chorus], [bridge], [intro], [outro], [Instrumental]
instrumentalboolNoIf true, ignores lyrics and generates instrumental. Default: false
genre_presetstringNoGenre preset name (see Overview)
display_namestringNoCustom name for the track
+ all base parameters
Response: MusicGenerationResponse with job object and message.

Instrumental Generation

POST /api/v1/music/prompt2instrumental

Create instrumental tracks without vocals from text prompts.
client = AudioPod(api_key="ap_your_api_key")

job = client.music.instrumental(
    prompt="chill jazz instrumental with piano and saxophone",
    duration=90,
    wait_for_completion=True
)
print(f"Instrumental URL: {job['output_url']}")
Request Parameters:
ParameterTypeRequiredDescription
promptstringYesText description of desired instrumental
genre_presetstringNoGenre preset name
display_namestringNoCustom name for the track
+ all base parameters

Rap Generation

POST /api/v1/music/text2rap

Generate rap music with custom lyrics and beats.
client = AudioPod(api_key="ap_your_api_key")

job = client.music.rap(
    prompt="hard-hitting trap beat with heavy bass and 808s",
    lyrics="""[Verse 1]
Started from the bottom now we here
Grinding every day throughout the year
Making moves, breaking through the ceiling
Got that feeling, no time for healing

[Chorus]
This is our time to shine
Leaving all the doubt behind
Every step we take is gold
Watch the story unfold""",
    duration=120,
    wait_for_completion=True
)
print(f"Rap URL: {job['output_url']}")
Request Parameters: Same as Text-to-Music. Lyrics are recommended for best results.

Vocals Generation

POST /api/v1/music/lyric2vocals

Generate vocal tracks from lyrics without full instrumental backing.
job = client.music.generate(
    prompt="female pop vocals with emotional delivery",
    task="lyric2vocals",
    lyrics="[Verse 1]\nWalking through the city lights\nEverything feels so bright",
    duration=90,
    wait_for_completion=True
)

Sample Generation

POST /api/v1/music/text2samples

Create audio loops, one-shots, and samples for music production.
job = client.music.generate(
    prompt="analog drum loop with vintage character, 120 BPM",
    task="text2samples",
    duration=8,
    wait_for_completion=True
)
Additional Parameters:
ParameterTypeDefaultDescription
sample_typestringnullType of sample: loop, one-shot
tempointnullTarget tempo in BPM (60-200)
Note: Maximum duration for samples is 120 seconds.

Simple Mode

POST /api/v1/music/simple

The easiest way to generate music. Describe what you want in natural language and AudioMusic V2 automatically generates the caption, lyrics, BPM, key, time signature, and duration.
from audiopod import AudioPod

client = AudioPod(api_key="ap_your_api_key")

# Just describe what you want
job = client.music.simple(
    query="energetic K-pop dance track with catchy hooks and a powerful chorus",
    wait_for_completion=True
)
print(f"Music URL: {job['output_url']}")

# Instrumental with language preference
job = client.music.simple(
    query="epic cinematic trailer music with orchestral elements",
    instrumental=True,
    wait_for_completion=True
)

# Specify language for vocals
job = client.music.simple(
    query="a romantic ballad about lost love",
    vocal_language="ja",  # Japanese
    wait_for_completion=True
)
Request Parameters:
ParameterTypeRequiredDefaultDescription
querystringYesNatural language description of desired music (1-1000 chars)
instrumentalboolNofalseGenerate instrumental only
vocal_languagestringNo"unknown"Vocal language code (auto-detected if "unknown")
display_namestringNonullCustom name for the track
durationfloatNo-1Duration in seconds (-1 for auto)
formatstringNo"flac"Output format
How Simple Mode Works: AudioMusic V2 uses Chain-of-Thought reasoning to automatically:
  1. Generate a detailed caption/tags from your natural language query
  2. Write lyrics (unless instrumental)
  3. Determine optimal BPM, musical key, and time signature
  4. Estimate appropriate duration
This makes Simple Mode ideal for non-musicians who want to quickly generate high-quality music.

Response Format

All generation endpoints return the same response structure:
{
  "job": {
    "id": 123,
    "task": "text2music",
    "status": "PENDING",
    "progress": null,
    "output_url": null,
    "output_urls": null,
    "display_name": "My Pop Song",
    "audio_duration": 120.0,
    "created_at": "2026-01-15T10:30:00Z",
    "user_id": "user_123"
  },
  "message": "Text-to-music generation started"
}
Completed Job (poll GET /jobs/{id}/status):
{
  "id": 123,
  "task": "text2music",
  "status": "COMPLETED",
  "progress": 100,
  "output_url": "https://media.audiopod.ai/music/123.flac",
  "output_urls": {
    "flac": "https://media.audiopod.ai/music/123.flac",
    "mp3": "https://media.audiopod.ai/music/123.mp3",
    "wav": "https://media.audiopod.ai/music/123.wav"
  },
  "audio_duration": 120.5,
  "actual_seeds": [12345],
  "lrc_content": "[00:00.00] Walking down the street...",
  "quality_score": 0.87,
  "display_name": "My Pop Song",
  "created_at": "2026-01-15T10:30:00Z",
  "completed_at": "2026-01-15T10:32:15Z"
}