通过Crazyrouter API实现文字转语音,支持OpenAI TTS声音(alloy、echo、fable、onyx、nova、shimmer),将文本转换为自然语音音频文件,适用于用户需要将文字转换为语音的场景。
Generate natural speech from text using Crazyrouter — OpenAI-compatible TTS API.
VoiceStylealloyNeutral, balancedechoWarm, conversationalfableExpressive, storytellingonyxDeep, authoritativenovaFriendly, upbeatshimmerSoft, gentle
Agent Execution:
SKILL_DIR = this SKILL.md file's directory${SKILL_DIR}/scripts/main.mjsbash
[ -n "${CRAZYROUTER_API_KEY}" ] && echo "key_present" || echo "not_set"
ResultActionkey_presentContinuenot_setAsk user to set CRAZYROUTER_API_KEY. Get key at https://crazyrouter.com
bash
# Basic TTS
node ${SKILL_DIR}/scripts/main.mjs --text "Hello world" --output hello.mp3
# Choose voice
node ${SKILL_DIR}/scripts/main.mjs --text "Welcome to Crazyrouter" --output welcome.mp3 --voice nova
# HD quality
node ${SKILL_DIR}/scripts/main.mjs --text "Premium audio" --output hd.mp3 --model tts-1-hd
# Read from file
node ${SKILL_DIR}/scripts/main.mjs --input article.txt --output article.mp3
# Adjust speed
node ${SKILL_DIR}/scripts/main.mjs --text "Slow and clear" --output slow.mp3 --speed 0.8
OptionDescriptionDefault--text <text>Text to speak—--input <file>Read text from file—--output <path>Output audio file (required)—--voice <name>Voice selectionalloy``--model <id>``tts-1 or tts-1-hd``tts-1``--speed <num>Speed (0.25-4.0)1.0``--format <fmt>``mp3, opus, aac, flac``mp3