4Z API

创建语音 gpt-4o-mini-tts

接口: POST https://4zapi.com/v1/audio/speech

官方文档:https://platform.openai.com/docs/guides/text-to-speech

请求体 (application/json)

  • input (string, 必填): 要生成音频的文本。最大长度为4096个字符。
  • model (string, 必填): TTS 模型 ID。 OpenAI:gpt-4o-mini-tts ElevenLabs: - eleven_v4:情感层次最细腻,适合有声书、专业配音 - eleven_v4_turbo:V4 的低延迟版本,兼顾情感和响应速度 - eleven_v3:表现力强,适合故事、短剧配音 - eleven_v3_conversational:对话专用,口语自然 - eleven_multilingual_v2:长篇文稿稳定,适合双语混读 - eleven_flash_v2:轻量高速,适合短句朗读 - eleven_flash_v2_5:适合超长文本、批量字幕生成
  • voice (string, 必填): 使用 gpt-4o-mini-tts 时可选的语音:alloy、echo、fable、onyx、nova 和 shimmer。 使用 ElevenLabs 模型时,voice 填 ElevenLabs 的 voice_id(如 JBFqnCBsd6RMkjVDRZzb);voice_id 不存在或不可用时返回 400。
  • response_format (string): 默认为 mp3 音频的格式。支持的格式有:mp3、opus、aac 和 flac。
  • speed (number): 默认为 1 生成的音频速度。选择0.25到4.0之间的值。1.0是默认值。

请求示例

{
  "input": "欢迎收听今天的科技早报。",
  "model": "eleven_v4",
  "response_format": "mp3",
  "voice": "JBFqnCBsd6RMkjVDRZzb"
}