RealtimeSessionCreateRequest class
Realtime session configuration.
Used as the embedded session in RealtimeClientSecretCreateRequest
when calling client.realtimeSessions.createClientSecret(...) and as the
payload of the session.update WebSocket event.
Example
final response = await client.realtimeSessions.createClientSecret(
RealtimeClientSecretCreateRequest(
session: RealtimeSessionCreateRequest(
model: 'gpt-realtime-2',
audio: RealtimeAudioConfig(
output: RealtimeAudioConfigOutput(voice: 'alloy'),
),
instructions: 'You are a helpful assistant.',
reasoning: RealtimeReasoning(effort: RealtimeReasoningEffort.minimal),
),
),
);
- Annotations
-
- @immutable
Constructors
-
RealtimeSessionCreateRequest({required String model, String? type, RealtimeAudioConfig? audio, List<
String> ? outputModalities, String? instructions, List<RealtimeTool> ? tools, RealtimeToolChoice? toolChoice, InfOrInt? maxOutputTokens, bool? parallelToolCalls, RealtimeReasoning? reasoning, RealtimeTracingConfig? tracing, RealtimeTruncation? truncation, List<String> ? include}) -
Creates a RealtimeSessionCreateRequest.
const
-
RealtimeSessionCreateRequest.fromJson(Map<
String, dynamic> json) -
Creates a RealtimeSessionCreateRequest from JSON.
factory
Properties
- audio → RealtimeAudioConfig?
-
Nested audio configuration.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
-
include
→ List<
String> ? -
Additional fields to include in server outputs.
final
- instructions → String?
-
System instructions.
final
- maxOutputTokens → InfOrInt?
-
Maximum output tokens (
'inf'or a specific integer).final - model → String
-
The model identifier (required).
final
-
outputModalities
→ List<
String> ? -
Output modalities.
final
- parallelToolCalls → bool?
-
Whether the model may call multiple tools in parallel.
final
- reasoning → RealtimeReasoning?
-
Reasoning configuration.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toolChoice → RealtimeToolChoice?
-
Tool choice setting.
final
-
tools
→ List<
RealtimeTool> ? -
Tools available to the model.
final
- tracing → RealtimeTracingConfig?
-
Tracing configuration.
final
- truncation → RealtimeTruncation?
-
Truncation configuration.
final
- type → String?
-
The session type discriminator.
final
Methods
-
copyWith(
{String? model, Object? type = unsetCopyWithValue, Object? audio = unsetCopyWithValue, Object? outputModalities = unsetCopyWithValue, Object? instructions = unsetCopyWithValue, Object? tools = unsetCopyWithValue, Object? toolChoice = unsetCopyWithValue, Object? maxOutputTokens = unsetCopyWithValue, Object? parallelToolCalls = unsetCopyWithValue, Object? reasoning = unsetCopyWithValue, Object? tracing = unsetCopyWithValue, Object? truncation = unsetCopyWithValue, Object? include = unsetCopyWithValue}) → RealtimeSessionCreateRequest -
Returns a copy of this RealtimeSessionCreateRequest with the given
fields replaced. Pass
nullfor any nullable field to clear the existing value. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts to JSON.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override