---
title: "Kokoro | Micdrop"
description: "Local text to speech with Kokoro, running in your Node process."
url: "https://micdrop.dev/docs/ai-integration/provided-integrations/kokoro"
---

*   [Getting Started](/docs/getting-started)
*   [Client (Browser)](/docs/client)
    
    *   [Installation](/docs/client/installation)
    *   [React Hooks](/docs/client/react-hooks)
    *   [Start/Stop Call](/docs/client/start-stop-call)
    *   [Pause/Resume Call](/docs/client/pause-resume-call)
    *   [Mute/Unmute Call](/docs/client/mute-unmute-call)
    *   [Call State](/docs/client/call-state)
    *   [Display Conversation Messages](/docs/client/display-conversation-messages)
    *   [Handling Tool Calls](/docs/client/handling-tool-calls)
    *   [Device Management](/docs/client/devices-management)
    *   [Voice Activity Detection (VAD)](/docs/client/vad)
    *   [Error Handling](/docs/client/error-handling)
    *   Utility Classes
        
        *   [Mic](/docs/client/utility-classes/mic)
        *   [MicdropClient](/docs/client/utility-classes/micdrop-client)
        *   [MicRecorder](/docs/client/utility-classes/mic-recorder)
        *   [Speaker](/docs/client/utility-classes/speaker)
        
    
*   [Server (Node.js)](/docs/server)
    
    *   [Installation](/docs/server/installation)
    *   [With Fastify](/docs/server/with-fastify)
    *   [With NestJS](/docs/server/with-nestjs)
    *   [Auth and Parameters](/docs/server/auth-and-parameters)
    *   [First Message](/docs/server/first-message)
    *   [Save Messages](/docs/server/save-messages)
    *   [Resume a Conversation](/docs/server/resume-conversation)
    *   [Recording Audio](/docs/server/recording-audio)
    *   [Error Handling](/docs/server/error-handling)
    *   [Tools](/docs/server/tools)
    *   [Extract Value from Answer](/docs/server/extract)
    *   [Auto End Call](/docs/server/auto-end-call)
    *   [Semantic Turn Detection](/docs/server/semantic-turn-detection)
    *   [Noise Filtering](/docs/server/noise-filtering)
    *   [Micdrop Protocol](/docs/server/protocol)
    
*   [AI Integrations](/docs/ai-integration)
    
    *   Provided Integrations
        
        *   [AI SDK](/docs/ai-integration/provided-integrations/ai-sdk)
        *   [Cartesia](/docs/ai-integration/provided-integrations/cartesia)
        *   [ElevenLabs](/docs/ai-integration/provided-integrations/elevenlabs)
        *   [Gladia](/docs/ai-integration/provided-integrations/gladia)
        *   [Gradium](/docs/ai-integration/provided-integrations/gradium)
        *   [Kokoro](/docs/ai-integration/provided-integrations/kokoro)
        *   [Mistral](/docs/ai-integration/provided-integrations/mistral)
        *   [OpenAI](/docs/ai-integration/provided-integrations/openai)
        *   [Piper](/docs/ai-integration/provided-integrations/piper)
        *   [Whisper](/docs/ai-integration/provided-integrations/whisper)
        
    *   Custom Integrations
        
        *   [Agent (LLM)](/docs/ai-integration/custom-integrations/custom-agent)
        *   [Speech-to-Text (STT)](/docs/ai-integration/custom-integrations/custom-stt)
        *   [Text-to-Speech (TTS)](/docs/ai-integration/custom-integrations/custom-tts)
        
    *   Fallback Strategies
        
        *   [FallbackAgent](/docs/ai-integration/fallback-strategies/agent-fallback)
        *   [FallbackSTT](/docs/ai-integration/fallback-strategies/stt-fallback)
        *   [FallbackTTS](/docs/ai-integration/fallback-strategies/tts-fallback)
        
    *   [Local Models](/docs/ai-integration/local-models)
    *   [IA Vocale Souveraine 🇫🇷🇪🇺](/docs/ai-integration/sovereign-voice-ai)
    

