> ## 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.

# PolyAI Dialog-RSN-1

> PolyAI's Dialog-RSN-1 for voice agents, used through the built-in OpenAI Realtime service

> [!NOTE]
>
> **Community-maintained integration.** This service is built and
> maintained by
> [PolyAI](https://github.com/polyai)
> . Pipecat does not test or officially support it. Please report issues and
> request changes on the
> [source repository](https://github.com/polyai/dialog-rsn-1-examples)
> . Learn more about
> [community integrations](https://docs.pipecat.ai/api-reference/server/services/community-integrations.md)
> .

## Overview

[Dialog-RSN-1](https://docs.poly.ai/dialog-rsn-1/overview) is PolyAI's speech-to-text model for
voice agents. It hears the caller, confirms when their turn is over, calls your tools and writes the
reply. PolyAI's realtime API speaks the reply, or streams it as text for a TTS service later in the
pipeline.

The realtime API is wire-compatible with the OpenAI Realtime protocol, so Pipecat's built-in
`OpenAIRealtimeLLMService` connects to it directly: point `base_url` at PolyAI and set the model.
No extra package is needed. Turn detection and barge-in run server-side, and your functions run in
Pipecat as they do with OpenAI.

## Installation

Install the OpenAI extra:

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

## Prerequisites

* A Dialog-RSN-1 API key: sign in at [studio.poly.ai](https://studio.poly.ai) and create one in the
  API Keys tab. Set it as `POLY_API_KEY`.
* A key from studio.poly.ai works on `wss://api.studio.poly.ai/v1/realtime`. A key from a regional
  Studio only works on that region's host, for example `wss://api.us.poly.ai/v1/realtime` for
  studio.us.poly.ai.

## Configuration

Use `OpenAIRealtimeLLMService` with PolyAI's URL and the `dialog-rsn-1` model:

```python theme={null}
import os

from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService

llm = OpenAIRealtimeLLMService(
    api_key=os.environ["POLY_API_KEY"],
    base_url=os.environ.get("DIALOG_REALTIME_URL", "wss://api.studio.poly.ai/v1/realtime"),
    settings=OpenAIRealtimeLLMService.Settings(
        model="dialog-rsn-1",
        system_instruction="You are a friendly voice assistant. Keep replies brief.",
    ),
)
```

Pass `base_url` without a query string: the service appends `?model=` itself. The key goes out as
`Authorization: Bearer`, which the API accepts.

The API speaks the reply by default, so the pipeline needs no TTS service. Queue an `LLMRunFrame`
when the client connects, as in Pipecat's realtime examples, so the bot greets the caller. To speak
the reply with your own TTS service, ask for text and put the TTS after the LLM:

```python theme={null}
from pipecat.services.openai.realtime.events import SessionProperties

settings=OpenAIRealtimeLLMService.Settings(
    model="dialog-rsn-1",
    system_instruction="...",
    session_properties=SessionProperties(output_modalities=["text"]),
)
```

For a server-spoken reply, `AudioOutput(voice=...)` takes a Cartesia voice id; unset, the
deployment's default voice speaks. OpenAI voice names are ignored.

Dialog-RSN-1 rejects some OpenAI session options with `unsupported_parameter`, and the whole
`session.update` with them: a `tool_choice` other than `"auto"`, non-function tools, `prompt`, and
`SemanticTurnDetection(interrupt_response=False)`. Turn timing fields are accepted and ignored.
PolyAI's own session extensions, such as knowledge topics, aren't fields Pipecat's
`SessionProperties` knows, so they can't be set through this service. See the
[Dialog-RSN-1 reference](https://docs.poly.ai/dialog-rsn-1/reference) and the
[OpenAI Realtime](https://docs.pipecat.ai/api-reference/server/services/s2s/openai.md) page for the service's other
parameters.

## Compatibility

Tested with Pipecat v1.16.0 and v1.17.0: spoken and text replies, function calls, and turns from
caller audio. Audio is 16-bit mono PCM at 24 kHz in both directions.

## Resources

> [card] [Pipecat example](https://github.com/polyai/dialog-rsn-1-examples/tree/main/pipecat)
>
> A runnable voice bot with tools, in server-voice and own-TTS modes

> [card] [Dialog-RSN-1 overview](https://docs.poly.ai/dialog-rsn-1/overview)
>
> What the model does and how turn-taking works

> [card] [Dialog-RSN-1 reference](https://docs.poly.ai/dialog-rsn-1/reference)
>
> The realtime protocol, session options and error codes

> [card] [PolyAI Studio](https://studio.poly.ai)
>
> Create a Dialog-RSN-1 API key


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