v4

OpenAPI 3.1.02026-07-313621,3961.8 MB
music-generation

Generate Composition Plan

Generate a composition plan from a prompt.

post/v1/music/plan

Headers

xi-api-keystring nullable

Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.

Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.

Request body

promptstring required

A simple text prompt to compose a plan from.

music_length_msinteger nullable

The length of the composition plan to generate in milliseconds. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt.

model_id'music_v1' | 'music_v2'

The model to use for the generation.

Example request

{
  "source_composition_plan": {
    "negative_global_styles": [
      "metal",
      "hip-hop",
      "country"
    ],
    "positive_global_styles": [
      "pop",
      "rock",
      "jazz"
    ],
    "sections": [
      {
        "duration_ms": 10000,
        "lines": [
          "Verse 1 lyrics"
        ],
        "negative_local_styles": [
          "metal",
          "hip-hop",
          "country"
        ],
        "positive_local_styles": [
          "pop",
          "rock",
          "jazz"
        ],
        "section_name": "Verse 1"
      }
    ]
  }
}

Response

Successful Response

OR

Example response

{
  "negative_global_styles": [
    "metal",
    "hip-hop",
    "country"
  ],
  "positive_global_styles": [
    "pop",
    "rock",
    "jazz"
  ],
  "sections": [
    {
      "duration_ms": 10000,
      "lines": [
        "Verse 1 lyrics"
      ],
      "negative_local_styles": [
        "metal",
        "hip-hop",
        "country"
      ],
      "positive_local_styles": [
        "pop",
        "rock",
        "jazz"
      ],
      "section_name": "Verse 1"
    }
  ]
}