跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt

Use this file to discover all available pages before exploring further.

请求体

同步请求超时: 这个非聊天端点会等待路由到的模型完成处理。大输入、长音频或大批量请求可能超过常见的 30s 客户端默认超时,因此请将 HTTP 客户端超时设置为至少 120s
model
string
默认值:"tts-1"
TTS 模型:tts-1(标准)或 tts-1-hd(更高质量)。
input
string
必填
用于生成音频的文本。最大 4096 个字符。
voice
string
必填
使用的语音:alloyashballadcoralechofablenovaonyxsageshimmerverse
response_format
string
默认值:"mp3"
音频格式:mp3opusaacflacwavpcm
speed
number
默认值:"1.0"
音频速度(0.25 到 4.0)。

响应

返回所请求格式的音频文件。
curl -X POST "https://api.tokenlab.sh/v1/audio/speech" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1-hd",
    "voice": "nova",
    "input": "Hello, welcome to TokenLab!"
  }' \
  --output speech.mp3

语音示例

Voice描述
alloy中性、平衡
ash平静、沉稳
ballad富有旋律感、表现力强
coral温暖、亲切
echo温暖、口语化
fable富有表现力、叙事感强
nova友好、清晰
onyx低沉、权威
sage睿智、深思熟虑
shimmer柔和、轻柔
verse富有动态感、适应性强