POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 const axios = require('axios'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/kokoro-82m"; const data = { "text": "The morning sun rose over the quiet harbor as the fishing boats drifted out to sea, their sails catching the first golden light of a brand new day." }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


textstr * Affects Pricing

Words to synthesize; max 5000 characters, billed per character. Add punctuation for natural pacing.


voiceenum:str ( default: af_heart )

Preset speaker that also sets language; 54 voices, 9 groups. Match voice to target language.

Allowed values:


speedfloat ( default: 1 )

Playback rate from 0.5 to 2.0. Use near 0.9 for narration, 1.1 for snappy prompts.


formatenum:str ( default: wav )

Audio container: wav (24kHz mono) or mp3 128kbps. Pick wav for quality, mp3 for size.

Allowed values:


base64bool ( default: 1 )

Return audio as base64 JSON instead of a binary file. Enable only for inline embedding.

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Kokoro 82M — Open-Weight Text-to-Speech (TTS) API

What is Kokoro 82M?

Kokoro 82M is a lightweight, open-weight text-to-speech model that turns written text into natural, expressive speech. Despite having just 82 million parameters, it delivers voice quality comparable to models many times its size, while running dramatically faster and cheaper. Created by hexgrad and released under the permissive Apache 2.0 license, Kokoro is built on a decoder-only architecture combining StyleTTS 2 and ISTFTNet. On Segmind, you call it as a simple text-to-speech API: send text, pick a voice, and receive a ready-to-play WAV or MP3 audio file. It is the go-to choice for developers who need production-grade narration without the cost or footprint of large TTS systems.

Key Features

  • 54 preset voices spanning American and British English, Spanish, French, Hindi, Italian, Japanese, Brazilian Portuguese, and Mandarin Chinese.
  • The voice ID also selects the language, so switching accents or languages is a single parameter change.
  • Adjustable speaking speed (0.5x–2.0x) for narration, dialogue, or fast notifications.
  • WAV (24kHz mono) or MP3 (128 kbps) output, with per-character billing on inputs up to 5,000 characters.
  • Extremely fast generation — up to roughly 96x real-time on GPU — ideal for high-volume batch voiceover.

Best Use Cases

Kokoro 82M excels at English narration for audiobooks, podcasts, YouTube voiceovers, and e-learning courses, where its American English voices sound clean and expressive. It is a strong fit for accessibility tools and screen readers, in-app voice prompts, IVR and notification systems, and voice agents that need low-latency speech. Because it is cost-efficient and fast, it is also ideal for prototyping and for high-throughput pipelines that convert large volumes of text to audio. In testing, a natural narrative sentence with the default af_heart voice produced clean, lifelike 24kHz speech with natural pauses and no clipping.

Prompt Tips and Output Quality

Write text the way you want it read: use punctuation to shape pacing, spell out ambiguous abbreviations, and split long scripts into separate calls, then stitch the audio. Choose a voice that matches your target language, since the voice determines the accent. American English voices are the most polished; non-English voices are usable but more variable. Keep speed near 1.0 for narration and raise it slightly for snappy UI prompts. Use WAV for the highest fidelity and MP3 when file size matters.

FAQs

Does Kokoro 82M support voice cloning? No. Kokoro offers 54 fixed preset voices and cannot clone a custom or client voice.

What languages and voices does it support? 54 voices across 8 languages and 9 accent groups, including American and British English, Spanish, French, Hindi, Italian, Japanese, Brazilian Portuguese, and Mandarin Chinese.

How long can my input text be? Up to 5,000 characters per request; billing is per character. Break longer scripts into multiple calls.

What audio formats does the API return? WAV at 24kHz mono, or MP3 at 128 kbps. Choose WAV for quality and MP3 for smaller files.

How fast is Kokoro 82M? It is one of the fastest TTS models available, reaching up to about 96x real-time on GPU hardware.

Is Kokoro 82M good for multilingual projects? Yes for broad coverage, but English is the most polished; test non-English voices for your specific content.