For the complete documentation index, see llms.txt. This page is also available as Markdown.

Text to Speech [BETA]

Text-to-Speech (TTS) converts written text into natural-sounding audio, enabling applications such as voice assistants, audiobook generation, accessibility tools, and real-time speech synthesis. It supports multiple voices and providers, allowing flexible audio generation tailored to different use cases.

To explore available models, visit cortecs.ai and filter by the Speech tag.

Example usage

from openai import OpenAI 

client = OpenAI( 
    base_url="https://api.cortecs.ai/v1", 
    api_key="<API_KEY>", 
) 

response = client.audio.speech.create( 
    model="chatterbox-turbo", 
    input="Hello, this is a text-to-speech test.", 
    voice="<provider_voice>" 
) 

response.stream_to_file("speech.mp3")
import OpenAI from "openai";
import fs from "fs";

const openai = new OpenAI({
    baseURL: 'https://api.cortecs.ai/v1',
    apiKey: '<API_KEY>'
});

const response = await openai.audio.speech.create({
  model: "chatterbox-turbo",
  input: "Hello, this is a text-to-speech test.",
  voice: "<provider_voice>"
});

const buffer = Buffer.from(await response.arrayBuffer());
await fs.promises.writeFile("speech.mp3", buffer);

Text-to-Speech models are priced per character of input text.

Voice Support

Each provider supports different voice styles. Available options depend on the selected provider.

Provider
Example Voice

Mistral

en_paul_neutral

Tensorix

Emily.wav

OVH

English-US.Female-1

These are only example voices. Each provider may offer additional voice options depending on the model and configuration. Always check the provider documentation for the full list of available voices.

Mistral zero-shot voice cloning

Mistral supports zero-shot voice cloning from a reference audio file. Base64-encode the reference audio and pass it in the ref_audio field of the request body.

The voice parameter is required by the OpenAI SDK but is ignored when ref_audio is provided. The generated speech is saved to speech.mp3 using the voice characteristics from sample.mp3.

Last updated