UNPKG

@inductiv/node-red-openai-api

Version:

Enhance your Node-RED projects with advanced AI capabilities.

238 lines (231 loc) 10.5 kB
<section> <details> <summary style="font-weight: bold;">📞 Realtime</summary> <a href="https://developers.openai.com/api/reference/typescript/resources/realtime/" target="_blank">Official Documentation <i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a> <h4 style="font-weight: bolder;"> ⋙ Create Realtime Client Secret</h4> <p>Create an ephemeral client secret for browser/mobile realtime sessions.</p> <p>Put Realtime session configuration inside <code>msg.payload.session</code>. Top-level <code>msg.payload</code> is reserved for client-secret options such as <code>expires_after</code>.</p> <dl class="message-properties"> <h4>msg.payload Properties</h4> <dt class="optional"> expires_after <span class="property-type">object</span> </dt> <dd>Optional client-secret expiration config, for example <code>{ "anchor": "created_at", "seconds": 600 }</code>.</dd> <dt class="optional"> session <span class="property-type">object</span> </dt> <dd>Realtime session configuration to attach to the generated client secret.</dd> <dt> session.type <span class="property-type">string</span> </dt> <dd>Use <code>realtime</code> for voice-agent payloads or <code>translation</code> for translation payloads.</dd> <dt class="optional"> session.model <span class="property-type">string</span> </dt> <dd>Session model id, including <code>gpt-realtime-2</code>, <code>gpt-realtime-1.5</code>, <code>gpt-audio-1.5</code>, or translation model ids.</dd> <dt class="optional"> session.reasoning.effort <span class="property-type">string</span> </dt> <dd>Reasoning setting for supported models such as <code>gpt-realtime-2</code>.</dd> <dt class="optional"> session.parallel_tool_calls <span class="property-type">boolean</span> </dt> <dd>Allow parallel tool calls on supported realtime models.</dd> <dt class="optional"> session.instructions <span class="property-type">string</span> </dt> <dd>Default system instructions for the session.</dd> <dt class="optional"> session.include <span class="property-type">array</span> </dt> <dd>Additional server output fields to include, such as <code>item.input_audio_transcription.logprobs</code>.</dd> <dt class="optional"> session.max_output_tokens <span class="property-type">integer | string</span> </dt> <dd>Maximum output tokens per assistant response, or <code>inf</code>.</dd> <dt class="optional"> session.output_modalities <span class="property-type">array</span> </dt> <dd>Output modalities such as <code>text</code> or <code>audio</code>.</dd> <dt class="optional"> session.audio <span class="property-type">object</span> </dt> <dd>Input/output audio config, including <code>session.audio.input.transcription.model</code> such as <code>gpt-realtime-whisper</code>, <code>session.audio.input.transcription.delay</code>, <code>session.audio.input.turn_detection</code>, <code>session.audio.input.noise_reduction</code>, and <code>session.audio.output.language</code>.</dd> <dt class="optional"> session.prompt <span class="property-type">object</span> </dt> <dd>Reusable prompt reference and variables for the session.</dd> <dt class="optional"> session.tools <span class="property-type">array</span> </dt> <dd>Tools available to the realtime model.</dd> <dt class="optional"> session.tool_choice <span class="property-type">string | object</span> </dt> <dd>How tools are selected.</dd> <dt class="optional"> session.tracing <span class="property-type">string | object | null</span> </dt> <dd>Trace configuration for the realtime session.</dd> <dt class="optional"> session.truncation <span class="property-type">string | object</span> </dt> <dd>Conversation truncation behavior for the session.</dd> </dl> <p>See the official docs above for transport, lifecycle, and tuning details.</p> <p>Successful responses are returned in <code>msg.payload</code> with top-level <code>value</code>, <code>expires_at</code>, and <code>session</code> fields.</p> <h4 style="font-weight: bolder;"> ⋙ Accept Realtime Call</h4> <p>Accept an incoming SIP call and attach it to a realtime session.</p> <dl class="message-properties"> <h4>msg.payload Properties</h4> <dt> call_id <span class="property-type">string</span> </dt> <dd>The incoming call id.</dd> <dt> type <span class="property-type">string</span> </dt> <dd>Must be <code>realtime</code>.</dd> <dt class="optional"> include <span class="property-type">array</span> </dt> <dd>Additional server output fields to include, such as <code>item.input_audio_transcription.logprobs</code>.</dd> <dt class="optional"> model <span class="property-type">string</span> </dt> <dd>Realtime model id, including <code>gpt-realtime-2</code>, <code>gpt-realtime-1.5</code>, and <code>gpt-audio-1.5</code>.</dd> <dt class="optional"> reasoning.effort <span class="property-type">string</span> </dt> <dd>Reasoning setting for supported realtime call models.</dd> <dt class="optional"> parallel_tool_calls <span class="property-type">boolean</span> </dt> <dd>Allow multiple parallel tool calls for supported realtime call models.</dd> <dt class="optional"> instructions <span class="property-type">string</span> </dt> <dd>System instructions for the call session.</dd> <dt class="optional"> max_output_tokens <span class="property-type">integer | string</span> </dt> <dd>Maximum output tokens per assistant response, or <code>inf</code>.</dd> <dt class="optional"> output_modalities <span class="property-type">array</span> </dt> <dd>Output modalities such as <code>text</code> or <code>audio</code>.</dd> <dt class="optional"> audio <span class="property-type">object</span> </dt> <dd>Input/output audio config for the accepted call session.</dd> <dt class="optional"> prompt <span class="property-type">object</span> </dt> <dd>Reusable prompt reference and variables for the call session.</dd> <dt class="optional"> tools <span class="property-type">array</span> </dt> <dd>Tools available in the call session.</dd> <dt class="optional"> tool_choice <span class="property-type">string | object</span> </dt> <dd>Tool selection strategy.</dd> <dt class="optional"> tracing <span class="property-type">string | object | null</span> </dt> <dd>Trace configuration for the accepted call session.</dd> <dt class="optional"> truncation <span class="property-type">string | object</span> </dt> <dd>Conversation truncation behavior for the call session.</dd> </dl> <h4 style="font-weight: bolder;"> ⋙ Hangup Realtime Call</h4> <p>Hang up an active realtime call.</p> <dl class="message-properties"> <h4>msg.payload Properties</h4> <dt> call_id <span class="property-type">string</span> </dt> <dd>The call id.</dd> </dl> <h4 style="font-weight: bolder;"> ⋙ Refer Realtime Call</h4> <p>Transfer an active call using SIP REFER.</p> <dl class="message-properties"> <h4>msg.payload Properties</h4> <dt> call_id <span class="property-type">string</span> </dt> <dd>The call id.</dd> <dt> target_uri <span class="property-type">string</span> </dt> <dd>Transfer target URI, for example <code>tel:+14155550123</code>.</dd> </dl> <h4 style="font-weight: bolder;"> ⋙ Reject Realtime Call</h4> <p>Reject an incoming call.</p> <dl class="message-properties"> <h4>msg.payload Properties</h4> <dt> call_id <span class="property-type">string</span> </dt> <dd>The call id.</dd> <dt class="optional"> status_code <span class="property-type">integer</span> </dt> <dd>Optional SIP status code. Default is <code>603</code>.</dd> </dl> <p>Call operations return a small confirmation object in <code>msg.payload</code> when successful.</p> </details> </section>