> ## Documentation Index
> Fetch the complete documentation index at: https://docs.musicgpt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Remix

> This endpoint allows users to remix an input audio file or URL using a descriptive prompt, optional lyrics, and a gender selection for vocal tone.

Remix Audio Using Prompt and Optional Lyrics
This endpoint allows users to remix an input audio file or URL using a descriptive prompt, optional lyrics, and a gender selection for vocal tone.

***

## Endpoint

```http theme={null}
POST /Remix
```

***

## Request Parameters

| Parameter     | Type         | Required | Description                                                               |
| ------------- | ------------ | -------- | ------------------------------------------------------------------------- |
| `audio_file`  | `UploadFile` | Optional | Upload the audio file directly. Required if `audio_url` is not provided.  |
| `audio_url`   | `String`     | Optional | Public URL or S3 path to audio. Required if `audio_file` is not provided. |
| `prompt`      | `String`     | ✅ Yes    | Describes how the audio should be transformed.                            |
| `lyrics`      | `String`     | Optional | Lyrics to guide remix or vocal generation. Max 2000 characters.           |
| `gender`      | `String`     | Optional | Vocal tone. One of: `male`, `female`, `neutral`.                          |
| `webhook_url` | `String`     | Optional | Callback URL for async response.                                          |

> 💡**Note:** Either `audio_file` or `audio_url` must be provided.

> **content-type:** multipart/form-data

***

## Sample Output

Listen to a real output:

Prompt: remix in classical slow vibe - audio input : Moana How Far We will Go.
<audio controls="1" controlslist="nodownload nofullscreen noremoteplayback" src="https://lalals.s3.amazonaws.com/conversions/2104a105-2572-4412-b6fb-f67b0382582a.mp3">Your browser does not support the audio playback.</audio>

<a href="https://lalals.s3.amazonaws.com/conversions/2104a105-2572-4412-b6fb-f67b0382582a.wav" target="_blank">Download Audio</a>

***

## Try it Yourself

Use the [Remix Endpoint Explorer](/api-documentation/endpoint/remix) to test this endpoint live.

***

## Sample Request

### cURL

```bash theme={null}
curl -X POST "https://api.musicgpt.com/api/public/v1/Remix" \
-H "accept: application/json" \
-H "Authorization: <api_key>" \
-F "audio_file=@/path/to/your/audio.mp3" \
-F "prompt=Make it sound like Lo-fi with chill beats" \
-F "lyrics=It's a brand new day" \
-F "gender=female" \
-F "webhook_url=https://example.com/my-webhook"
```

### Python

```python theme={null}
import requests

url = "https://api.musicgpt.com/api/public/v1/Remix"
headers = {"Authorization": "<API_KEY>"}
data = {
  "prompt": "Make it sound like Lo-fi with chill beats",
  "lyrics": "It's a brand new day",
  "gender": "female",
  "webhook_url": "https://example.com/my-webhook"
}

# Option 1: audio_url
data["audio_url"] = "https://mybucket.s3.amazonaws.com/song.mp3"
response = requests.post(url, headers=headers, data=data)

# Option 2: File upload
# with open("song.mp3", "rb") as f:
#     files = {"audio_file": f}
#     response = requests.post(url, headers=headers, data=data, files=files)

# print(response.json())
```

***

## Sample Response

### Success (200 OK)

```json theme={null}
{
  "success": true,
  "message": "Remix request submitted successfully",
  "task_id": "task-remix-001",
  "conversion_id_1": "remix-a1b2",
  "conversion_id_2": "remix-c3d4",
  "eta": 42,
  "credit_estimate": 47.5
}
```

***

## Webhook Response

```json theme={null}
{
  "success": true,
  "conversion_type": "Remix",
  "task_id": "task-remix-001",
  "conversion_id": "remix-a1b2",
  "conversion_path": "https://lalals.s3.amazonaws.com/conversions/2104a105-2572-4412-b6fb-f67b0382582a.mp3",
  "conversion_path_wav": "https://lalals.s3.amazonaws.com/conversions/2104a105-2572-4412-b6fb-f67b0382582a.wav",
  "conversion_duration": 162.44,
  "is_flagged": false,
  "reason": "",
  "lyrics": "...",
  "lyrics_timestamped": "..."
}
```

## Webhook Delivery

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

#### Standard Requests (non-instrumental):

* 2 (webhooks) x Remix 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 field `prompt`, or neither `audio_file` nor `audio_url` provided.

* **500 Internal Server Error**
  An error occurred during processing or task queueing.

***

The `/Remix` endpoint produces a downloadable or streamable remixed audio file with optional lyrical overlays and style transformations.

***

## Payload and Request Formation


## OpenAPI

````yaml POST /v1/Remix
openapi: 3.1.0
info:
  title: Musicgpt API
  version: 1.0.0
  description: API for retrieving conversion details by ID.
servers:
  - url: https://api.musicgpt.com/api/public
    description: Production server
security: []
paths:
  /v1/Remix:
    post:
      summary: Remix Audio Using Prompt and Optional Lyrics
      description: >-
        This endpoint allows users to remix an input audio file or URL using a
        descriptive prompt, optional lyrics, and a gender selection for vocal
        tone.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                audio_file:
                  type: string
                  format: binary
                  description: Uploaded audio file to be remixed.
                audio_url:
                  type: string
                  description: URL or S3 path to the input audio.
                  example: https://mybucket.s3.amazonaws.com/song.mp3
                prompt:
                  type: string
                  description: Describes how the audio should be transformed.
                  example: Make it sound like Lo-fi with chill beats
                lyrics:
                  type: string
                  description: Optional lyrics to guide vocal generation.
                  example: It's a brand new day
                  maxLength: 2000
                gender:
                  type: string
                  description: Voice style if vocal content is generated.
                  enum:
                    - male
                    - female
                    - neutral
                  example: female
                webhook_url:
                  type: string
                  description: Callback URL for async processing results.
                  example: https://example.com/my-webhook
              required:
                - prompt
              anyOf:
                - required:
                    - audio_url
                - required:
                    - audio_file
      responses:
        '200':
          description: Successfully initiated remix task
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  task_id:
                    type: string
                  conversion_id_1:
                    type: string
                  conversion_id_2:
                    type: string
                  eta:
                    type: integer
                    description: Estimated processing time in seconds
                  credit_estimate:
                    type: number
                    format: float
                  message:
                    type: string
                example:
                  success: true
                  message: Remix request submitted successfully
                  task_id: task-remix-001
                  conversion_id_1: remix-a1b2
                  conversion_id_2: remix-c3d4
                  eta: 42
                  credit_estimate: 47.5
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Either audio_file or audio_url must be provided.
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Internal Server Error
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: >-
            import requests


            url = "https://api.musicgpt.com/api/public/v1/Remix"

            headers = {"Authorization": "<API_KEY>"}

            data = {
              "prompt": "Make it sound like Lo-fi with chill beats",
              "lyrics": "It's a brand new day",
              "gender": "female",
              "webhook_url": "https://example.com/my-webhook"
            }


            # Option 1: audio_url

            files = {}

            data["audio_url"] = "https://mybucket.s3.amazonaws.com/song.mp3"

            response = requests.post(url, headers=headers, data=data,
            files=files)


            # Option 2: File Upload

            with open("song.mp3", "rb") as f:
                files = {"audio_file": f}
                response = requests.post(url, headers=headers, data=data, files=files)

            print(response.json())
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````