A Home Assistant custom integration for connecting to Kokoro FastAPI, enabling high-quality local Text-to-Speech. Easily send TTS audio to your speakers or media players directly from Home Assistant.
๐ง Listen to a preview: โถ Play
- ๐ Quick Links
- โจ Features
- ๐ฆ Installation
- โ๏ธ Configuration
โถ๏ธ Usage- ๐ Troubleshooting
- ๐ Credits
- ๐ Convert text to speech using Kokoro FastAPI
- โก Low-latency responses for near real-time playback
- ๐๏ธ Voice selection with per-call overrides
- ๐ง Configurable server URL and parameters
- ๐ Works with any Home Assistant
media_playerentity - โ Connection test during setup โ validates server reachability before configuring
- ๐ Options changes take effect immediately โ no restart required
- ๐ Automatic
lang_codedetection for optimal multilingual support
-
Go to
HACSโIntegrationsโCustom repositories. -
Add this repository:
https://github.com/beecho01/Kokoro-TTSwith categoryIntegration. -
Either search for
Kokoro-TTSin HACS or tap the below button: -
Tap
Downloadand thenInstall. -
Then tap next setup quick-link below to complete the setup configuration:
-
Configure the Kokoro TTS integration as desired.
- Download the latest release from Releases.
- Copy the folder
custom_components/kokoro_ttsinto your Home Assistantcustom_componentsdirectory. - Restart Home Assistant.
- Go to
SettingsโDevices & services. - Click the
Add Configurationbutton. - Search for
Kokoro TTSand select it. - Configure the Kokoro TTS integration as desired.
The integration can be configured through Home Assistant's UI with automatic discovery of available models and voices from your Kokoro FastAPI server.
| Option | Description | Default | Range/Options |
|---|---|---|---|
base_url |
Kokoro FastAPI server URL | Required | Valid HTTP/HTTPS URL |
api_key |
Authentication key | "not-needed" |
Any string |
model |
TTS model to use | "kokoro" |
Auto-discovered or custom |
language |
Language filter for voices | "All Languages" |
All Languages, American English, British English, Japanese, etc. |
sex |
Sex filter for voices | "All" |
All, Female, Male |
persona |
Voice persona/character | Required | Auto-discovered from server |
speed |
Speech speed multiplier | 1.0 |
0.25 - 4.0 |
format |
Audio format | "mp3" |
mp3, wav, opus, flac, pcm |
sample_rate |
Audio sample rate | 24000 |
22050, 24000, 44100 |
| Language | Sex | Name | Preview | Persona Code |
|---|---|---|---|---|
| American English ๐บ๐ธ | Female | Heart | โถ Play | af_heart |
| American English ๐บ๐ธ | Female | Alloy | โถ Play | af_alloy |
| American English ๐บ๐ธ | Female | Aoede | โถ Play | af_aoede |
| American English ๐บ๐ธ | Female | Bella | โถ Play | af_bella |
| American English ๐บ๐ธ | Female | Jessica | โถ Play | af_jessica |
| American English ๐บ๐ธ | Female | Kore | โถ Play | af_kore |
| American English ๐บ๐ธ | Female | Nicole | โถ Play | af_nicole |
| American English ๐บ๐ธ | Female | Nova | โถ Play | af_nova |
| American English ๐บ๐ธ | Female | River | โถ Play | af_river |
| American English ๐บ๐ธ | Female | Sarah | โถ Play | af_sarah |
| American English ๐บ๐ธ | Female | Sky | โถ Play | af_sky |
| American English ๐บ๐ธ | Male | Adam | โถ Play | am_adam |
| American English ๐บ๐ธ | Male | Echo | โถ Play | am_echo |
| American English ๐บ๐ธ | Male | Eric | โถ Play | am_eric |
| American English ๐บ๐ธ | Male | Fenrir | โถ Play | am_fenrir |
| American English ๐บ๐ธ | Male | Liam | โถ Play | am_liam |
| American English ๐บ๐ธ | Male | Michael | โถ Play | am_michael |
| American English ๐บ๐ธ | Male | Onyx | โถ Play | am_onyx |
| American English ๐บ๐ธ | Male | Puck | โถ Play | am_puck |
| American English ๐บ๐ธ | Male | Santa | โถ Play | am_santa |
| British English ๐ฌ๐ง | Female | Alice | โถ Play | bf_alice |
| British English ๐ฌ๐ง | Female | Emma | โถ Play | bf_emma |
| British English ๐ฌ๐ง | Female | Isabella | โถ Play | bf_isabella |
| British English ๐ฌ๐ง | Female | Lily | โถ Play | bf_lily |
| British English ๐ฌ๐ง | Male | Daniel | โถ Play | bm_daniel |
| British English ๐ฌ๐ง | Male | Fable | โถ Play | bm_fable |
| British English ๐ฌ๐ง | Male | George | โถ Play | bm_george |
| British English ๐ฌ๐ง | Male | Lewis | โถ Play | bm_lewis |
| Japanese ๐ฏ๐ต | Female | Alpha | โถ Play | jf_alpha |
| Japanese ๐ฏ๐ต | Female | Gongitsune | โถ Play | jf_gongitsune |
| Japanese ๐ฏ๐ต | Female | Nezumi | โถ Play | jf_nezumi |
| Japanese ๐ฏ๐ต | Female | Tebukuro | โถ Play | jf_tebukuro |
| Japanese ๐ฏ๐ต | Male | Kumo | โถ Play | jm_kumo |
| Mandarin Chinese ๐จ๐ณ | Female | Xiaobei | โถ Play | zf_xiaobei |
| Mandarin Chinese ๐จ๐ณ | Female | Xiaoni | โถ Play | zf_xiaoni |
| Mandarin Chinese ๐จ๐ณ | Female | Xiaoxiao | โถ Play | zf_xiaoxiao |
| Mandarin Chinese ๐จ๐ณ | Female | Xiaoyi | โถ Play | zf_xiaoyi |
| Mandarin Chinese ๐จ๐ณ | Male | Yunjian | โถ Play | zm_yunjian |
| Mandarin Chinese ๐จ๐ณ | Male | Yunxi | โถ Play | zm_yunxi |
| Mandarin Chinese ๐จ๐ณ | Male | Yunxia | โถ Play | zm_yunxia |
| Mandarin Chinese ๐จ๐ณ | Male | Yunyang | โถ Play | zm_yunyang |
| Spanish ๐ช๐ธ | Female | Dora | โถ Play | ef_dora |
| Spanish ๐ช๐ธ | Male | Alex | โถ Play | em_alex |
| Spanish ๐ช๐ธ | Male | Santa | โถ Play | em_santa |
| French ๐ซ๐ท | Female | Siwis | โถ Play | ff_siwis |
| Hindi ๐ฎ๐ณ | Female | Alpha | โถ Play | hf_alpha |
| Hindi ๐ฎ๐ณ | Female | Beta | โถ Play | hf_beta |
| Hindi ๐ฎ๐ณ | Male | Omega | โถ Play | hm_omega |
| Hindi ๐ฎ๐ณ | Male | Psi | โถ Play | hm_psi |
| Italian ๐ฎ๐น | Female | Sara | โถ Play | if_sara |
| Italian ๐ฎ๐น | Male | Nicola | โถ Play | im_nicola |
| Brazilian Portuguese ๐ง๐ท | Female | Dora | โถ Play | pf_dora |
| Brazilian Portuguese ๐ง๐ท | Male | Alex | โถ Play | pm_alex |
| Brazilian Portuguese ๐ง๐ท | Male | Santa | โถ Play | pm_santa |
-
Add Integration: Go to
SettingsโDevices & servicesโAdd Integrationโ Search for "Kokoro TTS" -
Server Connection (validated automatically):
- Base URL: Your Kokoro FastAPI server URL (e.g.,
http://localhost:8880) - API Key: Optional authentication key (leave as
not-neededif not required) - The integration will test the connection before proceeding โ if it fails, you'll see a specific error message
- Base URL: Your Kokoro FastAPI server URL (e.g.,
-
Voice & Model Selection:
- Model: Automatically discovered from
/v1/modelsendpoint (defaults to "kokoro") - Language Filter: Filter personas by language (All Languages, American English, British English, etc.)
- Sex Filter: Filter personas by sex (All, Female, Male)
- Voice/Persona: Select from filtered list of available personas
- Speed: Playback speed (0.25x to 4.0x, default: 1.0)
- Format: Audio format (mp3, wav, opus, flac, pcm)
- Sample Rate: Audio sample rate (22050, 24000, 44100 Hz)
- Model: Automatically discovered from
Changing options? Any changes made via
SettingsโDevices & ServicesโConfiguretake effect immediately โ no Home Assistant restart is required.
โ ๏ธ YAML configuration is no longer supported. Please use the UI configuration flow instead. If you previously used YAML, remove thekokoro_ttsentry from yourconfiguration.yamland set up the integration through the UI.
Voice Assistant
Note
Work in Progress
Triggered action
action: tts.speak
data:
media_player_entity_id: media_player.living_room_speaker
message: 'Hello from Kokoro Text-to-Speech!'
cache: false
language: en
target:
entity_id: tts.kokoro
| Error | Cause | Fix |
|---|---|---|
| Cannot connect to the server | Server not reachable | Check the URL, ensure the server is running, and verify network connectivity |
| Connection timed out | Server too slow to respond | Check server load; increase timeout if server is slow to start |
| SSL error | Certificate issue | Check your reverse proxy / SSL certificate settings |
| Server not found | URL points to wrong endpoint | Ensure the URL points to the Kokoro FastAPI root (e.g. http://192.168.0.1:8880) |
| Authentication failed | Wrong API key | Check your API key matches the server's configured key |
Options changes take effect immediately without a restart. If the voice doesn't change, try:
- Go to
SettingsโDevices & ServicesโKokoro TTSโConfigure - Change the persona and click
Submit - The TTS entity reloads automatically with the new settings
You can override the default persona, speed, format, and volume on a per-call basis:
action: tts.speak
data:
media_player_entity_id: media_player.living_room_speaker
message: "Hello from Kokoro!"
options:
persona: af_bella
speed: 1.5
format: mp3
volume_multiplier: 1.5
target:
entity_id: tts.kokoro| Option | Description | Default | Range |
|---|---|---|---|
persona |
Voice persona code | Config default | Any discovered persona |
speed |
Speech speed multiplier | 1.0 |
0.25 โ 4.0 |
format |
Audio format | mp3 |
mp3, wav, opus, flac, pcm |
sample_rate |
Audio sample rate (Hz) | 24000 |
22050, 24000, 44100 |
volume_multiplier |
Volume multiplier | 1.0 |
Any positive float |
Kokoro FastAPI backend: @remsky
