---
title: "Generate a Song from an Image"
method: POST
path: "/v1/image_to_song"
---

# Generate a Song from an Image

`POST /v1/image_to_song`

## Request

- Base URL: `https://api.musicgpt.com/api/public`
- URL: `https://api.musicgpt.com/api/public/v1/image_to_song`
- Auth: API key in header `Authorization`

Generate a song from an image by analyzing it and creating music based on visual content. The process can optionally include custom lyrics, voice conversion, and various musical parameters.

## Request body `multipart/form-data`

- union
  - object
    - `image_file` string, binary, 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.
    - `prompt` string: Additional prompt to guide the song generation from the image.
    - `lyrics` string: Custom lyrics to include in the generated audio.
    - `negative_tags` string: Tags or themes to avoid in the song.
    - `make_instrumental` boolean: Generate instrumental output only. Lyrics will be ignored.
    - `vocal_only` boolean: Generate vocal-only output.
    - `key` string: Musical key for the song.
    - `bpm` integer: Beats per minute for the song tempo. Defaults to 0 (auto-selected).
    - `webhook_url` string: Optional callback URL for async processing results.
    - `voice_id` string: Voice ID for converting the generated audio. Cannot be used with vocal_only mode.
  - object
    - `image_file` string, binary: Image file to upload and analyze. Supported formats: JPEG, PNG, GIF, BMP, WEBP.
    - `image_url` string, required: URL of the image to analyze. Either this or image_file must be provided.
    - `prompt` string: Additional prompt to guide the song generation from the image.
    - `lyrics` string: Custom lyrics to include in the generated audio.
    - `negative_tags` string: Tags or themes to avoid in the song.
    - `make_instrumental` boolean: Generate instrumental output only. Lyrics will be ignored.
    - `vocal_only` boolean: Generate vocal-only output.
    - `key` string: Musical key for the song.
    - `bpm` integer: Beats per minute for the song tempo. Defaults to 0 (auto-selected).
    - `webhook_url` string: Optional callback URL for async processing results.
    - `voice_id` string: Voice ID for converting the generated audio. Cannot be used with vocal_only mode.

## Response `200`

Successfully initiated image-to-song task

- object
  - `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

## Other responses

- `422`: Validation Error / Unprocessable Content
- `500`: Internal Server Error

---

[API](https://skmtc.dev/musicgpt/apis/musicgpt-api.md) - [All operations](https://skmtc.dev/musicgpt/apis/musicgpt-api/llms.txt) - [OpenAPI document](https://skmtc.dev/musicgpt/apis/musicgpt-api/revisions/6753dccf4c5d?raw)
