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

# V2 Generate Music

> Music generation task submission endpoints: 
1. Make a request with the required parameters (parameters are described in detail in the schema below). 
2. the endpoint will return the song information, including the song id and audio audition and image routing and task processing status (stream, error, complete). 
3. Song id can query song information and generation status through the query interface. 
4. In particular, do not use the V2 interface for arguments or responses in V1, it is just not allowed



## OpenAPI

````yaml https://api.topmediai.com/topmediai_api.json post /v2/submit
openapi: 3.1.0
info:
  title: Topmediai API Documentation
  description: >-
    This is the documentation for the Topmediai API. You can use this API to use
    our service programmatically, this is done by using your x-api-key. You can
    get your x-api-key by request our Get API Key Web page on
    https://www.topmediai.com/api/text-to-speech-api/. Our API is experimental
    so all endpoints are subject to change.
  version: 1.0.0
servers:
  - url: https://api.topmediai.com
security: []
paths:
  /v2/submit:
    post:
      tags:
        - AI-Music-Generator
      summary: V2 Generate Music
      description: "Music generation task submission endpoints: \r\n1. Make a request with the required parameters (parameters are described in detail in the schema below). \r\n2. the endpoint will return the song information, including the song id and audio audition and image routing and task processing status (stream, error, complete). \r\n3. Song id can query song information and generation status through the query interface. \r\n4. In particular, do not use the V2 interface for arguments or responses in V1, it is just not allowed"
      operationId: submit_v2_submit_post
      parameters:
        - name: x-api-key
          in: header
          required: false
          schema:
            type: string
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MusicV2BodySchemas'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MusicV2BodySchemas:
      properties:
        is_auto:
          type: integer
          maximum: 1
          minimum: 0
          title: Is Auto
          description: >

            is_auto is used to control the use of custom mode or description
            mode:         

            1. is_auto is 1: Description mode, will only use the request
            parameters prompt and model_version, even if you pass other
            parameters, such as lyrics, title, etc., we will not apply them.

            2. is_auto is 0: Custom mode, we will apply all parameters to the
            generation task, including the updated extended song parameters.
          example: 1
        model_version:
          type: string
          enum:
            - v4.5-plus
            - v4.5
            - v4.0
            - v3.5
            - v3.0
          title: Model Version
          description: >-

            v4.5-plus: Generates songs up to 8 minutes long and supports lyrics
            inputs of up to 5,000 words. Leveraging the latest and most powerful
            music generation models, it delivers richer sound quality and faster
            generation speeds.

            v4.5: Generates songs up to 8 minutes long and supports lyrics
            inputs of up to 5,000 words. It boasts studio-quality sound, optimal
            genre fusion, and faster generation speeds.

            v4.0: Generates songs up to 4 minutes long and supports lyrics
            inputs of up to 3,000 words. Songs are more vivid and sound better.

            v3.5: Generates songs up to 4 minutes long and supports lyrics
            inputs of up to 3,000 words. Songs are smoother and more engaging.

            v3.0: Generates songs up to 2 minutes long and supports lyrics
            inputs of up to 1,000 words.
                    
          example: v3.5
        prompt:
          type: string
          maxLength: 180
          minLength: 1
          title: Prompt
          description: >

            The prompt parameter is used to control the melody, tune, style, and
            so on of the entire song.
          example: Happy songs
        lyrics:
          anyOf:
            - type: string
            - type: 'null'
          title: Lyrics
          description: |

            The lyrics parameter controls what the song is about.
          default: ''
          example: Enter the lyrics you've created
          exclude_unset: true
        title:
          anyOf:
            - type: string
              maxLength: 80
            - type: 'null'
          title: Title
          description: |

            Create a title for the song you're writing.
          default: ''
          example: AI Music
          exclude_unset: true
        instrumental:
          anyOf:
            - type: integer
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Instrumental
          description: >

            The instrumental parameter is used to control whether the song is
            pure music or not. When instrumental is set to 1, the lyrics
            parameter will not be applied, even if it is included in your
            request
          default: 0
          example: 0
        continue_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Continue At
          description: >

            The continue_at field is used to implement the song extension
            functionality. This parameter controls the time, in seconds, at
            which the extended song is enabled. Note that when using the
            extension function, the continue_at parameter must not be 0 or
            exceed the song duration, otherwise the request will be considered a
            failure and used in conjunction with continue_song_id.
          default: 0
          example: 0
          exclude_unset: true
        continue_song_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Continue Song Id
          description: >

            The continue_song_id field is used to extend the song. This
            parameter tells us which song you want to extend, and is used in
            conjunction with continue_at.
          default: ''
          example: ''
          exclude_unset: true
      type: object
      required:
        - is_auto
        - model_version
        - prompt
      title: MusicV2BodySchemas
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````