# Index TTS 2.0

> Generate natural, clear speeches using Index TTS 2.0 from IndexTeam


## Overview

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



## Pricing

Your request will cost **0.002** per generated **audio seconds**.

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:


- **`audio_url`** (`string`, _required_):
  The audio file to generate the speech from.
  - Examples: "https://storage.googleapis.com/falserverless/example_inputs/index-tts-2/tts_in.mp3"

- **`prompt`** (`string`, _required_):
  The speech prompt to generate
  - Examples: "Hide! He's coming! He's coming to get us!"

- **`emotional_audio_url`** (`string`, _optional_):
  The emotional reference audio file to extract the style from.

- **`strength`** (`float`, _optional_):
  The strength of the emotional style transfer. Higher values result in stronger emotional influence. Default value: `1`
  - Default: `1`
  - Range: `0` to `1`

- **`emotional_strengths`** (`EmotionalStrengths`, _optional_):
  The strengths of individual emotions for fine-grained control.
  - Examples: null

- **`should_use_prompt_for_emotion`** (`boolean`, _optional_):
  Whether to use the `prompt` to calculate emotional strengths, if enabled it will overwrite the `emotional_strengths` values. If `emotion_prompt` is provided, it will be used to instead of `prompt` to extract the emotional style.
  - Default: `false`
  - Examples: true

- **`emotion_prompt`** (`string`, _optional_):
  The emotional prompt to influence the emotional style. Must be used together with should_use_prompt_for_emotion.
  - Examples: "You scared me to death! What are you, a ghost?"

- **`enable_safety_checker`** (`boolean`, _optional_):
  Authorized callers may set false to request relaxed screening. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{
  "audio_url": "https://storage.googleapis.com/falserverless/example_inputs/index-tts-2/tts_in.mp3",
  "prompt": "Hide! He's coming! He's coming to get us!"
}
```

**Full Example**:

```json
{
  "audio_url": "https://storage.googleapis.com/falserverless/example_inputs/index-tts-2/tts_in.mp3",
  "prompt": "Hide! He's coming! He's coming to get us!",
  "strength": 1,
  "emotional_strengths": null,
  "should_use_prompt_for_emotion": true,
  "emotion_prompt": "You scared me to death! What are you, a ghost?",
  "enable_safety_checker": true
}
```


### Output Schema

The API returns the following output format:

- **`audio`** (`File`, _required_):
  The generated audio file in base64 format.
  - Examples: "https://storage.googleapis.com/falserverless/example_outputs/index-tts-2/tts_out.mp3"



**Example Response**:

```json
{
  "audio": "https://storage.googleapis.com/falserverless/example_outputs/index-tts-2/tts_out.mp3"
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/index-tts-2/text-to-speech \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "audio_url": "https://storage.googleapis.com/falserverless/example_inputs/index-tts-2/tts_in.mp3",
     "prompt": "Hide! He's coming! He's coming to get us!"
   }'
```

### 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/index-tts-2/text-to-speech",
    arguments={
        "audio_url": "https://storage.googleapis.com/falserverless/example_inputs/index-tts-2/tts_in.mp3",
        "prompt": "Hide! He's coming! He's coming to get us!"
    },
    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/index-tts-2/text-to-speech", {
  input: {
    audio_url: "https://storage.googleapis.com/falserverless/example_inputs/index-tts-2/tts_in.mp3",
    prompt: "Hide! He's coming! He's coming to get us!"
  },
  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/index-tts-2/text-to-speech)
- [API Documentation](https://fal.ai/models/fal-ai/index-tts-2/text-to-speech/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/index-tts-2/text-to-speech)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
