Skip to main content
POST
Python
Generate a song from an image by analyzing its content and creating music based on visual cues. Users can optionally provide custom lyrics, select a musical key, adjust tempo, or request instrumental/vocal-only outputs.

Endpoint

This endpoint processes an image (uploaded or via URL) to generate a song. The image is analyzed to create a descriptive prompt, which is then used to generate AI-driven music.

Request Parameters

💡 Note: You must provide either audio_file or audio_url — at least one is required.
content-type: multipart/form-data

Try it Yourself

Visit the image_to_song Endpoint Explorer to play around — set your payload, hit send, and listen to the generated results live.

Sample Request

cURL

Python

🔐 Replace {path_to_your_audio_file}, api_key, and webhook_url before executing.

Sample Response

Success (200 OK)


Webhook Delivery

Once the generation is complete, webhooks will be triggered to deliver the following:

Standard Requests :

  • 2 (webhooks) x conversion details (one per version)
  • 2 (webhooks) x Lyrics with timestamp data
  • 1 Album Cover Image
Webhook responses include detailed metadata including task_id, conversion_id, audio files (conversion_path), lyrics etc.

Common Errors

  • 422 Unprocessable Entity: Missing required fields like prompt, replace_start_at, or replace_end_at, or neither audio_file nor audio_url provided.
  • 500 Internal Server Error: An unexpected error occurred during processing.

The response provides a downloadable audio file.

Authorizations

Authorization
string
header
required

Body

multipart/form-data
image_file
file
required

Image file to upload and analyze. Supported formats: JPEG, PNG, GIF, BMP, WEBP.

image_url
string

URL of the image to analyze. Either this or image_file must be provided.

Example:

"https://mybucket.s3.amazonaws.com/image.png"

prompt
string

Additional prompt to guide the song generation from the image.

Maximum string length: 300
Example:

"Generate a relaxing acoustic track inspired by this scene."

lyrics
string

Custom lyrics to include in the generated audio.

Maximum string length: 3000
Example:

"Let the colors of the sunset fill your heart."

negative_tags
string

Tags or themes to avoid in the song.

Example:

"no heavy metal, avoid loud drums"

make_instrumental
boolean
default:false

Generate instrumental output only. Lyrics will be ignored.

vocal_only
boolean
default:false

Generate vocal-only output.

key
string

Musical key for the song.

Example:

"C major"

bpm
integer
default:0

Beats per minute for the song tempo. Defaults to 0 (auto-selected).

webhook_url
string

Optional callback URL for async processing results.

Example:

"https://example.com/webhook"

voice_id
string

Voice ID for converting the generated audio. Cannot be used with vocal_only mode.

Response

Successfully initiated image-to-song task

success
boolean
message
string
task_id
string
conversion_id_1
string
conversion_id_2
string
eta
integer

Estimated processing time in seconds

credit_estimate
number<float>