Skip to content

[bug] MiniMax music_generation provider: durationSeconds is not passed to API, silently produces default-length tracks #84508

@NOVA-Openclaw

Description

@NOVA-Openclaw

Summary

The MiniMax music_generation provider in extensions/minimax/music-generation-provider.ts does not pass the requested durationSeconds parameter to the MiniMax API. Instead, it appends a natural-language hint to the prompt text:

// extensions/minimax/music-generation-provider.ts, buildPrompt()
if (typeof req.durationSeconds === "number" && Number.isFinite(req.durationSeconds)) {
  parts.push(`Target duration: about ${Math.max(1, Math.round(req.durationSeconds))} seconds.`);
}

The JSON body sent to /v1/music_generation only includes model, prompt, is_instrumental, lyrics/lyrics_optimizer, output_format, and audio_setting — no duration field. The MiniMax API ignores the prompt-embedded duration hint and returns tracks at its default length (typically 90-120s).

This makes durationSeconds effectively non-functional for the MiniMax music provider, even though the capability advertises it (capabilities: ... duration, format ... from music_generate action=list).

Reproduction

music_generate({
  model: "minimax/music-2.6",
  durationSeconds: 240,
  instrumental: true,
  prompt: "..."
})

Expected: ~240 second track.
Actual: ~109 second track (MiniMax default).

Impact

Any caller depending on duration control via MiniMax silently gets short tracks. For NOVA's daily music pipeline, this defeats the entire reason for routing to MiniMax instead of Google Lyria — both effectively cap at ~2-3 minutes with no caller control.

Proposed Fix

The MiniMax music_generation API (per https://platform.minimax.io/docs) accepts an explicit duration parameter in the JSON request body. The provider should pass durationSeconds through as a structured field instead of (or in addition to) the prompt hint. Suggested change in music-generation-provider.ts:

const body = {
  model,
  prompt: req.prompt.trim(),  // drop the duration-hint append from buildPrompt
  ...(req.instrumental === true ? { is_instrumental: true } : {}),
  ...(lyrics ? { lyrics } : req.instrumental === true ? {} : { lyrics_optimizer: true }),
  ...(typeof req.durationSeconds === "number" && Number.isFinite(req.durationSeconds)
    ? { duration: Math.round(req.durationSeconds) }  // <— add this
    : {}),
  output_format: "url",
  audio_setting: {
    sample_rate: 44_100,
    bitrate: 256_000,
    format: "mp3",
  },
};

Exact field name (duration vs duration_seconds vs length_seconds) should be confirmed against MiniMax's current API spec — their docs are the authoritative source.

Related

Environment

  • OpenClaw: nova-openclaw fork, current main as of 2026-05-20
  • Provider: extensions/minimax/music-generation-provider.ts
  • Model: minimax/music-2.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions