Retrieve text-to-speech audio clip

December 23, 2024

Table of contents

  1. Request Headers
  2. Path parameter
  3. Responses
  4. Model
  5. Examples
  6. Try It

Please configure at least one www.hailuo.ai account for this endpoint, see Setup MiniMax for details.

This endpoint will return audio clip generated by

https://api.useapi.net/v1/minimax/audio/audio_id

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Path parameter
  • audio_id is required. Specify audio clip you want to retrieve.
Responses
  • 200 OK

    {
        "audio_id": "user:user_id-minimax:account_id-audio:audio_id",
        "audio_review": 0,
        "voice_info": {
            "voice_id": "209533299589184",
            "parent_voice_id": "0",
            "voice_name": "Calm Woman",
            "tag_list": [
                "English",
                "Female",
                "Adult",
                "Audiobook",
                "US (General)"
            ],
            "file_id": "",
            "cover_url": "https://cdn.hailuoai.video/...png",
            "create_time": 1122334455667,
            "update_time": 1122334455668,
            "collected": false,
            "voice_status": 2,
            "sample_audio": "https://cdn.hailuoai.video/...mp3",
            "uniq_id": "English_CalmWoman",
            "group_id": "0"
        },
        "text": "<Text>",
        "audio_url": "https://cdn.hailuoai.video/...mp3",
        "audio_title": "<Title>",
        "create_time": 1122334455667,
        "emotion": "Auto",
        "language_boost": "Auto",
        "speed": 1,
        "pitch": 0,
        "update_time": 0,
        "effects": {
            "deepen_lighten": 0,
            "stronger_softer": 0,
            "nasal_crisp": 0,
            "spacious_echo": true,
            "lofi_telephone": false,
            "robotic": false,
            "auditorium_echo": false
        }
    }
    
  • 400 Bad Request

    {
        "error": "<Error message>",
        "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
Model
{   // TypeScript, all fields are optional
  audio_id: string
  audio_review: number
  voice_info: {
      voice_id: string
      parent_voice_id: string
      voice_name: string
      tag_list: string[]
      file_id: string
      cover_url: string
      create_time: number
      update_time: number
      collected: boolean
      voice_status: number
      sample_audio: string
      uniq_id: string
      group_id: string
  }
  text: string
  audio_url: string
  audio_title: string
  create_time: number
  emotion: string
  language_boost: string
  speed: number
  pitch: number
  update_time: number
  effects: {
      deepen_lighten: number
      stronger_softer: number
      nasal_crisp: number
      spacious_echo: boolean
      lofi_telephone: boolean
      robotic: boolean
      auditorium_echo: boolean
  }
}
Examples
  • curl "https://api.useapi.net/v1/minimax/audio/audio_id" \
       -H "Accept: application/json" \
       -H "Authorization: Bearer …" 
    
  • const token = "API token";
    const audio_id = "audio_id to retrieve"; 
    const apiUrl = `https://api.useapi.net/v1/minimax/audio/${audio_id}`; 
    const response = await fetch(apiUrl, {
      headers: {
        "Authorization": `Bearer ${token}`,
      },
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    audio_id = "audio_id to retrieve"
    apiUrl = f"https://api.useapi.net/v1/minimax/audio/{audio_id}"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    response = requests.get(apiUrl, headers=headers)
    print(response, response.json())
    
Try It