✨ NEW: Seedream 4.0 Edit - Best Model for Image Editing

MiniMax (Hailuo AI) Music Text to Audio

fal-ai/minimax-music
Generate music from text prompts using the MiniMax model, which leverages advanced AI techniques to create high-quality, diverse musical compositions.
Inference
Commercial use
Partner

Input

Result

Idle

Your request will cost $0.035 per generation.

Logs

Readme

MiniMax Music: AI-Powered Music Generation API

Transform your creative ideas into original music with MiniMax Music, a powerful AI music generation API that helps developers and creators produce high-quality, customizable musical compositions.

Overview

MiniMax Music enables seamless integration of AI-powered music generation into your applications. Whether you're building a creative tool, game soundtrack system, or content creation platform, our API provides the flexibility and control you need.

Key Benefits
  • Create original music compositions with simple text prompts
  • Generate production-ready audio with support for reference tracks
  • Seamlessly integrate with both JavaScript and Python applications
  • Scale efficiently with production-ready API infrastructure
  • Transparent pay-per-use pricing at $0.035 per generation
Getting Started

Getting started with MiniMax Music takes just a few minutes. Here's how:

  1. Install the client library for your platform:

For JavaScript/TypeScript:

bash
npm install --save @fal-ai/client

For Python:

bash
pip install fal-client
  1. Configure your authentication:
javascript
import { fal } from "@fal-ai/client";

fal.config({
  credentials: "YOUR_FAL_KEY_HERE"
});
  1. Make your first API call:
javascript
const result = await fal.subscribe("fal-ai/minimax-music", {
  input: {
    prompt: "Upbeat electronic dance track with strong bass line"
  }
});
Technical Implementation

Our API supports two primary integration patterns:

Synchronous Generation

Perfect for real-time applications where immediate results are needed:

javascript
const generateMusic = async (prompt) => {
  try {
    const result = await fal.subscribe("fal-ai/minimax-music", {
      input: { prompt },
      logs: true,
      onQueueUpdate: (update) => {
        if (update.status === "IN_PROGRESS") {
          update.logs.map((log) => log.message).forEach(console.log);
        }
      }
    });
    return result.audio;
  } catch (error) {
    console.error("Music generation failed:", error);
  }
}
Queue-Based Processing

Ideal for generating multiple compositions or handling larger requests:

javascript
// Submit a request
const { request_id } = await fal.queue.submit("fal-ai/minimax-music", {
  input: { 
    prompt: "## Fast and Limitless\nIn the heart of the code, where dreams collide,\nFAL's the name, taking tech for a ride.\nGenerative media, blazing the trail,\nFast inference power, we'll never fail.\n##"
  },
  webhookUrl: "https://optional.webhook.url/for/results"
});

// Check status
const status = await fal.queue.status("fal-ai/minimax-music", {
  requestId: request_id,
  logs: true
});

// Get result
const result = await fal.queue.result("fal-ai/minimax-music", {
  requestId: request_id
});
Advanced Features
Reference Audio Support

Use reference tracks to guide the style of your generated music:

javascript
const result = await fal.subscribe("fal-ai/minimax-music", {
  input: {
    prompt: "Your lyrical content here",
    reference_audio_url: "https://your-audio-url.mp3"
  }
});

Reference tracks should be:

  • `.wav` or `.mp3` format
  • Longer than 15 seconds
  • Contain both music and vocals
File Upload Support

Upload local files to use as reference audio:

javascript
import { fal } from "@fal-ai/client";

const file = new File([audioData], "reference.mp3", { type: "audio/mp3" });
const url = await fal.storage.upload(file);

const result = await fal.subscribe("fal-ai/minimax-music", {
  input: {
    prompt: "Your prompt",
    reference_audio_url: url
  }
});
Best Practices

For optimal results with MiniMax Music:

  • Use `##` markers to wrap lyrics in your prompts for better formatting
  • Maximum lyrics length is 400 characters
  • Maximum output duration is 60 seconds
  • Include specific musical style descriptions in your prompts
  • Test different prompt variations to achieve desired outcomes
  • Implement proper error handling for API responses
Input Format

The API accepts the following input parameters:

typescript
{
  prompt: string;  // Your text prompt with lyrics and style description
  reference_audio_url?: string;  // Optional reference track URL
}
Output Format

The API returns:

typescript
{
  audio: {
    url: string;  // URL of the generated audio file
    content_type: string;  // MIME type of the audio
    file_name: string;  // Auto-generated filename
    file_size: number;  // Size in bytes
  }
}
Supported File Types
  • Input (reference audio): `.mp3`, `.wav`, `.ogg`, `.m4a`, `.aac`
  • Output: High-quality audio file
Pricing and Usage
  • Cost: $0.035 per generation
  • Processing time: Varies based on complexity
  • Maximum duration: 60 seconds per generation
  • Maximum lyrics: 400 characters

Our transparent, usage-based pricing scales with your needs. No subscription necessary.

View detailed pricing or contact sales for enterprise solutions.

API Authentication

Set your API key as an environment variable:

bash
export FAL_KEY="your-api-key-here"

Or configure it programmatically:

javascript
import { fal } from "@fal-ai/client";

fal.config({
  credentials: "your-api-key-here"
});

⚠️ Security Note: Never expose your API key in client-side code. Use environment variables or server-side proxy for production applications.

Support and Resources

We're here to help you succeed:

The MiniMax Music API provides the tools you need to integrate AI-powered music generation into your applications. Get started today and transform your creative ideas into reality.

Ready to begin? Sign up for an API key and start generating music in minutes.