text-to-speech
它能做什么
这项技能使用 Starfish 模型,把书面文字生成独立的语音音频。适合需要以音频文件形式提供配音、旁白或播客音频的人。
适用场景
- ✓当你需要根据脚本生成旁白音频文件时。
- ✓当你想在生成前按语言或性别挑选声音时。
- ✓当你想为录音调整声音的语速或音高时。
技能链接
https://github.com/calesthio/OpenMontage/blob/main/.claude/skills/text-to-speech/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把这段文字制作成一段平静的男声英文配音,语速稍慢一点。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会列出与该模型兼容的声音,挑选符合你要求的一个,发送文字,并给你一个用于下载音频的链接。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Text-to-Speech (HeyGen Starfish)
Generate speech audio files from text using HeyGen's in-house Starfish TTS model. This skill is for standalone audio generation — separate from video creation.
Authentication
All requests require the X-Api-Key header. Set the HEYGEN_API_KEY environment variable.
curl -X GET "https://api.heygen.com/v1/audio/voices" \
-H "X-Api-Key: $HEYGEN_API_KEY"
Tool Selection
If HeyGen MCP tools are available (mcp__heygen__*), prefer them over direct HTTP API calls.
| Task | MCP Tool | Fallback (Direct API) |
|---|---|---|
| List TTS voices | mcp__heygen__list_audio_voices |
GET /v1/audio/voices |
| Generate speech audio | mcp__heygen__text_to_speech |
POST /v1/audio/text_to_speech |
Default Workflow
- List voices with
mcp__heygen__list_audio_voices(orGET /v1/audio/voices) - Pick a voice matching desired language, gender, and features
- Call
mcp__heygen__text_to_speech(orPOST /v1/audio/text_to_speech) with text and voice_id - Use the returned
audio_urlto download or play the audio
List TTS Voices
Retrieve voices compatible with the Starfish TTS model.
Note: This uses
GET /v1/audio/voices— a different endpoint from the video voices API (GET /v2/voices). Not all video voices support Starfish TTS.
curl
curl -X GET "https://api.heygen.com/v1/audio/voices" \
-H "X-Api-Key: $HEYGEN_API_KEY"
TypeScript
interface TTSVoice {
voice_id: string;
language: string;
gender: "female" | "male" | "unknown";
name: string;
preview_audio_url: string | null;
support_pause: boolean;
support_locale: boolean;
type: string;
}
interface TTSVoicesResponse {
error: null | string;
data: {
voices: TTSVoice[];
};
}
async function listTTSVoices(): Promise<TTSVoice[]> {
const response = await fetch("https://api.heygen.com/v1/audio/voices", {
headers: { "X-Api-Key": process.env.HEYGEN_API_KEY! },
});
const json: TTSVoicesResponse = await response.json();
if (json.error) {
throw new Error(json.error);
}
return json.data.voices;
}
Python
import requests
import os
def list_tts_voices() -> list:
response = requests.get(
"https://api.heygen.com/v1/audio/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"]
Response Format
{
"error": null,
"data": {
"voices": [
{
"voice_id": "f38a635bee7a4d1f9b0a654a31d050d2",
"name": "Chill Brian",
"language": "English",
"gender": "male",
"preview_audio_url": "https://resource.heygen.ai/text_to_speech/WpSDQvmLGXEqXZVZQiVeg6.mp3",
"support_pause": true,
"support_locale": false,
"type": "public"
}
]
}
}
Generate Speech Audio
Convert text to speech audio using a specified voice.
Endpoint
POST https://api.heygen.com/v1/audio/text_to_speech
Request Fields
| Field | Type | Req | Description |
|---|---|---|---|
text |
string | Y | Text content to convert to speech |
voice_id |
string | Y | Voice ID from GET /v1/audio/voices |
speed |
number | Speech speed, 0.5-1.5 (default: 1) | |
pitch |
integer | Voice pitch, -50 to 50 (default: 0) | |
locale |
string | Accent/locale for multilingual voices (e.g., en-US, pt-BR) |
|
elevenlabs_settings |
object | Advanced settings for ElevenLabs voices |
ElevenLabs Settings (optional)
| Field | Type | Description |
|---|---|---|
model |
string | Model selection (eleven_v3, eleven_turbo_v2_5, etc.) |
similarity_boost |
number | Voice similarity, 0.0-1.0 |
stability |
number | Output consistency, 0.0-1.0 |
style |
number | Style intensity, 0.0-1.0 |
curl
curl -X POST "https://api.heygen.com/v1/audio/text_to_speech" \
-H "X-Api-Key: $HEYGEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello! Welcome to our product demo.",
"voice_id": "YOUR_VOICE_ID",
"speed": 1.0
}'
TypeScript
interface TTSRequest {
text: string;
voice_id: string;
speed?: number;
pitch?: number;
locale?: string;
elevenlabs_settings?: {
model?: string;
similarity_boost?: number;
stability?: number;
style?: n
常见问题
我可以选择哪些声音?
这项技能说明,只列出与 Starfish 模型兼容的声音,并非所有视频声音都支持。
这和制作视频一样吗?
不一样。这项技能只生成音频,与视频制作是分开的。
需要 API 密钥吗?
需要。它使用保存在 HEYGEN_API_KEY 设置中的 HeyGen API 密钥。
详情
作者的原始描述
Generate speech audio from text using HeyGen's Starfish TTS model. Use when: (1) Generating standalone speech audio files from text, (2) Converting text to speech with voice selection, speed, and pitch control, (3) Creating audio for voiceovers, narration, or podcasts, (4) Working with HeyGen's /v1/audio endpoints, (5) Listing available TTS voices by language or gender.
repo: calesthio/OpenMontage
热度
- GitHub 星标
- 75k
- 排名
- #2703
- 许可证
- AGPL-3.0
- 更新时间
- 2026/10/28
评论
- …