[ PROMPT_NODE_24880 ]
voices
[ SKILL_DOCUMENTATION ]
# HeyGen 语音
HeyGen 为不同的语言、口音和风格提供了多种 AI 语音。语音可以将你的文本脚本转换为听起来自然的语音。
## 列出可用语音
### curl
bash
curl -X GET "https://api.heygen.com/v2/voices"
-H "X-Api-Key: $HEYGEN_API_KEY"
### TypeScript
typescript
interface Voice {
voice_id: string;
name: string;
language: string;
gender: "male" | "female";
preview_audio: string;
support_pause: boolean;
emotion_support: boolean;
}
interface VoicesResponse {
error: null | string;
data: {
voices: Voice[];
};
}
async function listVoices(): Promise {
const response = await fetch("https://api.heygen.com/v2/voices", {
headers: { "X-Api-Key": process.env.HEYGEN_API_KEY! },
});
const json: VoicesResponse = await response.json();
if (json.error) {
throw new Error(json.error);
}
return json.data.voices;
}
### Python
python
import requests
import os
def list_voices() -> list:
response = requests.get(
"https://api.heygen.com/v2/voices",
headers={"X-Api-Key": os.environ["HEYGEN_API_KEY"]}
)
data = response.json()
if data.get("error"):
raise Exception(data["error"])
return data["data"]["voices"]
## 响应格式
{
"error": null,
"data": {
"voices": [
{
"voice_id": "1bd001e7e50f421d891986aad5158bc8",
"name": "Sara",
"language": "English",
"gender": "female",
"preview_audio": "https://files.heygen.ai/...",
"support_pause": true,
"emotion_support": true
},
{
"voice_id": "de8b5d78f2e0485f88d1e9f5c8e7f9a6",
"name": "Paul",
"language": "English",
"gender": "male",
"preview_audio": "https://files.heygen.ai/...",
"support_pause": true,
"emotion_support": false
}
]
}
}
## 支持的语言
HeyGen 支持多种语言,包括:
| 语言 | 代码 | 备注 |
|----------|------|-------|
| 英语 (美国) | en-US | 多种语音选项 |
| 英语 (英国) | en-GB | 英式口音 |
| 西班牙语 | es-ES | 西班牙西班牙语 |
| 西班牙语 (拉丁) | es-MX | 墨西哥西班牙语 |
| 法语 | fr-FR | 法国法语 |
| 德语 | de-DE | 标准德语 |
| 葡萄牙语 | pt-BR | 巴西葡萄牙语 |
| 中文 (普通话) | zh-CN | 简体中文 |
| 日语 | ja-JP | 标准日语 |
| 韩语 | ko-KR | 标准韩语 |
| 意大利语 | it-IT | 标准