> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Suno Voice Cloning API Integration Guide

> Suno Music Generation 集成指南 - XHuoAPI

SUNO allows us to create custom voice personas from any audio file, enabling voice cloning for music generation. Unlike the existing Persona API (which uses Suno-generated `audio_id`), this API accepts a publicly accessible `audio_url`, i.e., your own voice recording. This document explains how to integrate with the voice cloning API.

## Step 1: Create a Voice Persona

This API has three input parameters: `audio_url` (required), which is a publicly accessible URL to an MP3 or WAV audio file containing a single clear voice; `name` and `description` (optional), which specify the name and description of the voice persona.

**Audio file requirements:**

* Format: MP3 or WAV
* Duration: At least 10 seconds
* Content: Single clear voice, with minimal background noise or music

```bash theme={null}
curl -X POST 'https://api.xhuoapi.ai/v1/suno/voices' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "audio_url": "http://cos.aitutu.cc/mp4/ru-user-voice.mp3",
  "name": "RU User Voice Test",
  "description": "User voice recording example"
}'
```

The response is as follows:

```json theme={null}
{
  "success": true,
  "task_id": "b9150e51-d87c-4556-a55e-100947a63bdf",
  "data": {
    "persona_id": "e95013f8-eaee-4741-a42f-1d559a9d0b2b",
    "name": "RU User Voice Test",
    "is_public": false
  }
}
```

As you can see, the `persona_id` field in `data` is the ID of the created voice persona. The `is_public` field is always `false` because voice personas created by uploading audio are private.

## Step 2: Generate Music Using the Voice Persona

Once you have the voice persona ID, you can use the [Suno Audios Generation API](https://api.xhuoapi.ai/documents/4da95d9d-7722-4a72-857d-bf6be86036e9) to generate music. Set `action` to `generate` and set `persona_id` to the voice persona ID returned above. The generated song will be sung using the cloned voice.

> **Note:** Voice cloning only supports models `chirp-v4-5` and above (such as `chirp-v4-5`, `chirp-v5`, `chirp-v5-5`), and does not support `chirp-v4`.

```bash theme={null}
curl -X POST 'https://api.xhuoapi.ai/v1/suno/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "action": "generate",
  "model": "chirp-v5-5",
  "prompt": "A warm synth-pop song about city nights",
  "persona_id": "e95013f8-eaee-4741-a42f-1d559a9d0b2b"
}'
```

The response is as follows:

```json theme={null}
{
  "success": true,
  "task_id": "53d8a334-a972-43c5-895e-60c4454e88d5",
  "data": [
    {
      "id": "16463960-077c-4700-bbb3-3c7897b943d3",
      "title": "Soft Neon on My Skin",
      "audio_url": "https://cdn1.suno.ai/16463960-077c-4700-bbb3-3c7897b943d3.mp3",
      "image_url": "https://cdn2.suno.ai/image_16463960-077c-4700-bbb3-3c7897b943d3.jpeg",
      "model": "chirp-v5-5",
      "state": "succeeded",
      "prompt": "A warm synth-pop song about city nights",
      "duration": 156.28
    }
  ]
}
```

As you can see, the generated song is sung using the cloned voice. The `persona_id` can also be used with the `cover` action to have the cloned voice cover existing songs.
