Logo

Text to Speech

Convert your text into realistic, lifelike speech using our simple API that integrates seamlessly with many leading AI providers.

Orate provides a simple and unified API for converting text into speech using various AI providers. The text-to-speech functionality is accessible through the speak function.

Usage

The basic usage involves importing the speak function from Orate and your chosen provider. For example, to use OpenAI's text-to-speech model, you can import the OpenAI provider and use its tts function:

import { speak } from 'orate';
import { ElevenLabs } from 'orate/elevenlabs';
 
const speech = await speak({
  model: new ElevenLabs().tts('multilingual_v2', 'aria'),
  prompt: 'Friends, Romans, countrymen, lend me your ears!'
});

model

The model parameter is a function that returns a model instance. The model instance is a function that takes a prompt and returns a promise that resolves to the speech of the prompt.

const model = new OpenAI().tts();

prompt

The prompt parameter is a string that contains the text to be converted into speech.

const prompt = 'Hello, world!';

On this page