Skip to main content
This guide demonstrates how to deploy a Text-to-Speech (TTS) API using the Zonos model from Zyphra. The API converts input text into spoken audio, leveraging a pre-trained transformer model and speaker embeddings derived from an example audio file. We use Beam’s infrastructure for compute and file output handling.

View the Code

See the full code for this example on GitHub.

Setup

Environment Configuration

First, create a file named app.py:

Deployment

Run this command to deploy the endpoint:
It will return a URL with the endpoint:

API Usage

The deployed endpoint accepts POST requests with a JSON payload containing the text to convert to speech.

Request Format

Example Request

Example Response

The API returns a JSON object with a URL to the generated audio file: