> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Inworld Text-to-Speech

> TTS with InworldTTSService (real-time WebSocket) and InworldHttpTTSService, running Inworld AI's TTS-2 and TTS-1.5 models.

## Overview

Inworld provides high-quality, low-latency speech synthesis via two implementation types: `InworldTTSService` for real-time, minimal-latency use-cases through websockets and `InworldHttpTTSService` for streaming and non-streaming use-cases over HTTP. Featuring support for 12+ languages, timestamps, custom pronunciation and instant voice cloning.

## Models

The default model is **Realtime TTS-2** (`inworld-tts-2`).

| Display name | Model ID |
| - | - |
| Realtime TTS-2 *(default)* | `inworld-tts-2` |
| Realtime TTS-1.5-Max | `inworld-tts-1.5-max` |
| Realtime TTS-1.5-Mini | `inworld-tts-1.5-mini` |

> [card] [Inworld TTS API Reference](https://reference-server.pipecat.ai/en/latest/api/pipecat.services.inworld.tts.html)
>
> Pipecat's API methods for Inworld TTS integration

> [card] [Example Implementation (Websockets)](https://github.com/pipecat-ai/pipecat/blob/main/examples/voice/voice-inworld.py)
>
> Complete example with Inworld TTS

> [card] [Inworld Documentation](https://docs.inworld.ai/docs/tts/tts)
>
> Official Inworld TTS API documentation

> [card] [Inworld Portal](https://platform.inworld.ai/)
>
> Create and manage voice models

## Installation

To use Inworld services, no additional dependencies are required beyond the base installation:

```bash theme={null}
uv add "pipecat-ai"
```

## Prerequisites

### Inworld Account Setup

Before using Inworld TTS services, you need:

1. **Inworld Account**: Sign up at [Inworld Studio](https://studio.inworld.ai/)
2. **API Key**: Generate an API key from your account dashboard
3. **Voice Selection**: Choose from available voice models

### Required Environment Variables

* `INWORLD_API_KEY`: Your Inworld API key for authentication

## Configuration

### InworldTTSService

WebSocket-based service for lowest latency streaming.

**api\_key** `str` *required*

Inworld API key.

**voice\_id** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=InworldTTSService.Settings(voice=...)` instead.

**model** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=InworldTTSService.Settings(model=...)` instead.

**url** `str` (default: wss\://api.inworld.ai/tts/v1/voice:streamBidirectional)

URL of the Inworld WebSocket API.

**sample\_rate** `int` (default: None)

Audio sample rate in Hz. When `None`, uses the pipeline's configured sample
rate.

**encoding** `str` (default: PCM)

Audio encoding requested from Inworld. The service pushes the returned bytes
as 16-bit mono PCM, so use an uncompressed 16-bit encoding such as the
default.

**auto\_mode** `bool | None` (default: None)

Whether the Inworld server controls flushing of buffered text. When `None`,
follows the deprecated `aggregate_sentences`, or `True` if that isn't set.

**apply\_text\_normalization** `str | None` (default: None)

Text normalization setting sent to Inworld. When `None`, it isn't sent, so
Inworld's default applies.

**timestamp\_transport\_strategy** `Literal["ASYNC", "SYNC"] | None` (default: ASYNC)

How Inworld delivers word timestamps: `"ASYNC"` or `"SYNC"`. `None` omits it
from the request.

**text\_aggregation\_mode** `TextAggregationMode` (default: None)

Controls how incoming text is aggregated before synthesis. `SENTENCE` (used
when `None`) buffers text until sentence boundaries, producing more natural
speech. `TOKEN` streams tokens directly for lower latency. Import from
`pipecat.services.tts_service`.

**aggregate\_sentences** `bool` *deprecated* (default: None)

*Deprecated since 0.0.104, removed in 2.0.0.* Use `text_aggregation_mode`
instead.

**append\_trailing\_space** `bool` (default: True)

Whether to append a trailing space to text before sending to TTS.

**params** `InputParams` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=InworldTTSService.Settings(...)` instead.

**settings** `InworldTTSService.Settings` (default: None)

Runtime-configurable settings. See [InworldTTSService
Settings](#inworldttsservice-settings) below.

#### InworldTTSService Settings

Runtime-configurable settings passed via the `settings` constructor argument using `InworldTTSService.Settings(...)`. These can be updated mid-conversation with `TTSUpdateSettingsFrame`. On `InworldTTSService`, any change reconnects the WebSocket, so audio not yet received for the current response is dropped. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `"inworld-tts-2"` | Model identifier. *(Inherited.)* |
| `voice` | `str` | `"Ashley"` | Voice identifier. *(Inherited.)* |
| `language` | `Language \| str` | `None` | Language for synthesis. *(Inherited.)* |
| `speaking_rate` | `float` | `None` | Speaking rate for speech synthesis. |
| `temperature` | `float` | `None` | Temperature for speech synthesis. |
| `delivery_mode` | `"STABLE" \| "BALANCED" \| "CREATIVE"` | `None` | Controls the stability vs. creativity tradeoff. `"STABLE"` produces reliable, predictable speech. `"BALANCED"` is the default midpoint. `"CREATIVE"` produces more expressive, emotionally varied speech. Only supported by `inworld-tts-2`. |

### InworldHttpTTSService

HTTP-based service supporting both streaming and non-streaming modes.

**api\_key** `str` *required*

Inworld API key.

**aiohttp\_session** `aiohttp.ClientSession` *required*

aiohttp ClientSession for HTTP requests.

**voice\_id** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=InworldHttpTTSService.Settings(voice=...)` instead.

**model** `str` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=InworldHttpTTSService.Settings(model=...)` instead.

**streaming** `bool` (default: True)

Whether to use streaming mode.

**sample\_rate** `int` (default: None)

Audio sample rate in Hz.

**encoding** `str` (default: PCM)

Audio encoding requested from Inworld. The service pushes the returned bytes
as 16-bit mono PCM, so use an uncompressed 16-bit encoding such as the
default.

**timestamp\_transport\_strategy** `Literal["ASYNC", "SYNC"] | None` (default: ASYNC)

How Inworld delivers word timestamps: `"ASYNC"` or `"SYNC"`. `None` omits it
from the request.

**params** `InputParams` *deprecated* (default: None)

*Deprecated since 0.0.105, removed in 2.0.0.* Use
`settings=InworldHttpTTSService.Settings(...)` instead.

**settings** `InworldHttpTTSService.Settings` (default: None)

Runtime-configurable settings. See [InworldTTSService
Settings](#inworldttsservice-settings) below.

## Usage

### Basic Setup (WebSocket)

```python theme={null}
import os

from pipecat.services.inworld.tts import InworldTTSService

tts = InworldTTSService(
    api_key=os.getenv("INWORLD_API_KEY"),
    settings=InworldTTSService.Settings(
        voice="Ashley",
    ),
)
```

### With Custom Settings

```python theme={null}
tts = InworldTTSService(
    api_key=os.getenv("INWORLD_API_KEY"),
    settings=InworldTTSService.Settings(
        voice="Ashley",
        model="inworld-tts-2",
        temperature=0.8,
        speaking_rate=1.1,
    ),
)
```

### HTTP Service

```python theme={null}
import aiohttp
from pipecat.services.inworld.tts import InworldHttpTTSService

async with aiohttp.ClientSession() as session:
    tts = InworldHttpTTSService(
        api_key=os.getenv("INWORLD_API_KEY"),
        aiohttp_session=session,
        settings=InworldHttpTTSService.Settings(voice="Ashley"),
        streaming=True,
    )
```

## Notes

* **WebSocket vs HTTP**: The WebSocket service (`InworldTTSService`) provides the lowest latency with bidirectional streaming and supports multiple independent audio contexts per connection (max 5). The HTTP service supports both streaming and non-streaming modes via the `streaming` parameter.
* **Word timestamps**: Both services provide word-level timestamps for synchronized text display. Timestamps are tracked cumulatively across utterances within a turn. When timestamps are not received from the service, a fallback mechanism ensures the full text is still committed to the LLM conversation context, even on interruption.
* **Auto mode**: When `auto_mode=True` (default), the server controls flushing of buffered text for optimal latency and quality. This is recommended when text is sent in full sentences or phrases (i.e., when using `text_aggregation_mode=TextAggregationMode.SENTENCE`).
* **Keepalive**: The WebSocket service sends periodic keepalive messages every 60 seconds to maintain the connection.
* **Pronunciation hints**: Inworld reads IPA between slashes (e.g., `/kriːt/`), one word per pair of slashes. Only English IPA symbols are supported.

## Event Handlers

`InworldTTSService` supports the standard [service connection events](https://docs.pipecat.ai/api-reference/server/events/service-events.md):

| Event | Description |
| - | - |
| `on_connected` | Connected to Inworld WebSocket |
| `on_disconnected` | Disconnected from Inworld WebSocket |
| `on_connection_error` | WebSocket connection error occurred |

```python theme={null}
@tts.event_handler("on_connected")
async def on_connected(service):
    print("Connected to Inworld")
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.