OpenAI Realtime
Mint short-lived OpenAI Realtime session tokens so browsers and apps connect directly without ever seeing your API key.
This Module creates ephemeral session tokens for OpenAI's Realtime API (live, low-latency voice and transcription). Your workflow hands the token to the client; the client then talks to OpenAI directly. Audio never flows through the platform, and the workspace API key never reaches the client.
How it works
- The Token reaches a Realtime Task; the Task asks OpenAI for an ephemeral session using the Environment's API key.
- The Task saves the session details including a
client_secretthat is valid for roughly 60 seconds. - Your workflow returns the secret to the client (for example via an Output Task or an API response).
- The client uses the secret to open its own connection to the Realtime API and streams audio directly.
Configuration
Each OpenAI Module is configured separately, per Environment this Module has its own API key, so you can reuse the key you set on the core OpenAI Module or use a dedicated one (for example to track this capability's spend on its own).
| Field | Type | Required | Description |
|---|---|---|---|
| OpenAI API Key | string | Yes | Your OpenAI API key (sk-...) for this Module. Stored securely. Find it in OpenAI Console → API keys → Create new secret key. |
| OpenAI Organization | string | No | Your OpenAI organization ID (e.g. org-abc123), if your account belongs to one. |
Tasks
All Tasks in this Module are Generic (all Channels) they run the same regardless of how the Session was started.
Output fields: type a variable name without braces (for example session) and pick its type (string, number, true/false, object, date). The Task saves its result there, and any later Task can use it by writing {session}.
OpenAIRealtimeSessionTokenTask
Mints an ephemeral Realtime session token. The client uses the returned client_secret to connect directly to the Realtime API for about 60 seconds.
| Property | Type | Required | Example | Description |
|---|---|---|---|---|
| Model | string | Yes | gpt-4o-realtime-preview-2024-12-17 | Realtime model. Default: gpt-4o-realtime-preview-2024-12-17. |
| Voice | dropdown | No | alloy | Initial voice for assistant audio output. One of alloy, echo, fable, onyx, nova, shimmer, ash, ballad, coral, sage, verse. Default: empty → OpenAI's default voice. |
| Instructions | string | No | You are a friendly voice agent. | Optional system instructions for the realtime session. Supports {variable} placeholders. |
| Output Variable | object | Yes | session | Variable name (no braces). Receives an entry with client_secret.value, client_secret.expires_at, and the session id. |
Example: Set Model = gpt-4o-realtime-preview-2024-12-17, Voice = alloy, Instructions = You are a friendly voice agent., Output Variable = session. The Task saves the session entry to session; the client reads {session}'s client_secret.value and connects to OpenAI directly before it expires (about 60 seconds later).
OpenAIRealtimeTranscriptionSessionTask
Mints an ephemeral Realtime transcription session token. Same client-direct pattern as OpenAIRealtimeSessionTokenTask, but for streaming transcription only.
| Property | Type | Required | Example | Description |
|---|---|---|---|---|
| Model | string | Yes | gpt-4o-mini-transcribe | Transcription model. Default: gpt-4o-mini-transcribe. |
| Output Variable | object | Yes | session | Variable name (no braces). Receives the session entry with its client_secret. |
Example: Set Model = gpt-4o-mini-transcribe, Output Variable = session. The Task saves the transcription session entry to session; the client uses its client_secret.value to stream audio for live transcription.
Common recipes
Hand a browser a live voice session
When the user asks to talk, mint a fresh Realtime token and return the client_secret so the browser connects to OpenAI directly. Input and Output Tasks come from the Standard Module.
- InputTask Output Variable =
userMessage(the user asks to start a voice chat). - OpenAIRealtimeSessionTokenTask Model =
gpt-4o-realtime-preview-2024-12-17, Voice =alloy, Instructions =You are a friendly voice agent., Output Variable =session. - OutputTask Message =
{session}; the client extractsclient_secret.valueand opens its own Realtime connection immediately the secret expires in about a minute.
Best practices
- Hand the secret over immediately the
client_secretexpires in about a minute; mint it as the last step before the client connects. - Mint per connection request a fresh token for every client connection instead of reusing one.
The returned client_secret grants direct access to the Realtime API until it expires. Send it only to the client that will use it never log it or store it in long-lived Session data.
Error codes
| Code | Name | Description |
|---|---|---|
| 3005 | TaskInvalidData | A required property is missing or an output field is not a valid variable name details |
| 4001 | ModuleException | OpenAI rejected the session request or the call failed details |
| 4008 | ModuleMissingConfiguration | The OpenAI API key is not set in this Module's Environment configuration details |
| 4009 | ModuleInputEmpty | A required input resolved to an empty value at runtime details |
| 4012 | ModuleInvalidData | The Session data could not be read or OpenAI's response could not be processed details |
See the Error Code Reference for the full list.
Related pages
- OpenAI Module the family core chat, embeddings, and moderation Tasks.
- OpenAI Audio request/response text-to-speech and transcription when you don't need a live connection.