{"slug": "local-cpu-friendly-high-quality-tts-text-to-speech-with-kokoro", "title": "Local, CPU-Friendly, High-Quality TTS (Text-to-Speech) with Kokoro", "summary": "Kokoro, an 82M-parameter text-to-speech model, now delivers high-quality, realistic speech generation locally on CPU, preserving privacy. The model supports multiple languages and 50 voices, and can be deployed via a Docker container with an OpenAI-compatible API. Performance tests show generation times as low as 1.5 seconds on modern CPUs.", "body_md": "# Local, CPU-Friendly, High-Quality TTS (Text-to-Speech) with Kokoro\n\nJust a few years ago, realistic local speech generation seemed unimaginable. Today, its quality is exceptional and, crucially, it delivers these results without compromising privacy.\n\nThe video above showcases audio generated from a sample text, running entirely on the local machine previously discussed in the [GTX 1080 Ti for Local LLM](/2026/02/gtx-1080-ti-for-local-llm) article. While this machine has a dedicated GPU, the GPU is fully reserved for LLM inference and the speech synthesis is powered entirely by the CPU.\n\nThe model used is [Kokoro](https://huggingface.co/hexgrad/Kokoro-82M), which, despite having *only* 82M parameters, produces realistic speech in multiple languages including English, Mandarin, and Hindi. It provides around 50 distinct voices, primarily optimized for English.\n\nThere are several ways to set up a server for Kokoro. The simplest method involves using a pre-made container image called [Kokoro-FastAPI](https://github.com/remsky/Kokoro-FastAPI), which includes pre-downloaded voice models. Because of that, the container image is rather large, at about 5 GB in size.\n\nTo launch the container using Docker or Podman, use the following command:\n\n```\npodman run -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-cpu\n```\n\nTo quickly verify that it runs correcly, the container serves a simple web UI at `localhost:8880/web`\n\n. Here you can generate (and automatically play) an audio given some text.\n\nIn addition to the simple web UI, this container also serves a TTS interface compatible with the [OpenAI speech API](https://platform.openai.com/docs/guides/text-to-speech), making it easy to adapt existing programs that already use the OpenAI speech API. To facilitate a quick test, sample code in both JavaScript and Python is available at [github.com/remotebrowser/speak](http://github.com/remotebrowser/speak). Cloning this repository will enable you to follow the subsequent demonstration.\n\nFor JavaScript:\n\n```\nexport TTS_API_BASE_URL=http://127.0.0.1:8880/v1\n./speak.js \"Good morning! How are you today?\"\n```\n\nFor Python, the command is very similar:\n\n```\nexport TTS_API_BASE_URL=http://127.0.0.1:8880/v1\n./speak.py \"Good morning! How are you today?\"\n```\n\nThe generated audio will be saved as an MP3 file. If SoX or Sound eXchange (see [sox.sf.net](https://sox.sf.net/) for details) is installed on your machine, the audio will also play back automatically.\n\nYou can also select a different voice by setting the `TTS_VOICE`\n\nenvironment variable:\n\n```\nexport TTS_API_BASE_URL=http://127.0.0.1:8880/v1\nexport TTS_VOICE=\"am_eric\"\n./speak.js \"Good morning! How are you today?\"\n```\n\nA complete list of available voices can be found on the official Kokoro project page: [huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md).\n\nHow fast is the synthesis? Here are some measurements using the `am_eric`\n\nvoice on a short test paragraph:\n\nJupiter is the largest and most massive planet in our solar system. This gas giant, made mostly of hydrogen and helium, is known for its Great Red Spot—a massive storm observed for centuries.\n\nThe following list summarizes the generation time (best of 3 runs) across different CPUs:\n\n- Intel Core i7-4770K: 4.7 seconds\n- Apple M2 Pro: 4.5 seconds\n- AMD Ryzen 7 8745HS: 1.5 seconds\n\nThe first CPU in the list was released 12 years ago. If that ancient CPU can do the job just fine, you know that this is a highly capable TTS system.\n\nFinally, for an alternative OpenAI-compatible containerized TTS service, consider Speaches ([speaches.ai](https://speaches.ai/)). Unlike Kokoro-FastAPI, Speaches requires you to explicitly download voice weights via its API, as they are not bundled in the container image. However, Speaches offers an advantage by including [Whisper](https://openai.com/index/whisper/), OpenAI’s renowned high-quality Speech-to-Text (STT) system. If your application needs both TTS and STT functionality, Speaches could be your one-stop solution.\n\nWhen combined with a local LLM, a speech synthesis system like this allows you to enjoy listening to LLM answers instead of reading them!\n\n*Note: This article originally appeared on the Remote Browser Substack.*", "url": "https://wpnews.pro/news/local-cpu-friendly-high-quality-tts-text-to-speech-with-kokoro", "canonical_source": "https://ariya.io/2026/03/local-cpu-friendly-high-quality-tts-text-to-speech-with-kokoro/", "published_at": "2026-07-07 18:24:10+00:00", "updated_at": "2026-07-07 19:09:24.852988+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-products", "ai-tools", "natural-language-processing", "ai-infrastructure"], "entities": ["Kokoro", "Kokoro-FastAPI", "OpenAI", "Whisper", "Speaches", "Intel Core i7-4770K", "Apple M2 Pro", "AMD Ryzen 7 8745HS"], "alternates": {"html": "https://wpnews.pro/news/local-cpu-friendly-high-quality-tts-text-to-speech-with-kokoro", "markdown": "https://wpnews.pro/news/local-cpu-friendly-high-quality-tts-text-to-speech-with-kokoro.md", "text": "https://wpnews.pro/news/local-cpu-friendly-high-quality-tts-text-to-speech-with-kokoro.txt", "jsonld": "https://wpnews.pro/news/local-cpu-friendly-high-quality-tts-text-to-speech-with-kokoro.jsonld"}}