Kokoro-FastAPI

Dockerized FastAPI wrapper for Kokoro-82M text-to-speech model

📖 Overview

This repository contains a simple Dockerfile for deploying the Kokoro-FastAPI text-to-speech service using the pre-built CPU image.

🚀 Quick Start

Build and run the container

docker build -t kokoro-tts .  
docker run -p 8880:8880 kokoro-tts

🔌 API Usage

Once running, the API is available at http://localhost:8880 with OpenAI-compatible endpoints:

Python Example

from openai import OpenAI  
  
client = OpenAI(  
    base_url="http://localhost:8880/v1",   
    api_key="not-needed"  
)  
  
with client.audio.speech.with_streaming_response.create(  
    model="kokoro",  
    voice="af_bella",  
    input="Hello world!",  
    response_format="mp3"  
) as response:  
    response.stream_to_file("output.mp3")

📚 Documentation

For comprehensive documentation including:

Please refer to the main README.md in the repository.

🌐 Access Points

API Base URL: http://localhost:8880
API Documentation: http://localhost:8880/docs
Web Interface: http://localhost:8880/web