# TTS API

The most affordable TTS API on the market - turn text into speech in seconds.

## Latest AI Model

The TTS API is powered by our latest AI model for speech synthesis. Get exceptional quality speech in seconds.

## Build Your AI Features

Choose from a variety of voices; we support real-time streaming and always keep improving our API.

## Top Performance

Our API provides fast text-to-speech delivery. Plus, with streaming, you receive responses almost instantly.

## Save Up to 90% on Your TTS API

Cost per 1 million characters (~1,000 minutes of speech):

### Simple API Integration

Our TTS API is compatible with OpenAI and ElevenLabs, so you can switch to Lemonfox.ai by changing a single line of code.

Switch from:

- OpenAI
- ElevenLabs

#### Code Example

```javascript
import { createWriteStream } from "fs";
import { Readable } from "stream";
import { finished } from "stream/promises";

const response = await fetch("https://api.lemonfox.ai/v1/audio/speech", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
  },
  body: JSON.stringify({
    input: "Artificial intelligence is the intelligence of machines or software.",
    voice: "sarah",
    response_format: "mp3"
  })
})
const fileStream = createWriteStream("speech.mp3", { flags: "wx" });
await finished(Readable.fromWeb(response.body).pipe(fileStream));
```

### Frequently Asked Questions

**What are some use cases for it?**  
The applications of using a TTS API range from creating voice assistants to generating audio content for podcasts or videos. Everything where you need to generate a voice.

**Which languages are supported?**  
We support 8 languages including American English, British English, Spanish, French, Hindi, Italian, Portuguese, and Chinese. For each language, we support a variety of different voices. You can listen to them here: [Documentation](/content/apis/text-to-speech/index.html).

**Is there support for real-time TTS?**  
Yes, depending on the length of the text, you can easily generate longer audios in seconds. Plus, our API supports streaming, so you receive responses almost instantly.

**Can I test the API for free?**  
Yes, try our API free for a full month! After that, get 2 million characters of text to speech for just $5 per month. Need more? Additional characters cost only $2.50 per 1 million characters, making our service 6x more affordable than OpenAI or Google Cloud Text-to-Speech.
