Text to speech with Kokoro
Hosted Kokoro-82M inference for fast, low-cost text-to-speech. Kokoro is a compact 82-million-parameter TTS model that produces natural-sounding speech from plain text. Socaity runs it on hosted GPUs, so you get sub-second synthesis from any machine without managing your own hardware. Pick a built-in voice, set the speaking speed, pass your text, and save the audio.
by jaaari · socaity.sdk.replicate.jaaari.kokoro_82m
Kokoro does one job and does it well: it turns text into speech. The predictions endpoint takes the text you want spoken, an optional speed to control pacing, and a selectable voice id. It returns a single audio file you can save directly to disk.
Install the Socaity SDK, then install the Kokoro service once so the client is available locally:
pip install socaity
socaity install jaaari/kokoro-82m Kokoro is a Socaity-hosted service. Set SOCAITY_API_KEY in your environment. You can generate a key at socaity.ai under Account, Secrets.
export SOCAITY_API_KEY="sk_..." Synthesise one line of speech and save the result as a WAV file. .get_result() blocks until the job finishes; for a single output it returns one media_toolkit.AudioFile, so you can call .save() on it directly.
import os
from socaity.sdk.replicate.jaaari import kokoro_82m
tts = kokoro_82m(api_key=os.getenv("SOCAITY_API_KEY"))
audio = tts(
text="Hello from Socaity",
speed=1.0,
).get_result()
audio.save("speech.wav")kokoro_82m(api_key: str = None) returns a client bound to the Kokoro service. When api_key is omitted the SDK reads SOCAITY_API_KEY from the environment. Calling the instance (tts(...)) runs the predictions endpoint and returns a Job.
Call the client with the following parameters. Only text is required.
| Parameter | Type | Default | Description |
|---|---|---|---|
text | str | required | The text to synthesise into speech. |
speed | float | 1.0 | Speaking speed. Values above 1.0 are faster; below 1.0 are slower. |
voice | str | default voice | Selectable voice id for the generated speech. |
Current pricing and the interactive playground live on socaity.ai.
Open Kokoro on socaity.ai- Social Media Content Pipeline chains Kokoro voiceover with image and video generation.
- Python SDK reference covers the Job object, polling, and gather_results.