CosyVoice Clone
Generate lifelike speech from text using CosyVoice with optional reference prompts for instant cloning.
Backend online
🔌 API Access
Call CosyVoice via the Eigen AI unified generate endpoint with your API key.
🔑 API Keys
To use the API, you need an API key. Manage your API keys →
POST
/api/v1/generate
CosyVoice Speech Generation
Provide text, a reference script, and optional prompt audio to clone instantly.
Cost:
0.1 credits per audio minute
Minutes are estimated from output length. Upload reference audio for voice cloning or leave empty for default voice.
Request (cURL)
curl -X POST https://app.eigenai.com/api/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=cosyvoice" \
-F "text=Hey there! I am your friendly voice twin. Pick a preset or upload your voice!" \
-F "ref_text=The device would work during the day as well if you took steps to either block direct sunlight or point it away from the sun." \
# Replace the path below if you supply your own reference clip
-F "prompt_audio=@/path/to/reference.mp3" \
--output cosyvoice_output.wav
Request (Python)
from pathlib import Path
import requests
url = "https://app.eigenai.com/api/v1/generate"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
data = {
"model": "cosyvoice",
"text": "Hey there! I can read anything you send my way.",
"ref_text": "The device would work during the day as well if you took steps to either block direct sunlight or point it away from the sun."
}
prompt_path = Path("/path/to/reference.mp3") # Update to your reference audio path
if prompt_path.exists():
with prompt_path.open("rb") as prompt:
files = {"prompt_audio": (prompt_path.name, prompt, "audio/mpeg")}
response = requests.post(url, headers=headers, data=data, files=files)
else:
response = requests.post(url, headers=headers, data=data)
if response.status_code == 200:
with open("cosyvoice_output.wav", "wb") as wav:
wav.write(response.content)
else:
print("Error:", response.text)
Request (JavaScript/Node.js)
const fs = require("fs");
const FormData = require("form-data");
const axios = require("axios");
const form = new FormData();
form.append("model", "cosyvoice");
form.append("text", "CosyVoice is ready to narrate your next release notes.");
form.append("ref_text", "The device would work during the day as well if you took steps to either block direct sunlight or point it away from the sun.");
const promptPath = "/path/to/reference.mp3"; // Update to your reference audio path
if (fs.existsSync(promptPath)) {
form.append("prompt_audio", fs.createReadStream(promptPath));
}
axios.post("https://app.eigenai.com/api/v1/generate", form, {
headers: {
...form.getHeaders(),
Authorization: "Bearer YOUR_API_KEY"
},
responseType: "arraybuffer"
}).then((response) => {
fs.writeFileSync("cosyvoice_output.wav", response.data);
});
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model |
string | ✅ Yes | Must be cosyvoice. |
text |
string | ✅ Yes | Content CosyVoice will narrate. |
ref_text |
string | ✅ Yes | Sample line voiced by the reference clip. |
prompt_audio |
file | Optional | Reference audio clip. Defaults to Eigen AI voice if omitted. |
Output Preview
🎧 Powered by CosyVoice
Waiting for your first request. Enter text, add an optional reference, and generate to listen.