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

# OpenAI Realtime

> OpenAI Realtime starter: a Next.js app built with the Simli JavaScript SDK

> [card] [create-simli-app-openai](https://github.com/simliai/create-simli-app-openai)
>
> A Next.js app that talks to OpenAI's Realtime API over WebRTC and speaks the answers through a Simli avatar.

The browser sends your microphone to OpenAI's Realtime API over WebRTC, and plays the voice that comes back through the avatar with the [JavaScript SDK](https://docs.simli.com/api-reference/javascript.md). Both API keys stay on the server:

* `/api/simli-token` creates the Simli [session token](https://docs.simli.com/api-reference/javascript.md#2-create-a-session-token-on-your-server).
* `/api/openai-session` creates the OpenAI call for the browser's WebRTC offer and returns only the answer. The model, voice and prompt are set on the server, in `app/avatar.ts`, and the server hangs up the call when the session's time is up.

To run it, copy `.env.example`, fill in `SIMLI_API_KEY` and `OPENAI_API_KEY`, then run `npm install` and `npm run dev`. The [README](https://github.com/simliai/create-simli-app-openai#readme) has the details, including how to change the face, voice and prompt.

> [!WARNING]
>
> In production, both routes return `403` until you put them behind your own sign-in, because anyone who can call them starts a session on your Simli and OpenAI accounts. See the README's "Before you deploy". The server-side hang-up needs a long-running server; on serverless hosts, see the README.

For an OpenAI agent that runs on a server instead, see [LiveKit Agents](https://docs.simli.com/api-reference/livekit.md) or [Pipecat](https://docs.simli.com/api-reference/pipecat.md).


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