Class RealtimeSessionCreateResponse
-
- All Implemented Interfaces:
public final class RealtimeSessionCreateResponseA new Realtime session configuration, with an ephemeral key. Default TTL for keys is one minute.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classRealtimeSessionCreateResponse.BuilderA builder for RealtimeSessionCreateResponse.
public final classRealtimeSessionCreateResponse.AudioConfiguration for input and output audio.
public final classRealtimeSessionCreateResponse.Includepublic final classRealtimeSessionCreateResponse.MaxOutputTokensMaximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
inffor the maximum available tokens for a given model. Defaults toinf.public final classRealtimeSessionCreateResponse.ModelThe Realtime model used for this session.
public final classRealtimeSessionCreateResponse.OutputModalitypublic final classRealtimeSessionCreateResponse.ToolChoiceHow the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
public final classRealtimeSessionCreateResponse.ToolGive the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
public final classRealtimeSessionCreateResponse.TracingRealtime API can write session traces to the /logs?api=traces. Set to null to disable tracing. Once tracing is enabled for a session, the configuration cannot be modified.
autowill create a trace for the session with default values for the workflow name, group id, and metadata.
-
Method Summary
-
-
Method Detail
-
clientSecret
final RealtimeSessionClientSecret clientSecret()
Ephemeral key returned by the API.
-
_type
final JsonValue _type()
The type of session to create. Always
realtimefor the Realtime API.Expected to always return the following:
JsonValue.from("realtime")However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
audio
final Optional<RealtimeSessionCreateResponse.Audio> audio()
Configuration for input and output audio.
-
include
final Optional<List<RealtimeSessionCreateResponse.Include>> include()
Additional fields to include in server outputs.
item.input_audio_transcription.logprobs: Include logprobs for input audio transcription.
-
instructions
final Optional<String> instructions()
The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.
Note that the server sets default instructions which will be used if this field is not set and are visible in the
session.createdevent at the start of the session.
-
maxOutputTokens
final Optional<RealtimeSessionCreateResponse.MaxOutputTokens> maxOutputTokens()
Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
inffor the maximum available tokens for a given model. Defaults toinf.
-
model
final Optional<RealtimeSessionCreateResponse.Model> model()
The Realtime model used for this session.
-
outputModalities
final Optional<List<RealtimeSessionCreateResponse.OutputModality>> outputModalities()
The set of modalities the model can respond with. It defaults to
["audio"], indicating that the model will respond with audio plus a transcript.["text"]can be used to make the model respond with text only. It is not possible to request bothtextandaudioat the same time.
-
prompt
final Optional<ResponsePrompt> prompt()
Reference to a prompt template and its variables. Learn more.
-
toolChoice
final Optional<RealtimeSessionCreateResponse.ToolChoice> toolChoice()
How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
-
tools
final Optional<List<RealtimeSessionCreateResponse.Tool>> tools()
Tools available to the model.
-
tracing
final Optional<RealtimeSessionCreateResponse.Tracing> tracing()
Realtime API can write session traces to the /logs?api=traces. Set to null to disable tracing. Once tracing is enabled for a session, the configuration cannot be modified.
autowill create a trace for the session with default values for the workflow name, group id, and metadata.
-
truncation
final Optional<RealtimeTruncation> truncation()
Controls how the realtime conversation is truncated prior to model inference. The default is
auto.
-
_clientSecret
final JsonField<RealtimeSessionClientSecret> _clientSecret()
Returns the raw JSON value of clientSecret.
Unlike clientSecret, this method doesn't throw if the JSON field has an unexpected type.
-
_audio
final JsonField<RealtimeSessionCreateResponse.Audio> _audio()
Returns the raw JSON value of audio.
Unlike audio, this method doesn't throw if the JSON field has an unexpected type.
-
_include
final JsonField<List<RealtimeSessionCreateResponse.Include>> _include()
Returns the raw JSON value of include.
Unlike include, this method doesn't throw if the JSON field has an unexpected type.
-
_instructions
final JsonField<String> _instructions()
Returns the raw JSON value of instructions.
Unlike instructions, this method doesn't throw if the JSON field has an unexpected type.
-
_maxOutputTokens
final JsonField<RealtimeSessionCreateResponse.MaxOutputTokens> _maxOutputTokens()
Returns the raw JSON value of maxOutputTokens.
Unlike maxOutputTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<RealtimeSessionCreateResponse.Model> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_outputModalities
final JsonField<List<RealtimeSessionCreateResponse.OutputModality>> _outputModalities()
Returns the raw JSON value of outputModalities.
Unlike outputModalities, this method doesn't throw if the JSON field has an unexpected type.
-
_prompt
final JsonField<ResponsePrompt> _prompt()
Returns the raw JSON value of prompt.
Unlike prompt, this method doesn't throw if the JSON field has an unexpected type.
-
_toolChoice
final JsonField<RealtimeSessionCreateResponse.ToolChoice> _toolChoice()
Returns the raw JSON value of toolChoice.
Unlike toolChoice, this method doesn't throw if the JSON field has an unexpected type.
-
_tools
final JsonField<List<RealtimeSessionCreateResponse.Tool>> _tools()
Returns the raw JSON value of tools.
Unlike tools, this method doesn't throw if the JSON field has an unexpected type.
-
_tracing
final JsonField<RealtimeSessionCreateResponse.Tracing> _tracing()
Returns the raw JSON value of tracing.
Unlike tracing, this method doesn't throw if the JSON field has an unexpected type.
-
_truncation
final JsonField<RealtimeTruncation> _truncation()
Returns the raw JSON value of truncation.
Unlike truncation, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final RealtimeSessionCreateResponse.Builder toBuilder()
-
validate
final RealtimeSessionCreateResponse validate()
-
builder
final static RealtimeSessionCreateResponse.Builder builder()
Returns a mutable builder for constructing an instance of RealtimeSessionCreateResponse.
The following fields are required:
.clientSecret()
-
-
-
-