# F5 TTS

> F5 TTS


## Overview

- **Endpoint**: `https://fal.run/fal-ai/f5-tts`
- **Model ID**: `fal-ai/f5-tts`
- **Category**: text-to-audio
- **Kind**: inference
**Tags**: speech



## Pricing

- **Price**: $0.05 per 1000 characters

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`gen_text`** (`string`, _required_):
  The text to be converted to speech.
  - Examples: "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences."

- **`ref_audio_url`** (`string`, _required_):
  The URL of the reference audio file.
  - Examples: "https://storage.googleapis.com/falserverless/example_inputs/reference_audio.wav"

- **`ref_text`** (`string`, _optional_):
  The reference text to be used for TTS. If not provided, an ASR (Automatic Speech Recognition) model will be used to generate the reference text. Default value: `""`
  - Default: `""`
  - Examples: "Some call me nature, others call me mother nature."

- **`model_type`** (`ModelTypeEnum`, _required_):
  The name of the model to be used for TTS.
  - Options: `"F5-TTS"`, `"E2-TTS"`

- **`remove_silence`** (`boolean`, _optional_):
  Whether to remove the silence from the audio file. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{
  "gen_text": "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.",
  "ref_audio_url": "https://storage.googleapis.com/falserverless/example_inputs/reference_audio.wav",
  "model_type": "F5-TTS"
}
```

**Full Example**:

```json
{
  "gen_text": "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.",
  "ref_audio_url": "https://storage.googleapis.com/falserverless/example_inputs/reference_audio.wav",
  "ref_text": "Some call me nature, others call me mother nature.",
  "model_type": "F5-TTS",
  "remove_silence": true
}
```


### Output Schema

The API returns the following output format:

- **`audio_url`** (`AudioFile`, _required_):
  The audio file containing the generated speech.



**Example Response**:

```json
{
  "audio_url": {
    "url": "https://v2.fal.media/files/8535dd59e911496a947daa35c07e67a3_tmplkcy6tut.wav",
    "content_type": "audio/wav",
    "file_name": "8535dd59e911496a947daa35c07e67a3_tmplkcy6tut.wav",
    "file_size": 4404019
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/f5-tts \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "gen_text": "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.",
     "ref_audio_url": "https://storage.googleapis.com/falserverless/example_inputs/reference_audio.wav",
     "model_type": "F5-TTS"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/f5-tts",
    arguments={
        "gen_text": "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.",
        "ref_audio_url": "https://storage.googleapis.com/falserverless/example_inputs/reference_audio.wav",
        "model_type": "F5-TTS"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/f5-tts", {
  input: {
    gen_text: "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.",
    ref_audio_url: "https://storage.googleapis.com/falserverless/example_inputs/reference_audio.wav",
    model_type: "F5-TTS"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/f5-tts)
- [API Documentation](https://fal.ai/models/fal-ai/f5-tts/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/f5-tts)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
