> ## 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.

# Music AI V2

> Create music powered by AI using just a prompt, lyrics, or a defined music style.

**Music AI v2** is our most advanced music generation model yet, faster generation, higher-quality audio, sharper prompt understanding, and more creative control than any version before it.

## Choose your model

> [card] [v6](https://docs.musicgpt.com/api-documentation/index/pricing.md)
>
> Studio-quality tracks in seconds, reliable, fast, and built for everyday creation.

> [card] [v6-pro](https://docs.musicgpt.com/api-documentation/index/pricing.md)
>
> Everything in v6, now with real-time streaming so listeners hear the track as it's composed.

> [card] [v7](https://docs.musicgpt.com/api-documentation/index/pricing.md)
>
> Our best-sounding model yet, richer detail, more texture, state-of-the-art quality.

> [card] [v7-pro](https://docs.musicgpt.com/api-documentation/index/pricing.md)
>
> The full power of v7 with real-time streaming and advanced creative controls. Our flagship.

> [!TIP]
>
> New here? Reach for **v7-pro** for the best quality, or drop to **v6** for the fastest, most economical generations.

### Model comparison

| Model | Audio quality | Streaming | Best for |
| - | - | - | - |
| `v6` | Very good | - | Fast, dependable everyday tracks |
| `v6-pro` | Very good | Real-time | Live, as-it-generates playback |
| `v7` | Best-in-class | - | Highest-quality final renders |
| `v7-pro` | Best-in-class | Real-time | Production apps that want everything |

Pass your choice with the `model` parameter (`v6`, `v6-pro`, `v7`, or `v7-pro`). Streaming is available on the `pro` models for paid users. Per-model rates are listed on the [Pricing page](https://docs.musicgpt.com/api-documentation/index/pricing.md).

> [!NOTE]
>
> If you provide a `voice_id` or set `vocal_only` to true, the request will always use the `v6` model, regardless of the value passed in the `model` parameter.

### Key features

* Compose custom songs using your own lyrics and chosen music style
* Generate complete tracks from a single prompt, including lyrics, instrumentation, and melody
* Apply voice conversion using a custom voice model
* Output full tracks, instrumental-only, or vocal-only versions
* View the live streaming of the song as it generates (`pro` models)
* Asynchronous webhook support for clean integration

> [!NOTE]
>
> Every request returns **two distinct versions** of the track, so you always have a creative option to choose from.

***

## Endpoint

```http theme={null}
POST /v2/MusicAI
```

This is the primary endpoint for initiating music generation.

***

## Sample Output

Listen to a real sample output:

Prompt: a song about greenery, nature and forest.
<audio controls="1" controlslist="nodownload nofullscreen noremoteplayback" src="https://cdn1.musicgpt.com/conversions/api/standard/f6164ad3-ac5d-50a5-a446-2fb882087fd4/f6164ad3-ac5d-50a5-a446-2fb882087fd4.mp3">Your browser does not support the audio playback.</audio>

[Download Audio](https://cdn1.musicgpt.com/conversions/api/standard/f6164ad3-ac5d-50a5-a446-2fb882087fd4/f6164ad3-ac5d-50a5-a446-2fb882087fd4.mp3)

***

## Try It Yourself

Use the [MusicAI Endpoint Explorer](https://docs.musicgpt.com/api-documentation/endpoint/Musicaiv2.md) to test your own requests using prompts, lyrics, and more.

> Each request returns **two distinct versions** of the track.

***

## Request Parameters

| Parameter | Type | Required | Default | Description |
| - | - | - | - | - |
| `prompt` | String | Optional | - | A natural language prompt for music generation |
| `title` | String | Optional | - | Title of the generated music |
| `music_style` | String | Optional | - | Musical style or genre (e.g., Rock, Pop, Lo-fi) |
| `negative_tags` | String | Optional | "" | Tags or themes you want to avoid in the song (e.g., "sad", "slow") |
| `lyrics` | String | Optional | "" | Custom lyrics to use in the song |
| `make_instrumental` | Boolean | Optional | false | If true, generate instrumental-only audio |
| `vocal_only` | Boolean | Optional | false | If true, generate vocals without instruments |
| `voice_id` | String | Optional | "" | Apply voice model for vocal rendering |
| `generate_album_cover` | Boolean | Optional | false | If `true`, generate an album cover for the generated audio |
| `lyrics_timestamps` | Boolean | Optional | false | If true, generates lyric timestamps for the output track |
| `model` | String | Optional | "v6" | Allowed values: `v6`, `v6-pro`, `v7`, `v7-pro` |
| `webhook_url` | String | Optional | "" | URL to receive generated results via webhook |
| `gender` | String | Optional | "" | Allowed values: male, female, neutral. |

> **content-type:** application/json

***

## Generation Modes

### Custom Mode

Provide your own `lyrics` and use `prompt` to describe the genre, vibe, instrumentation, and context. See the [Prompt Guideline](https://docs.musicgpt.com/api-documentation/utilities/prompt_guideline.md).

### Prompt Mode

Supply only a `prompt` and let the system generate everything: lyrics, style, vocals, and more.

***

## Webhook Delivery

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

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

* 2 (webhook) x Music conversion details (one per version)
* 2 (webhook) x Lyrics with timestamp data
* 2 (webhook) x Streaming URL
* 1 (webhook) x Album cover image

#### Instrumental-only Requests:

* 2 (webhook) x Music conversion details (one per version)
* 2 (webhook) x Streaming URL
* 1 (webhook) x Album cover image

> Webhook responses include detailed metadata including task\_id, conversion\_id, audio files (conversion\_path), lyrics etc.

***

## Sample Request (Python)

```python theme={null}
import requests

url = "https://api.musicgpt.com/api/public/v2/MusicAI"

headers = {
    "Authorization": "<API_KEY>",
    "Content-Type": "application/json"
}

payload = {
    "prompt": "Create a relaxing lo-fi song for studying",
    "lyrics": "It's a brand new day",
    "negative_tags" : "sad",
    "make_instrumental": False,
    "vocal_only": False,
    "title": "My Generated Track",
    "gender": "female",
    "generate_album_cover": True,
    "lyrics_timestamps": True,
    "model": "v7-pro",
    "webhook_url": "https://example.com/my-webhook"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

***

## Sample Response

```json theme={null}
{
  "success": true,
  "message": "Message published to queue",
  "task_id": "50c04348-7077-5ffd-a407-55f031db20ef",
  "eta": 154,
  "conversion_id_1": "5a2c6385-e2e1-5531-a530-aab3ff040a3c",
  "conversion_id_2": "e3c65d75-d1fd-549c-9e63-4b303a01cd23",
  "is_flagged": false,
  "reason": "",
  "credit_estimate": 0.06
}
```

***

## Webhook Sample Payload

Music AI Webhook

```json theme={null}
{
  "success": true,
  "conversion_type": "Music AI",
  "task_id": "c287cca4-c03a-5074-b16a-b8da9d6a124c",
  "conversion_id": "8725079f-bf68-5098-a6c8-6dcba44dcaa2",
  "conversion_path": "https://cdn1.musicgpt.com/conversions/api/standard/8725079f-bf68-5098-a6c8-6dcba44dcaa2/8725079f-bf68-5098-a6c8-6dcba44dcaa2.mp3",
  "conversion_path_wav": "https://cdn1.musicgpt.com/conversions/api/hq/8725079f-bf68-5098-a6c8-6dcba44dcaa2/8725079f-bf68-5098-a6c8-6dcba44dcaa2.wav",
  "conversion_duration": 155.95,
  "is_flagged": false,
  "reason": "",
  "lyrics": "[Verse]\nTurn up the sound\nLet the rhythm take control\nFeel every beat\nMoving through my soul\nLights are shining bright\nAnd we lose track of time\n\n[Chorus]\nMusic in the air\nDancing through the night\nEvery beat we share\nMakes everything feel right\nTurn it up again\nLet the whole world sing",
  "lyrics_timestamped": "[{\"start\": 9880, \"end\": 35120, \"text\": \"[Verse]\", \"index\": 0}, {\"start\": 9880, \"end\": 10720, \"text\": \"Turn up the sound\", \"index\": 1}, {\"start\": 13720, \"end\": 15600, \"text\": \"Let the rhythm take control\", \"index\": 2}, {\"start\": 19200, \"end\": 20400, \"text\": \"Feel every beat\", \"index\": 3}, {\"start\": 23480, \"end\": 25400, \"text\": \"Moving through my soul\", \"index\": 4}, {\"start\": 29520, \"end\": 31440, \"text\": \"Lights are shining bright\", \"index\": 5}, {\"start\": 33320, \"end\": 35120, \"text\": \"And we lose track of time\", \"index\": 6}, {\"start\": 39640, \"end\": 54320, \"text\": \"[Chorus]\", \"index\": 7}, {\"start\": 39640, \"end\": 40120, \"text\": \"Music in the air\", \"index\": 8}, {\"start\": 41800, \"end\": 42560, \"text\": \"Dancing through the night\", \"index\": 9}, {\"start\": 44320, \"end\": 45280, \"text\": \"Every beat we share\", \"index\": 10}, {\"start\": 45600, \"end\": 47440, \"text\": \"Makes everything feel right\", \"index\": 11}, {\"start\": 49240, \"end\": 49920, \"text\": \"Turn it up again\", \"index\": 12}, {\"start\": 51720, \"end\": 54320, \"text\": \"Let the whole world sing\", \"index\": 13}]",
  "title": "Rhythm Take Control",
  "album_cover_path": "https://cdn1.musicgpt.com/img-gen-pipeline/api/c287cca4-c03a-5074-b16a-b8da9d6a124c.jpg",
  "subtype": "music_ai"
}
```

Audio Streaming Webhook

```json theme={null}
{
  "success": true,
  "conversion_type": "Music AI",
  "subtype": "audio_streaming",
  "task_id": "80659560-54e7-5e59-a0a0-86320e92701b",
  "conversion_id": "10cfbe38-572a-5218-8981-5aa9a73aa8a5",
  "streaming_url": "https://cdn1.musicgpt.com/streams/22e4efb8-c8e7-42d7-a2f1-b094a9a92d24/index.m3u8"
}
```

Album Cover Webhook

```json theme={null}
{
  "success": true,
  "conversion_type": "Music AI",
  "task_id": "5254c422-0fab-53f0-b5e3-36abb69dd111",
  "image_paths": [
    "https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111.jpg"
  ],
  "thumbnail_paths": [
    "https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111_thumb.jpg"
  ],
  "image_path": "https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111.jpg",
  "thumbnail_path": "https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111_thumb.jpg",
  "conversion_id_1": "eba76eae-9c77-5b09-9f2b-96a8bdef0f36",
  "conversion_id_2": "1cf119ce-a78c-500b-ad43-4b1f598507cb",
  "album_cover_generator_output": true,
  "subtype": "album_cover_generation"
}
```

Lyrics Timestamp Webhook

```json theme={null}
{
  "success": true,
  "conversion_type": "Music AI",
  "task_id": "c287cca4-c03a-5074-b16a-b8da9d6a124c",
  "conversion_id": "8725079f-bf68-5098-a6c8-6dcba44dcaa2",
  "subtype": "lyrics_timestamped",
  "lyrics_timestamped": "[{\"start\": 9880, \"end\": 35120, \"text\": \"[Verse]\", \"index\": 0}, {\"start\": 9880, \"end\": 10720, \"text\": \"Turn up the sound\", \"index\": 1}, {\"start\": 13720, \"end\": 15600, \"text\": \"Let the rhythm take control\", \"index\": 2}, {\"start\": 19200, \"end\": 20400, \"text\": \"Feel every beat\", \"index\": 3}, {\"start\": 23480, \"end\": 25400, \"text\": \"Moving through my soul\", \"index\": 4}, {\"start\": 29520, \"end\": 31440, \"text\": \"Lights are shining bright\", \"index\": 5}, {\"start\": 33320, \"end\": 35120, \"text\": \"And we lose track of time\", \"index\": 6}, {\"start\": 39640, \"end\": 54320, \"text\": \"[Chorus]\", \"index\": 7}, {\"start\": 39640, \"end\": 40120, \"text\": \"Music in the air\", \"index\": 8}, {\"start\": 41800, \"end\": 42560, \"text\": \"Dancing through the night\", \"index\": 9}, {\"start\": 44320, \"end\": 45280, \"text\": \"Every beat we share\", \"index\": 10}, {\"start\": 45600, \"end\": 47440, \"text\": \"Makes everything feel right\", \"index\": 11}, {\"start\": 49240, \"end\": 49920, \"text\": \"Turn it up again\", \"index\": 12}, {\"start\": 51720, \"end\": 54320, \"text\": \"Let the whole world sing\", \"index\": 13}]"
}
```

> Note: Each `conversion_id` corresponds to a different variation of the track.

***

## Payload and Request Formation


## OpenAPI

````yaml POST /v2/MusicAI
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:
  /v2/MusicAI:
    post:
      summary: Generate Custom Music
      description: >-
        Create music powered by AI using just a prompt, lyrics, or a defined
        music style.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: >-
                    A natural language prompt for music generation. Keep it
                    under 1000 characters. Be clear and descriptive for better
                    results.
                  example: A happy, upbeat song about summer
                music_style:
                  type: string
                  description: Style of music to generate (e.g., Rock, Pop)
                negative_tags:
                  type: string
                  description: >-
                    Tags or themes you want to avoid in the song (e.g., sad,
                    slow)
                lyrics:
                  type: string
                  description: Custom lyrics for the generated music
                make_instrumental:
                  type: boolean
                  description: Whether to make the music instrumental
                  default: false
                vocal_only:
                  type: boolean
                  description: Whether to generate only vocals of output audio
                  default: false
                title:
                  type: string
                  description: Title of the generated music track
                  example: My Generated Track
                gender:
                  type: string
                  description: Gender of the voice model
                  example: ''
                voice_id:
                  type: string
                  description: Voice model to convert generated audio
                  example: ''
                generate_album_cover:
                  type: boolean
                  description: Whether to generate an album cover for the generated audio
                  default: false
                lyrics_timestamps:
                  type: boolean
                  description: Whether to generate timestamps for the lyrics
                  default: false
                model:
                  type: string
                  description: Model version to use for generation
                  example: v7
                  enum:
                    - v6
                    - v6-pro
                    - v7
                    - v7-pro
                webhook_url:
                  type: string
                  description: URL for callback upon completion
                  example: https://example.com/my-webhook
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  task_id:
                    type: string
                  conversion_id_1:
                    type: string
                  conversion_id_2:
                    type: string
                  eta:
                    type: integer
                  is_flagged:
                    type: boolean
                  reason:
                    type: string
                  credit_estimate:
                    type: number
              example:
                success: true
                message: Message published to queue
                task_id: 50c04348-7077-5ffd-a407-55f031db20ef
                eta: 154
                conversion_id_1: 5a2c6385-e2e1-5531-a530-aab3ff040a3c
                conversion_id_2: e3c65d75-d1fd-549c-9e63-4b303a01cd23
                is_flagged: false
                reason: ''
                credit_estimate: 0.06
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                  message:
                    type: string
              example:
                success: false
                error_code: INSUFFICIENT_CREDITS
                message: ''
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                  message:
                    type: string
              example:
                success: false
                error_code: UNPROCESSABLE_CONTENT
                message: ''
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                  message:
                    type: string
              example:
                success: false
                error_code: INTERNAL_SERVER_ERROR
                message: ''
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.