@@ -48,6 +48,8 @@ export type OpenAIRealtimeModels =
4848 | 'gpt-4o-mini-realtime-preview-2024-12-17'
4949 | 'gpt-realtime'
5050 | 'gpt-realtime-2025-08-28'
51+ | 'gpt-realtime-mini'
52+ | 'gpt-realtime-mini-2025-10-06'
5153 | ( string & { } ) ; // ensures autocomplete works
5254
5355/**
@@ -105,6 +107,13 @@ export type OpenAIRealtimeEventTypes = {
105107 disconnected : [ ] ;
106108} & RealtimeTransportEventTypes ;
107109
110+ /**
111+ * Shape of the payload that the Realtime API expects for session.create/update operations.
112+ * This closely mirrors the REST `CallAcceptParams` type so that callers can feed the payload
113+ * directly into the `openai.realtime.calls.accept` helper without casts.
114+ */
115+ export type RealtimeSessionPayload = { type : 'realtime' } & Record < string , any > ;
116+
108117export abstract class OpenAIRealtimeBase
109118 extends EventEmitterDelegate < OpenAIRealtimeEventTypes >
110119 implements RealtimeTransportLayer
@@ -523,10 +532,12 @@ export abstract class OpenAIRealtimeBase
523532 ) ;
524533 }
525534
526- protected _getMergedSessionConfig ( config : Partial < RealtimeSessionConfig > ) {
535+ protected _getMergedSessionConfig (
536+ config : Partial < RealtimeSessionConfig > ,
537+ ) : RealtimeSessionPayload {
527538 const newConfig = toNewSessionConfig ( config ) ;
528539
529- const sessionData : Record < string , any > = {
540+ const sessionData : RealtimeSessionPayload = {
530541 type : 'realtime' ,
531542 instructions : newConfig . instructions ,
532543 model : newConfig . model ?? this . #model,
@@ -588,6 +599,21 @@ export abstract class OpenAIRealtimeBase
588599 return sessionData ;
589600 }
590601
602+ /**
603+ * Build the payload object expected by the Realtime API when creating or updating a session.
604+ *
605+ * The helper centralises the conversion from camelCase runtime config to the snake_case payload
606+ * required by the Realtime API so transports that need a one-off payload (for example SIP call
607+ * acceptance) can reuse the same logic without duplicating private state.
608+ *
609+ * @param config - The session config to merge with defaults.
610+ */
611+ buildSessionPayload (
612+ config : Partial < RealtimeSessionConfig > ,
613+ ) : RealtimeSessionPayload {
614+ return this . _getMergedSessionConfig ( config ) ;
615+ }
616+
591617 private static buildTurnDetectionConfig (
592618 c : RealtimeTurnDetectionConfig | undefined ,
593619 ) : RealtimeTurnDetectionConfigAsIs | undefined {
@@ -735,7 +761,7 @@ export abstract class OpenAIRealtimeBase
735761 * @param config - The session config to update.
736762 */
737763 updateSessionConfig ( config : Partial < RealtimeSessionConfig > ) : void {
738- const sessionData = this . _getMergedSessionConfig ( config ) ;
764+ const sessionData = this . buildSessionPayload ( config ) ;
739765
740766 this . sendEvent ( {
741767 type : 'session.update' ,
0 commit comments