Skip to content

Serve

The serve command starts a FastAPI web server that provides both a web interface and HTTP API for text-to-speech generation.

Basic Usage

uvx pocket-tts serve
# or if installed manually:
pocket-tts serve

This starts a server on http://localhost:8000 with the default voice model.

Command Options

  • --voice VOICE: Path to voice prompt audio file (voice to clone) (default: "hf://kyutai/tts-voices/alba-mackenna/casual.wav")
  • --host HOST: Host to bind to (default: "localhost")
  • --port PORT: Port to bind to (default: 8000)
  • --reload: Enable auto-reload for development
  • --config: Path to a custom config .yaml

Examples

Basic Server

# Start with default settings
pocket-tts serve

# Custom host and port
pocket-tts serve --host "localhost" --port 8080

Custom Voice

# Use different voice
pocket-tts serve --voice "hf://kyutai/tts-voices/jessica-jian/casual.wav"

# Use local voice file
pocket-tts serve --voice "./my_voice.wav"

Custom Model Config

If you'd like to override the paths from which the models are loaded, you can provide a custom YAML configuration.

Copy pocket_tts/config/b6369a24.yaml and change weights_path:, weights_path_without_voice_cloning: and tokenizer_path: to the paths of the models you want to load.

Then, use the --config option to point to your newly created config.

# Use a different config
pocket-tts serve --config "C://pocket-tts/my_config.yaml"

Web Interface

Once the server is running, navigate to http://localhost:8000 to access the web interface.

For more advanced usage, see the Python API documentation for direct integration with the TTS model.