Interface MusicGenerateRequest

Request payload for music generation from a text prompt.

Passed to IAudioGenerator.generateMusic by the high-level orchestration layer after normalising user input.

Example

const request: MusicGenerateRequest = {
prompt: 'Upbeat lo-fi hip hop beat with vinyl crackle and mellow piano',
durationSec: 60,
outputFormat: 'mp3',
};
interface MusicGenerateRequest {
    prompt: string;
    modelId?: string;
    durationSec?: number;
    negativePrompt?: string;
    outputFormat?: AudioOutputFormat;
    seed?: number;
    n?: number;
    userId?: string;
    providerOptions?: Record<string, unknown>;
}

Properties

prompt: string

Text prompt describing the desired musical composition.

Quality and specificity of the prompt directly influence output quality. Include genre, mood, instrumentation, and tempo for best results.

modelId?: string

Model identifier to use for generation.

When omitted the provider falls back to its IAudioGenerator.defaultModelId.

durationSec?: number

Desired output duration in seconds.

Provider limits vary: Suno caps at ~240s, Stable Audio at ~47s. Exceeding the limit may result in truncation or an error.

negativePrompt?: string

Negative prompt describing musical elements to avoid.

Not all providers support negative prompts — unsupported values are silently ignored by the adapter.

outputFormat?: AudioOutputFormat

Output audio format.

Default

'mp3'
seed?: number

Seed for reproducible output.

Not all providers honour seeds — check provider documentation.

n?: number

Number of audio clips to generate.

Default

1
userId?: string

Identifier of the requesting user (for billing / rate limiting).

providerOptions?: Record<string, unknown>

Arbitrary provider-specific options.