[Micdrop](/) › [Documentation](/docs/getting-started)

# Kokoro

Local text to speech for [@micdrop/server](/docs/server), running [Kokoro](https://huggingface.co/hexgrad/Kokoro-82M) in your Node process through [Transformers.js](https://huggingface.co/docs/transformers.js) and ONNX Runtime.

Kokoro is an 82 million parameter model, small enough to download in seconds and to sit next to an LLM in memory, with a quality well above what its size suggests.

## Installation

Terminal window

```
npm install @micdrop/kokoro
```

## Usage

```
import { KokoroTTS } from '@micdrop/kokoro'import { MicdropServer } from '@micdrop/server'
const tts = new KokoroTTS({  voice: 'britishFemale',})
// Use with MicdropServernew MicdropServer(socket, {  tts,  // ... other options})
```

## Options

Option

Type

Default

Description

`model`

`string`

`'onnx-community/Kokoro-82M-v1.0-ONNX'`

Repository holding the ONNX export

`voice`

`string`

`'americanFemale'`

Shorthand or Kokoro voice id

`speed`

`number`

`1`

Speech rate, above 1 to speak faster

`dtype`

`string`

`'q8'`

Weight precision

`device`

`string`

`'cpu'`

Execution provider passed to Transformers.js

`warmup`

`boolean`

`true`

Synthesizes one word at startup

## Voices

Shorthands cover the accents and the genders: `americanFemale`, `americanMale`, `britishFemale` and `britishMale`. Every voice id the model holds works too, exported as `KOKORO_VOICE_IDS`.

```
import { KOKORO_VOICE_IDS, KokoroTTS } from '@micdrop/kokoro'
const tts = new KokoroTTS({ voice: 'am_michael' })
```

Kokoro only speaks English here. The upstream model also holds French, Italian, Japanese, Portuguese and Chinese voices, but the `kokoro-js` library phonemizes every input with the English rules, so those voices read foreign words with an English pronunciation. Use [Piper](/docs/ai-integration/provided-integrations/piper) for the other languages.

## Latency

Synthesis runs at roughly half to three quarters of real time on an Apple M3, so a three second sentence takes about two seconds to generate and a short greeting comes back in about one second.

The answer is cut into sentences and each one is synthesized as soon as it is complete, so the user hears the opening while the rest is still being written. Sentences are generated one after the other rather than at once: the model is single threaded, and racing two sentences through it slows both down without bringing the first word any closer.

## Devices

`cpu` is the default and, on a Mac, the fastest option available, since Transformers.js exposes no GPU device on macOS. On Windows `dml` uses DirectML, and on Linux with an NVIDIA card `cuda` is worth trying. The [local models guide](/docs/ai-integration/local-models) carries the measurements.

## Memory and startup

The model is loaded once per configuration and shared by every call. Loading takes about a second and a half in `q8`, and the first synthesis pays for the graph warm-up, which is why `warmup` speaks one word while the call is being set up.

The `fp32` precision loads several times slower for a synthesis speed that is close to identical, so `q8` is the default.

## Documentation

Read the [guide on running Micdrop with local models](/docs/ai-integration/local-models) to see how this fits with a local LLM and a local transcription.

## License

Kokoro is released under the Apache 2.0 license, which covers commercial use.

[Previous← Gradium](/docs/ai-integration/provided-integrations/gradium)[NextMistral →](/docs/ai-integration/provided-integrations/mistral)

On this page

*   [Installation](#installation)
*   [Usage](#usage)
*   [Options](#options)
*   [Voices](#voices)
*   [Latency](#latency)
*   [Devices](#devices)
*   [Memory and startup](#memory-and-startup)
*   [Documentation](#documentation)
*   [License](#license)
