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



## 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 280 characters for guaranteed results, but
                    detailed—the clearer and more descriptive it is, the better
                    the outcome.
                music_style:
                  type: string
                  description: Style of music to generate (e.g., Rock, Pop)
                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
                gender:
                  type: string
                  description: Gender of the voice model
                voice_id:
                  type: string
                  description: Voice model to convert generated audio
                generate_album_cover:
                  type: boolean
                  description: Whether to generate an album cover for the generated audio
                  default: false
                model:
                  type: string
                  description: Model version to use for generation
                  enum:
                    - v6
                    - v6-pro
                    - v7
                    - v7-pro
                webhook_url:
                  type: string
                  description: URL for callback upon completion
      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
              example:
                success: true
                message: Message published to queue
                task_id: 4fc2cdba-005d-4d14-a208-5fb02a2809da
                conversion_id_1: 05092d5c-f8b1-4c96-a4a3-45bc00de6268
                conversion_id_2: 52fcd3b6-3925-41ed-b4c6-aee17a29e40b
                eta: 154
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
              example:
                success: false
                error: Insufficient credit balance
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
              example:
                success: false
                error: Internal Server Error
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: |-
            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",
                "music_style": "Lo-fi",
                "lyrics": "It's a brand new day",
                "make_instrumental": False,
                "vocal_only": False,
                "voice_id": "e1cb7380-e3db-433a-b186-a996d7545986",
                "title": "My Generated Track",
                "gender": "female",
                "generate_album_cover": False,
                "model": "v7-pro",
                "webhook_url": "https://example.com/my-webhook"
            }

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

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

````