4Z API

Create speech gpt-4o-mini-tts

Endpoint: POST https://4zapi.com/v1/audio/speech

Official documentation: https://platform.openai.com/docs/guides/text-to-speech

Request body (application/json)

  • input (string, required): The text to generate audio from. The maximum length is 4096 characters.
  • model (string, required): TTS model ID. OpenAI: gpt-4o-mini-tts ElevenLabs: - eleven_v4: the most nuanced emotion; for audiobooks and professional voice-over - eleven_v4_turbo: low-latency V4, balancing emotion and speed - eleven_v3: highly expressive; for stories and short-drama dubbing - eleven_v3_conversational: built for dialogue, natural spoken style - eleven_multilingual_v2: stable on long scripts and mixed-language text - eleven_flash_v2: lightweight and fast, for short sentences - eleven_flash_v2_5: for very long text and bulk subtitle generation
  • voice (string, required): Voices available with gpt-4o-mini-tts: alloy, echo, fable, onyx, nova and shimmer. For ElevenLabs models, set voice to an ElevenLabs voice_id (e.g. JBFqnCBsd6RMkjVDRZzb); an unknown or unavailable voice_id returns 400.
  • response_format (string): The default is mp3 audio format. Supported formats are: mp3, opus, aac and flac.
  • speed (number): Defaults to 1. Generated audio speed. Choose a value between 0.25 and 4.0. 1.0 is the default value.

Request example

{
  "input": "Welcome to today's tech briefing.",
  "model": "eleven_v4",
  "response_format": "mp3",
  "voice": "JBFqnCBsd6RMkjVDRZzb"
}