Kokoro TTS icon

Kokoro TTS

Convert text to speech using Kokoro TTS (kokoro-js)

Generate Speech

AI-generated

Summary

Generate speech from text using Kokoro TTS, outputting as binary audio or saving to a file.

Inputs

  • text (required) — The text to convert to speech

Output shape

Single item. When outputMode is binary: json object with text, voice, size, format, and additional options, plus a binary property named by binaryPropertyName containing base64-encoded WAV audio data (mimeType audio/wav). When outputMode is file: json object with success:true, path, text, voice, size, format, and additional options; audio saved to outputPath.

Audio is always formatted as 16-bit PCM WAV at 24kHz sampling rate. If longAudioGeneration is enabled, text is split into sentence-based chunks (<=300 chars each), synthesized separately, then concatenated with 24-second gaps between chunks.

Examples

Example 1: Binary output with default voice

Voice=af_heart, OutputMode=binary, BinaryPropertyName=audio, LongAudioGeneration=false

Example 2: File output with custom voice and speed

Voice=am_michael, OutputMode=file, OutputPath=/tmp/speech.wav, AdditionalOptions={speed:1.5}, LongAudioGeneration=true

Discussion