realtime

package
v3.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ChatModelChatgpt4oLatest = shared.ChatModelChatgpt4oLatest

Equals "chatgpt-4o-latest"

View Source
const ChatModelCodexMiniLatest = shared.ChatModelCodexMiniLatest

Equals "codex-mini-latest"

View Source
const ChatModelGPT3_5Turbo = shared.ChatModelGPT3_5Turbo

Equals "gpt-3.5-turbo"

View Source
const ChatModelGPT3_5Turbo0125 = shared.ChatModelGPT3_5Turbo0125

Equals "gpt-3.5-turbo-0125"

View Source
const ChatModelGPT3_5Turbo0301 = shared.ChatModelGPT3_5Turbo0301

Equals "gpt-3.5-turbo-0301"

View Source
const ChatModelGPT3_5Turbo0613 = shared.ChatModelGPT3_5Turbo0613

Equals "gpt-3.5-turbo-0613"

View Source
const ChatModelGPT3_5Turbo1106 = shared.ChatModelGPT3_5Turbo1106

Equals "gpt-3.5-turbo-1106"

View Source
const ChatModelGPT3_5Turbo16k = shared.ChatModelGPT3_5Turbo16k

Equals "gpt-3.5-turbo-16k"

View Source
const ChatModelGPT3_5Turbo16k0613 = shared.ChatModelGPT3_5Turbo16k0613

Equals "gpt-3.5-turbo-16k-0613"

View Source
const ChatModelGPT4 = shared.ChatModelGPT4

Equals "gpt-4"

View Source
const ChatModelGPT4Turbo = shared.ChatModelGPT4Turbo

Equals "gpt-4-turbo"

View Source
const ChatModelGPT4Turbo2024_04_09 = shared.ChatModelGPT4Turbo2024_04_09

Equals "gpt-4-turbo-2024-04-09"

View Source
const ChatModelGPT4TurboPreview = shared.ChatModelGPT4TurboPreview

Equals "gpt-4-turbo-preview"

View Source
const ChatModelGPT4VisionPreview = shared.ChatModelGPT4VisionPreview

Equals "gpt-4-vision-preview"

View Source
const ChatModelGPT4_0125Preview = shared.ChatModelGPT4_0125Preview

Equals "gpt-4-0125-preview"

View Source
const ChatModelGPT4_0314 = shared.ChatModelGPT4_0314

Equals "gpt-4-0314"

View Source
const ChatModelGPT4_0613 = shared.ChatModelGPT4_0613

Equals "gpt-4-0613"

View Source
const ChatModelGPT4_1 = shared.ChatModelGPT4_1

Equals "gpt-4.1"

View Source
const ChatModelGPT4_1106Preview = shared.ChatModelGPT4_1106Preview

Equals "gpt-4-1106-preview"

View Source
const ChatModelGPT4_1Mini = shared.ChatModelGPT4_1Mini

Equals "gpt-4.1-mini"

View Source
const ChatModelGPT4_1Mini2025_04_14 = shared.ChatModelGPT4_1Mini2025_04_14

Equals "gpt-4.1-mini-2025-04-14"

View Source
const ChatModelGPT4_1Nano = shared.ChatModelGPT4_1Nano

Equals "gpt-4.1-nano"

View Source
const ChatModelGPT4_1Nano2025_04_14 = shared.ChatModelGPT4_1Nano2025_04_14

Equals "gpt-4.1-nano-2025-04-14"

View Source
const ChatModelGPT4_1_2025_04_14 = shared.ChatModelGPT4_1_2025_04_14

Equals "gpt-4.1-2025-04-14"

View Source
const ChatModelGPT4_32k = shared.ChatModelGPT4_32k

Equals "gpt-4-32k"

View Source
const ChatModelGPT4_32k0314 = shared.ChatModelGPT4_32k0314

Equals "gpt-4-32k-0314"

View Source
const ChatModelGPT4_32k0613 = shared.ChatModelGPT4_32k0613

Equals "gpt-4-32k-0613"

View Source
const ChatModelGPT4o = shared.ChatModelGPT4o

Equals "gpt-4o"

View Source
const ChatModelGPT4o2024_05_13 = shared.ChatModelGPT4o2024_05_13

Equals "gpt-4o-2024-05-13"

View Source
const ChatModelGPT4o2024_08_06 = shared.ChatModelGPT4o2024_08_06

Equals "gpt-4o-2024-08-06"

View Source
const ChatModelGPT4o2024_11_20 = shared.ChatModelGPT4o2024_11_20

Equals "gpt-4o-2024-11-20"

View Source
const ChatModelGPT4oAudioPreview = shared.ChatModelGPT4oAudioPreview

Equals "gpt-4o-audio-preview"

View Source
const ChatModelGPT4oAudioPreview2024_10_01 = shared.ChatModelGPT4oAudioPreview2024_10_01

Equals "gpt-4o-audio-preview-2024-10-01"

View Source
const ChatModelGPT4oAudioPreview2024_12_17 = shared.ChatModelGPT4oAudioPreview2024_12_17

Equals "gpt-4o-audio-preview-2024-12-17"

View Source
const ChatModelGPT4oAudioPreview2025_06_03 = shared.ChatModelGPT4oAudioPreview2025_06_03

Equals "gpt-4o-audio-preview-2025-06-03"

View Source
const ChatModelGPT4oMini = shared.ChatModelGPT4oMini

Equals "gpt-4o-mini"

View Source
const ChatModelGPT4oMini2024_07_18 = shared.ChatModelGPT4oMini2024_07_18

Equals "gpt-4o-mini-2024-07-18"

View Source
const ChatModelGPT4oMiniAudioPreview = shared.ChatModelGPT4oMiniAudioPreview

Equals "gpt-4o-mini-audio-preview"

View Source
const ChatModelGPT4oMiniAudioPreview2024_12_17 = shared.ChatModelGPT4oMiniAudioPreview2024_12_17

Equals "gpt-4o-mini-audio-preview-2024-12-17"

View Source
const ChatModelGPT4oMiniSearchPreview = shared.ChatModelGPT4oMiniSearchPreview

Equals "gpt-4o-mini-search-preview"

View Source
const ChatModelGPT4oMiniSearchPreview2025_03_11 = shared.ChatModelGPT4oMiniSearchPreview2025_03_11

Equals "gpt-4o-mini-search-preview-2025-03-11"

View Source
const ChatModelGPT4oSearchPreview = shared.ChatModelGPT4oSearchPreview

Equals "gpt-4o-search-preview"

View Source
const ChatModelGPT4oSearchPreview2025_03_11 = shared.ChatModelGPT4oSearchPreview2025_03_11

Equals "gpt-4o-search-preview-2025-03-11"

View Source
const ChatModelGPT5 = shared.ChatModelGPT5

Equals "gpt-5"

View Source
const ChatModelGPT5ChatLatest = shared.ChatModelGPT5ChatLatest

Equals "gpt-5-chat-latest"

View Source
const ChatModelGPT5Mini = shared.ChatModelGPT5Mini

Equals "gpt-5-mini"

View Source
const ChatModelGPT5Mini2025_08_07 = shared.ChatModelGPT5Mini2025_08_07

Equals "gpt-5-mini-2025-08-07"

View Source
const ChatModelGPT5Nano = shared.ChatModelGPT5Nano

Equals "gpt-5-nano"

View Source
const ChatModelGPT5Nano2025_08_07 = shared.ChatModelGPT5Nano2025_08_07

Equals "gpt-5-nano-2025-08-07"

View Source
const ChatModelGPT5_2025_08_07 = shared.ChatModelGPT5_2025_08_07

Equals "gpt-5-2025-08-07"

View Source
const ChatModelO1 = shared.ChatModelO1

Equals "o1"

View Source
const ChatModelO1Mini = shared.ChatModelO1Mini

Equals "o1-mini"

View Source
const ChatModelO1Mini2024_09_12 = shared.ChatModelO1Mini2024_09_12

Equals "o1-mini-2024-09-12"

View Source
const ChatModelO1Preview = shared.ChatModelO1Preview

Equals "o1-preview"

View Source
const ChatModelO1Preview2024_09_12 = shared.ChatModelO1Preview2024_09_12

Equals "o1-preview-2024-09-12"

View Source
const ChatModelO1_2024_12_17 = shared.ChatModelO1_2024_12_17

Equals "o1-2024-12-17"

View Source
const ChatModelO3 = shared.ChatModelO3

Equals "o3"

View Source
const ChatModelO3Mini = shared.ChatModelO3Mini

Equals "o3-mini"

View Source
const ChatModelO3Mini2025_01_31 = shared.ChatModelO3Mini2025_01_31

Equals "o3-mini-2025-01-31"

View Source
const ChatModelO3_2025_04_16 = shared.ChatModelO3_2025_04_16

Equals "o3-2025-04-16"

View Source
const ChatModelO4Mini = shared.ChatModelO4Mini

Equals "o4-mini"

View Source
const ChatModelO4Mini2025_04_16 = shared.ChatModelO4Mini2025_04_16

Equals "o4-mini-2025-04-16"

View Source
const ComparisonFilterTypeEq = shared.ComparisonFilterTypeEq

Equals "eq"

View Source
const ComparisonFilterTypeGt = shared.ComparisonFilterTypeGt

Equals "gt"

View Source
const ComparisonFilterTypeGte = shared.ComparisonFilterTypeGte

Equals "gte"

View Source
const ComparisonFilterTypeLt = shared.ComparisonFilterTypeLt

Equals "lt"

View Source
const ComparisonFilterTypeLte = shared.ComparisonFilterTypeLte

Equals "lte"

View Source
const ComparisonFilterTypeNe = shared.ComparisonFilterTypeNe

Equals "ne"

View Source
const CompoundFilterTypeAnd = shared.CompoundFilterTypeAnd

Equals "and"

View Source
const CompoundFilterTypeOr = shared.CompoundFilterTypeOr

Equals "or"

View Source
const ReasoningEffortHigh = shared.ReasoningEffortHigh

Equals "high"

View Source
const ReasoningEffortLow = shared.ReasoningEffortLow

Equals "low"

View Source
const ReasoningEffortMedium = shared.ReasoningEffortMedium

Equals "medium"

View Source
const ReasoningEffortMinimal = shared.ReasoningEffortMinimal

Equals "minimal"

View Source
const ReasoningGenerateSummaryAuto = shared.ReasoningGenerateSummaryAuto

Equals "auto"

View Source
const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise

Equals "concise"

View Source
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed

Equals "detailed"

View Source
const ReasoningSummaryAuto = shared.ReasoningSummaryAuto

Equals "auto"

View Source
const ReasoningSummaryConcise = shared.ReasoningSummaryConcise

Equals "concise"

View Source
const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed

Equals "detailed"

View Source
const ResponsesModelComputerUsePreview = shared.ResponsesModelComputerUsePreview

Equals "computer-use-preview"

View Source
const ResponsesModelComputerUsePreview2025_03_11 = shared.ResponsesModelComputerUsePreview2025_03_11

Equals "computer-use-preview-2025-03-11"

View Source
const ResponsesModelGPT5Codex = shared.ResponsesModelGPT5Codex

Equals "gpt-5-codex"

View Source
const ResponsesModelGPT5Pro = shared.ResponsesModelGPT5Pro

Equals "gpt-5-pro"

View Source
const ResponsesModelGPT5Pro2025_10_06 = shared.ResponsesModelGPT5Pro2025_10_06

Equals "gpt-5-pro-2025-10-06"

View Source
const ResponsesModelO1Pro = shared.ResponsesModelO1Pro

Equals "o1-pro"

View Source
const ResponsesModelO1Pro2025_03_19 = shared.ResponsesModelO1Pro2025_03_19

Equals "o1-pro-2025-03-19"

View Source
const ResponsesModelO3DeepResearch = shared.ResponsesModelO3DeepResearch

Equals "o3-deep-research"

View Source
const ResponsesModelO3DeepResearch2025_06_26 = shared.ResponsesModelO3DeepResearch2025_06_26

Equals "o3-deep-research-2025-06-26"

View Source
const ResponsesModelO3Pro = shared.ResponsesModelO3Pro

Equals "o3-pro"

View Source
const ResponsesModelO3Pro2025_06_10 = shared.ResponsesModelO3Pro2025_06_10

Equals "o3-pro-2025-06-10"

View Source
const ResponsesModelO4MiniDeepResearch = shared.ResponsesModelO4MiniDeepResearch

Equals "o4-mini-deep-research"

View Source
const ResponsesModelO4MiniDeepResearch2025_06_26 = shared.ResponsesModelO4MiniDeepResearch2025_06_26

Equals "o4-mini-deep-research-2025-06-26"

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioTranscription

type AudioTranscription struct {
	// The language of the input audio. Supplying the input language in
	// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
	// format will improve accuracy and latency.
	Language string `json:"language"`
	// The model to use for transcription. Current options are `whisper-1`,
	// `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`.
	// Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
	//
	// Any of "whisper-1", "gpt-4o-mini-transcribe", "gpt-4o-transcribe",
	// "gpt-4o-transcribe-diarize".
	Model AudioTranscriptionModel `json:"model"`
	// An optional text to guide the model's style or continue a previous audio
	// segment. For `whisper-1`, the
	// [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
	// For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the
	// prompt is a free text string, for example "expect words related to technology".
	Prompt string `json:"prompt"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Language    respjson.Field
		Model       respjson.Field
		Prompt      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranscription) RawJSON

func (r AudioTranscription) RawJSON() string

Returns the unmodified JSON received from the API

func (AudioTranscription) ToParam

ToParam converts this AudioTranscription to a AudioTranscriptionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with AudioTranscriptionParam.Overrides()

func (*AudioTranscription) UnmarshalJSON

func (r *AudioTranscription) UnmarshalJSON(data []byte) error

type AudioTranscriptionModel

type AudioTranscriptionModel string

The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.

const (
	AudioTranscriptionModelWhisper1               AudioTranscriptionModel = "whisper-1"
	AudioTranscriptionModelGPT4oMiniTranscribe    AudioTranscriptionModel = "gpt-4o-mini-transcribe"
	AudioTranscriptionModelGPT4oTranscribe        AudioTranscriptionModel = "gpt-4o-transcribe"
	AudioTranscriptionModelGPT4oTranscribeDiarize AudioTranscriptionModel = "gpt-4o-transcribe-diarize"
)

type AudioTranscriptionParam

type AudioTranscriptionParam struct {
	// The language of the input audio. Supplying the input language in
	// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
	// format will improve accuracy and latency.
	Language param.Opt[string] `json:"language,omitzero"`
	// An optional text to guide the model's style or continue a previous audio
	// segment. For `whisper-1`, the
	// [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
	// For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the
	// prompt is a free text string, for example "expect words related to technology".
	Prompt param.Opt[string] `json:"prompt,omitzero"`
	// The model to use for transcription. Current options are `whisper-1`,
	// `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`.
	// Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
	//
	// Any of "whisper-1", "gpt-4o-mini-transcribe", "gpt-4o-transcribe",
	// "gpt-4o-transcribe-diarize".
	Model AudioTranscriptionModel `json:"model,omitzero"`
	// contains filtered or unexported fields
}

func (AudioTranscriptionParam) MarshalJSON

func (r AudioTranscriptionParam) MarshalJSON() (data []byte, err error)

func (*AudioTranscriptionParam) UnmarshalJSON

func (r *AudioTranscriptionParam) UnmarshalJSON(data []byte) error

type CallAcceptParams added in v3.1.0

type CallAcceptParams struct {
	// Realtime session object configuration.
	RealtimeSessionCreateRequest RealtimeSessionCreateRequestParam
	// contains filtered or unexported fields
}

func (CallAcceptParams) MarshalJSON added in v3.1.0

func (r CallAcceptParams) MarshalJSON() (data []byte, err error)

func (*CallAcceptParams) UnmarshalJSON added in v3.1.0

func (r *CallAcceptParams) UnmarshalJSON(data []byte) error

type CallReferParams added in v3.1.0

type CallReferParams struct {
	// URI that should appear in the SIP Refer-To header. Supports values like
	// `tel:+14155550123` or `sip:agent@example.com`.
	TargetUri string `json:"target_uri,required"`
	// contains filtered or unexported fields
}

func (CallReferParams) MarshalJSON added in v3.1.0

func (r CallReferParams) MarshalJSON() (data []byte, err error)

func (*CallReferParams) UnmarshalJSON added in v3.1.0

func (r *CallReferParams) UnmarshalJSON(data []byte) error

type CallRejectParams added in v3.1.0

type CallRejectParams struct {
	// SIP response code to send back to the caller. Defaults to `603` (Decline) when
	// omitted.
	StatusCode param.Opt[int64] `json:"status_code,omitzero"`
	// contains filtered or unexported fields
}

func (CallRejectParams) MarshalJSON added in v3.1.0

func (r CallRejectParams) MarshalJSON() (data []byte, err error)

func (*CallRejectParams) UnmarshalJSON added in v3.1.0

func (r *CallRejectParams) UnmarshalJSON(data []byte) error

type CallService added in v3.1.0

type CallService struct {
	Options []option.RequestOption
}

CallService contains methods and other services that help with interacting with the openai API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCallService method instead.

func NewCallService added in v3.1.0

func NewCallService(opts ...option.RequestOption) (r CallService)

NewCallService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CallService) Accept added in v3.1.0

func (r *CallService) Accept(ctx context.Context, callID string, body CallAcceptParams, opts ...option.RequestOption) (err error)

Accept an incoming SIP call and configure the realtime session that will handle it.

func (*CallService) Hangup added in v3.1.0

func (r *CallService) Hangup(ctx context.Context, callID string, opts ...option.RequestOption) (err error)

End an active Realtime API call, whether it was initiated over SIP or WebRTC.

func (*CallService) Refer added in v3.1.0

func (r *CallService) Refer(ctx context.Context, callID string, body CallReferParams, opts ...option.RequestOption) (err error)

Transfer an active SIP call to a new destination using the SIP REFER verb.

func (*CallService) Reject added in v3.1.0

func (r *CallService) Reject(ctx context.Context, callID string, body CallRejectParams, opts ...option.RequestOption) (err error)

Decline an incoming SIP call by returning a SIP status code to the caller.

type ChatModel

type ChatModel = shared.ChatModel

This is an alias to an internal type.

type ClientSecretNewParams

type ClientSecretNewParams struct {
	// Configuration for the client secret expiration. Expiration refers to the time
	// after which a client secret will no longer be valid for creating sessions. The
	// session itself may continue after that time once started. A secret can be used
	// to create multiple sessions until it expires.
	ExpiresAfter ClientSecretNewParamsExpiresAfter `json:"expires_after,omitzero"`
	// Session configuration to use for the client secret. Choose either a realtime
	// session or a transcription session.
	Session ClientSecretNewParamsSessionUnion `json:"session,omitzero"`
	// contains filtered or unexported fields
}

func (ClientSecretNewParams) MarshalJSON

func (r ClientSecretNewParams) MarshalJSON() (data []byte, err error)

func (*ClientSecretNewParams) UnmarshalJSON

func (r *ClientSecretNewParams) UnmarshalJSON(data []byte) error

type ClientSecretNewParamsExpiresAfter

type ClientSecretNewParamsExpiresAfter struct {
	// The number of seconds from the anchor point to the expiration. Select a value
	// between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if
	// not specified.
	Seconds param.Opt[int64] `json:"seconds,omitzero"`
	// The anchor point for the client secret expiration, meaning that `seconds` will
	// be added to the `created_at` time of the client secret to produce an expiration
	// timestamp. Only `created_at` is currently supported.
	//
	// Any of "created_at".
	Anchor string `json:"anchor,omitzero"`
	// contains filtered or unexported fields
}

Configuration for the client secret expiration. Expiration refers to the time after which a client secret will no longer be valid for creating sessions. The session itself may continue after that time once started. A secret can be used to create multiple sessions until it expires.

func (ClientSecretNewParamsExpiresAfter) MarshalJSON

func (r ClientSecretNewParamsExpiresAfter) MarshalJSON() (data []byte, err error)

func (*ClientSecretNewParamsExpiresAfter) UnmarshalJSON

func (r *ClientSecretNewParamsExpiresAfter) UnmarshalJSON(data []byte) error

type ClientSecretNewParamsSessionUnion

type ClientSecretNewParamsSessionUnion struct {
	OfRealtime      *RealtimeSessionCreateRequestParam              `json:",omitzero,inline"`
	OfTranscription *RealtimeTranscriptionSessionCreateRequestParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ClientSecretNewParamsSessionUnion) GetAudio

func (u ClientSecretNewParamsSessionUnion) GetAudio() (res clientSecretNewParamsSessionUnionAudio)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (ClientSecretNewParamsSessionUnion) GetInclude

func (u ClientSecretNewParamsSessionUnion) GetInclude() []string

Returns a pointer to the underlying variant's Include property, if present.

func (ClientSecretNewParamsSessionUnion) GetInstructions

func (u ClientSecretNewParamsSessionUnion) GetInstructions() *string

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetMaxOutputTokens

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetModel

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetOutputModalities

func (u ClientSecretNewParamsSessionUnion) GetOutputModalities() []string

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetPrompt

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetToolChoice

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetTools

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetTracing

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetTruncation

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (ClientSecretNewParamsSessionUnion) MarshalJSON

func (u ClientSecretNewParamsSessionUnion) MarshalJSON() ([]byte, error)

func (*ClientSecretNewParamsSessionUnion) UnmarshalJSON

func (u *ClientSecretNewParamsSessionUnion) UnmarshalJSON(data []byte) error

type ClientSecretNewResponse

type ClientSecretNewResponse struct {
	// Expiration timestamp for the client secret, in seconds since epoch.
	ExpiresAt int64 `json:"expires_at,required"`
	// The session configuration for either a realtime or transcription session.
	Session ClientSecretNewResponseSessionUnion `json:"session,required"`
	// The generated client secret value.
	Value string `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExpiresAt   respjson.Field
		Session     respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response from creating a session and client secret for the Realtime API.

func (ClientSecretNewResponse) RawJSON

func (r ClientSecretNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ClientSecretNewResponse) UnmarshalJSON

func (r *ClientSecretNewResponse) UnmarshalJSON(data []byte) error

type ClientSecretNewResponseSessionUnion

type ClientSecretNewResponseSessionUnion struct {
	// This field is from variant [RealtimeSessionCreateResponse].
	ClientSecret RealtimeSessionClientSecret `json:"client_secret"`
	// Any of "realtime", "transcription".
	Type string `json:"type"`
	// This field is a union of [RealtimeSessionCreateResponseAudio],
	// [RealtimeTranscriptionSessionCreateResponseAudio]
	Audio   ClientSecretNewResponseSessionUnionAudio `json:"audio"`
	Include []string                                 `json:"include"`
	// This field is from variant [RealtimeSessionCreateResponse].
	Instructions string `json:"instructions"`
	// This field is from variant [RealtimeSessionCreateResponse].
	MaxOutputTokens RealtimeSessionCreateResponseMaxOutputTokensUnion `json:"max_output_tokens"`
	// This field is from variant [RealtimeSessionCreateResponse].
	Model RealtimeSessionCreateResponseModel `json:"model"`
	// This field is from variant [RealtimeSessionCreateResponse].
	OutputModalities []string `json:"output_modalities"`
	// This field is from variant [RealtimeSessionCreateResponse].
	Prompt responses.ResponsePrompt `json:"prompt"`
	// This field is from variant [RealtimeSessionCreateResponse].
	ToolChoice RealtimeSessionCreateResponseToolChoiceUnion `json:"tool_choice"`
	// This field is from variant [RealtimeSessionCreateResponse].
	Tools []RealtimeSessionCreateResponseToolUnion `json:"tools"`
	// This field is from variant [RealtimeSessionCreateResponse].
	Tracing RealtimeSessionCreateResponseTracingUnion `json:"tracing"`
	// This field is from variant [RealtimeSessionCreateResponse].
	Truncation RealtimeTruncationUnion `json:"truncation"`
	// This field is from variant [RealtimeTranscriptionSessionCreateResponse].
	ID string `json:"id"`
	// This field is from variant [RealtimeTranscriptionSessionCreateResponse].
	Object string `json:"object"`
	// This field is from variant [RealtimeTranscriptionSessionCreateResponse].
	ExpiresAt int64 `json:"expires_at"`
	JSON      struct {
		ClientSecret     respjson.Field
		Type             respjson.Field
		Audio            respjson.Field
		Include          respjson.Field
		Instructions     respjson.Field
		MaxOutputTokens  respjson.Field
		Model            respjson.Field
		OutputModalities respjson.Field
		Prompt           respjson.Field
		ToolChoice       respjson.Field
		Tools            respjson.Field
		Tracing          respjson.Field
		Truncation       respjson.Field
		ID               respjson.Field
		Object           respjson.Field
		ExpiresAt        respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ClientSecretNewResponseSessionUnion contains all possible properties and values from RealtimeSessionCreateResponse, RealtimeTranscriptionSessionCreateResponse.

Use the ClientSecretNewResponseSessionUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ClientSecretNewResponseSessionUnion) AsAny

func (u ClientSecretNewResponseSessionUnion) AsAny() anyClientSecretNewResponseSession

Use the following switch statement to find the correct variant

switch variant := ClientSecretNewResponseSessionUnion.AsAny().(type) {
case realtime.RealtimeSessionCreateResponse:
case realtime.RealtimeTranscriptionSessionCreateResponse:
default:
  fmt.Errorf("no variant present")
}

func (ClientSecretNewResponseSessionUnion) AsRealtime

func (ClientSecretNewResponseSessionUnion) AsTranscription

func (ClientSecretNewResponseSessionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ClientSecretNewResponseSessionUnion) UnmarshalJSON

func (r *ClientSecretNewResponseSessionUnion) UnmarshalJSON(data []byte) error

type ClientSecretNewResponseSessionUnionAudio

type ClientSecretNewResponseSessionUnionAudio struct {
	// This field is a union of [RealtimeSessionCreateResponseAudioInput],
	// [RealtimeTranscriptionSessionCreateResponseAudioInput]
	Input ClientSecretNewResponseSessionUnionAudioInput `json:"input"`
	// This field is from variant [RealtimeSessionCreateResponseAudio].
	Output RealtimeSessionCreateResponseAudioOutput `json:"output"`
	JSON   struct {
		Input  respjson.Field
		Output respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ClientSecretNewResponseSessionUnionAudio is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudio provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.

func (*ClientSecretNewResponseSessionUnionAudio) UnmarshalJSON

func (r *ClientSecretNewResponseSessionUnionAudio) UnmarshalJSON(data []byte) error

type ClientSecretNewResponseSessionUnionAudioInput

type ClientSecretNewResponseSessionUnionAudioInput struct {
	// This field is from variant [RealtimeSessionCreateResponseAudioInput].
	Format RealtimeAudioFormatsUnion `json:"format"`
	// This field is a union of
	// [RealtimeSessionCreateResponseAudioInputNoiseReduction],
	// [RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction]
	NoiseReduction ClientSecretNewResponseSessionUnionAudioInputNoiseReduction `json:"noise_reduction"`
	// This field is from variant [RealtimeSessionCreateResponseAudioInput].
	Transcription AudioTranscription `json:"transcription"`
	// This field is a union of
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionUnion],
	// [RealtimeTranscriptionSessionTurnDetection]
	TurnDetection ClientSecretNewResponseSessionUnionAudioInputTurnDetection `json:"turn_detection"`
	JSON          struct {
		Format         respjson.Field
		NoiseReduction respjson.Field
		Transcription  respjson.Field
		TurnDetection  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ClientSecretNewResponseSessionUnionAudioInput is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudioInput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.

func (*ClientSecretNewResponseSessionUnionAudioInput) UnmarshalJSON

func (r *ClientSecretNewResponseSessionUnionAudioInput) UnmarshalJSON(data []byte) error

type ClientSecretNewResponseSessionUnionAudioInputNoiseReduction

type ClientSecretNewResponseSessionUnionAudioInputNoiseReduction struct {
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputNoiseReduction].
	Type NoiseReductionType `json:"type"`
	JSON struct {
		Type respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ClientSecretNewResponseSessionUnionAudioInputNoiseReduction is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudioInputNoiseReduction provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.

func (*ClientSecretNewResponseSessionUnionAudioInputNoiseReduction) UnmarshalJSON

type ClientSecretNewResponseSessionUnionAudioInputTurnDetection

type ClientSecretNewResponseSessionUnionAudioInputTurnDetection struct {
	Type           string `json:"type"`
	CreateResponse bool   `json:"create_response"`
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionUnion].
	IdleTimeoutMs     int64   `json:"idle_timeout_ms"`
	InterruptResponse bool    `json:"interrupt_response"`
	PrefixPaddingMs   int64   `json:"prefix_padding_ms"`
	SilenceDurationMs int64   `json:"silence_duration_ms"`
	Threshold         float64 `json:"threshold"`
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionUnion].
	Eagerness string `json:"eagerness"`
	JSON      struct {
		Type              respjson.Field
		CreateResponse    respjson.Field
		IdleTimeoutMs     respjson.Field
		InterruptResponse respjson.Field
		PrefixPaddingMs   respjson.Field
		SilenceDurationMs respjson.Field
		Threshold         respjson.Field
		Eagerness         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ClientSecretNewResponseSessionUnionAudioInputTurnDetection is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudioInputTurnDetection provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.

func (*ClientSecretNewResponseSessionUnionAudioInputTurnDetection) UnmarshalJSON

type ClientSecretService

type ClientSecretService struct {
	Options []option.RequestOption
}

ClientSecretService contains methods and other services that help with interacting with the openai API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewClientSecretService method instead.

func NewClientSecretService

func NewClientSecretService(opts ...option.RequestOption) (r ClientSecretService)

NewClientSecretService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ClientSecretService) New

Create a Realtime client secret with an associated session configuration.

type ComparisonFilter

type ComparisonFilter = shared.ComparisonFilter

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

This is an alias to an internal type.

type ComparisonFilterParam

type ComparisonFilterParam = shared.ComparisonFilterParam

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

This is an alias to an internal type.

type ComparisonFilterType

type ComparisonFilterType = shared.ComparisonFilterType

Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.

- `eq`: equals - `ne`: not equal - `gt`: greater than - `gte`: greater than or equal - `lt`: less than - `lte`: less than or equal - `in`: in - `nin`: not in

This is an alias to an internal type.

type ComparisonFilterValueArrayItemUnion added in v3.3.0

type ComparisonFilterValueArrayItemUnion = shared.ComparisonFilterValueArrayItemUnion

This is an alias to an internal type.

type ComparisonFilterValueArrayItemUnionParam added in v3.3.0

type ComparisonFilterValueArrayItemUnionParam = shared.ComparisonFilterValueArrayItemUnionParam

This is an alias to an internal type.

type ComparisonFilterValueUnion

type ComparisonFilterValueUnion = shared.ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

This is an alias to an internal type.

type ComparisonFilterValueUnionParam

type ComparisonFilterValueUnionParam = shared.ComparisonFilterValueUnionParam

The value to compare against the attribute key; supports string, number, or boolean types.

This is an alias to an internal type.

type CompoundFilter

type CompoundFilter = shared.CompoundFilter

Combine multiple filters using `and` or `or`.

This is an alias to an internal type.

type CompoundFilterParam

type CompoundFilterParam = shared.CompoundFilterParam

Combine multiple filters using `and` or `or`.

This is an alias to an internal type.

type CompoundFilterType

type CompoundFilterType = shared.CompoundFilterType

Type of operation: `and` or `or`.

This is an alias to an internal type.

type CustomToolInputFormatGrammar

type CustomToolInputFormatGrammar = shared.CustomToolInputFormatGrammar

A grammar defined by the user.

This is an alias to an internal type.

type CustomToolInputFormatGrammarParam

type CustomToolInputFormatGrammarParam = shared.CustomToolInputFormatGrammarParam

A grammar defined by the user.

This is an alias to an internal type.

type CustomToolInputFormatText

type CustomToolInputFormatText = shared.CustomToolInputFormatText

Unconstrained free-form text.

This is an alias to an internal type.

type CustomToolInputFormatTextParam

type CustomToolInputFormatTextParam = shared.CustomToolInputFormatTextParam

Unconstrained free-form text.

This is an alias to an internal type.

type CustomToolInputFormatUnion

type CustomToolInputFormatUnion = shared.CustomToolInputFormatUnion

The input format for the custom tool. Default is unconstrained text.

This is an alias to an internal type.

type CustomToolInputFormatUnionParam

type CustomToolInputFormatUnionParam = shared.CustomToolInputFormatUnionParam

The input format for the custom tool. Default is unconstrained text.

This is an alias to an internal type.

type Error

type Error = apierror.Error

type ErrorObject

type ErrorObject = shared.ErrorObject

This is an alias to an internal type.

type FunctionDefinition

type FunctionDefinition = shared.FunctionDefinition

This is an alias to an internal type.

type FunctionDefinitionParam

type FunctionDefinitionParam = shared.FunctionDefinitionParam

This is an alias to an internal type.

type FunctionParameters

type FunctionParameters = shared.FunctionParameters

The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

Omitting `parameters` defines a function with an empty parameter list.

This is an alias to an internal type.

type Metadata

type Metadata = shared.Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

This is an alias to an internal type.

type NoiseReductionType

type NoiseReductionType string

Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.

const (
	NoiseReductionTypeNearField NoiseReductionType = "near_field"
	NoiseReductionTypeFarField  NoiseReductionType = "far_field"
)

type RealtimeAudioConfigInputNoiseReductionParam

type RealtimeAudioConfigInputNoiseReductionParam struct {
	// Type of noise reduction. `near_field` is for close-talking microphones such as
	// headphones, `far_field` is for far-field microphones such as laptop or
	// conference room microphones.
	//
	// Any of "near_field", "far_field".
	Type NoiseReductionType `json:"type,omitzero"`
	// contains filtered or unexported fields
}

Configuration for input audio noise reduction. This can be set to `null` to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.

func (RealtimeAudioConfigInputNoiseReductionParam) MarshalJSON

func (r RealtimeAudioConfigInputNoiseReductionParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioConfigInputNoiseReductionParam) UnmarshalJSON

func (r *RealtimeAudioConfigInputNoiseReductionParam) UnmarshalJSON(data []byte) error

type RealtimeAudioConfigInputParam

type RealtimeAudioConfigInputParam struct {
	// Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
	// set to `null` to turn off, in which case the client must manually trigger model
	// response.
	//
	// Server VAD means that the model will detect the start and end of speech based on
	// audio volume and respond at the end of user speech.
	//
	// Semantic VAD is more advanced and uses a turn detection model (in conjunction
	// with VAD) to semantically estimate whether the user has finished speaking, then
	// dynamically sets a timeout based on this probability. For example, if user audio
	// trails off with "uhhm", the model will score a low probability of turn end and
	// wait longer for the user to continue speaking. This can be useful for more
	// natural conversations, but may have a higher latency.
	TurnDetection RealtimeAudioInputTurnDetectionUnionParam `json:"turn_detection,omitzero"`
	// The format of the input audio.
	Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
	// Configuration for input audio noise reduction. This can be set to `null` to turn
	// off. Noise reduction filters audio added to the input audio buffer before it is
	// sent to VAD and the model. Filtering the audio can improve VAD and turn
	// detection accuracy (reducing false positives) and model performance by improving
	// perception of the input audio.
	NoiseReduction RealtimeAudioConfigInputNoiseReductionParam `json:"noise_reduction,omitzero"`
	// Configuration for input audio transcription, defaults to off and can be set to
	// `null` to turn off once on. Input audio transcription is not native to the
	// model, since the model consumes audio directly. Transcription runs
	// asynchronously through
	// [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
	// and should be treated as guidance of input audio content rather than precisely
	// what the model heard. The client can optionally set the language and prompt for
	// transcription, these offer additional guidance to the transcription service.
	Transcription AudioTranscriptionParam `json:"transcription,omitzero"`
	// contains filtered or unexported fields
}

func (RealtimeAudioConfigInputParam) MarshalJSON

func (r RealtimeAudioConfigInputParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioConfigInputParam) UnmarshalJSON

func (r *RealtimeAudioConfigInputParam) UnmarshalJSON(data []byte) error

type RealtimeAudioConfigOutputParam

type RealtimeAudioConfigOutputParam struct {
	// The speed of the model's spoken response as a multiple of the original speed.
	// 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed.
	// This value can only be changed in between model turns, not while a response is
	// in progress.
	//
	// This parameter is a post-processing adjustment to the audio after it is
	// generated, it's also possible to prompt the model to speak faster or slower.
	Speed param.Opt[float64] `json:"speed,omitzero"`
	// The format of the output audio.
	Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
	// The voice the model uses to respond. Voice cannot be changed during the session
	// once the model has responded with audio at least once. Current voice options are
	// `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`,
	// and `cedar`. We recommend `marin` and `cedar` for best quality.
	Voice RealtimeAudioConfigOutputVoice `json:"voice,omitzero"`
	// contains filtered or unexported fields
}

func (RealtimeAudioConfigOutputParam) MarshalJSON

func (r RealtimeAudioConfigOutputParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioConfigOutputParam) UnmarshalJSON

func (r *RealtimeAudioConfigOutputParam) UnmarshalJSON(data []byte) error

type RealtimeAudioConfigOutputVoice

type RealtimeAudioConfigOutputVoice string

The voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for best quality.

const (
	RealtimeAudioConfigOutputVoiceAlloy   RealtimeAudioConfigOutputVoice = "alloy"
	RealtimeAudioConfigOutputVoiceAsh     RealtimeAudioConfigOutputVoice = "ash"
	RealtimeAudioConfigOutputVoiceBallad  RealtimeAudioConfigOutputVoice = "ballad"
	RealtimeAudioConfigOutputVoiceCoral   RealtimeAudioConfigOutputVoice = "coral"
	RealtimeAudioConfigOutputVoiceEcho    RealtimeAudioConfigOutputVoice = "echo"
	RealtimeAudioConfigOutputVoiceSage    RealtimeAudioConfigOutputVoice = "sage"
	RealtimeAudioConfigOutputVoiceShimmer RealtimeAudioConfigOutputVoice = "shimmer"
	RealtimeAudioConfigOutputVoiceVerse   RealtimeAudioConfigOutputVoice = "verse"
	RealtimeAudioConfigOutputVoiceMarin   RealtimeAudioConfigOutputVoice = "marin"
	RealtimeAudioConfigOutputVoiceCedar   RealtimeAudioConfigOutputVoice = "cedar"
)

type RealtimeAudioConfigParam

type RealtimeAudioConfigParam struct {
	Input  RealtimeAudioConfigInputParam  `json:"input,omitzero"`
	Output RealtimeAudioConfigOutputParam `json:"output,omitzero"`
	// contains filtered or unexported fields
}

Configuration for input and output audio.

func (RealtimeAudioConfigParam) MarshalJSON

func (r RealtimeAudioConfigParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioConfigParam) UnmarshalJSON

func (r *RealtimeAudioConfigParam) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsAudioPCM

type RealtimeAudioFormatsAudioPCM struct {
	// The sample rate of the audio. Always `24000`.
	//
	// Any of 24000.
	Rate int64 `json:"rate"`
	// The audio format. Always `audio/pcm`.
	//
	// Any of "audio/pcm".
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Rate        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The PCM audio format. Only a 24kHz sample rate is supported.

func (RealtimeAudioFormatsAudioPCM) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeAudioFormatsAudioPCM) UnmarshalJSON

func (r *RealtimeAudioFormatsAudioPCM) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsAudioPCMA

type RealtimeAudioFormatsAudioPCMA struct {
	// The audio format. Always `audio/pcma`.
	//
	// Any of "audio/pcma".
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The G.711 A-law format.

func (RealtimeAudioFormatsAudioPCMA) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeAudioFormatsAudioPCMA) UnmarshalJSON

func (r *RealtimeAudioFormatsAudioPCMA) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsAudioPCMAParam

type RealtimeAudioFormatsAudioPCMAParam struct {
	// The audio format. Always `audio/pcma`.
	//
	// Any of "audio/pcma".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

The G.711 A-law format.

func (RealtimeAudioFormatsAudioPCMAParam) MarshalJSON

func (r RealtimeAudioFormatsAudioPCMAParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioFormatsAudioPCMAParam) UnmarshalJSON

func (r *RealtimeAudioFormatsAudioPCMAParam) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsAudioPCMParam

type RealtimeAudioFormatsAudioPCMParam struct {
	// The sample rate of the audio. Always `24000`.
	//
	// Any of 24000.
	Rate int64 `json:"rate,omitzero"`
	// The audio format. Always `audio/pcm`.
	//
	// Any of "audio/pcm".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

The PCM audio format. Only a 24kHz sample rate is supported.

func (RealtimeAudioFormatsAudioPCMParam) MarshalJSON

func (r RealtimeAudioFormatsAudioPCMParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioFormatsAudioPCMParam) UnmarshalJSON

func (r *RealtimeAudioFormatsAudioPCMParam) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsAudioPCMU

type RealtimeAudioFormatsAudioPCMU struct {
	// The audio format. Always `audio/pcmu`.
	//
	// Any of "audio/pcmu".
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The G.711 μ-law format.

func (RealtimeAudioFormatsAudioPCMU) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeAudioFormatsAudioPCMU) UnmarshalJSON

func (r *RealtimeAudioFormatsAudioPCMU) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsAudioPCMUParam

type RealtimeAudioFormatsAudioPCMUParam struct {
	// The audio format. Always `audio/pcmu`.
	//
	// Any of "audio/pcmu".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

The G.711 μ-law format.

func (RealtimeAudioFormatsAudioPCMUParam) MarshalJSON

func (r RealtimeAudioFormatsAudioPCMUParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioFormatsAudioPCMUParam) UnmarshalJSON

func (r *RealtimeAudioFormatsAudioPCMUParam) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsUnion

type RealtimeAudioFormatsUnion struct {
	// This field is from variant [RealtimeAudioFormatsAudioPCM].
	Rate int64 `json:"rate"`
	// Any of "audio/pcm", "audio/pcmu", "audio/pcma".
	Type string `json:"type"`
	JSON struct {
		Rate respjson.Field
		Type respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeAudioFormatsUnion contains all possible properties and values from RealtimeAudioFormatsAudioPCM, RealtimeAudioFormatsAudioPCMU, RealtimeAudioFormatsAudioPCMA.

Use the RealtimeAudioFormatsUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (RealtimeAudioFormatsUnion) AsAny

func (u RealtimeAudioFormatsUnion) AsAny() anyRealtimeAudioFormats

Use the following switch statement to find the correct variant

switch variant := RealtimeAudioFormatsUnion.AsAny().(type) {
case realtime.RealtimeAudioFormatsAudioPCM:
case realtime.RealtimeAudioFormatsAudioPCMU:
case realtime.RealtimeAudioFormatsAudioPCMA:
default:
  fmt.Errorf("no variant present")
}

func (RealtimeAudioFormatsUnion) AsAudioPCM

func (RealtimeAudioFormatsUnion) AsAudioPCMA

func (RealtimeAudioFormatsUnion) AsAudioPCMU

func (RealtimeAudioFormatsUnion) RawJSON

func (u RealtimeAudioFormatsUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (RealtimeAudioFormatsUnion) ToParam

ToParam converts this RealtimeAudioFormatsUnion to a RealtimeAudioFormatsUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RealtimeAudioFormatsUnionParam.Overrides()

func (*RealtimeAudioFormatsUnion) UnmarshalJSON

func (r *RealtimeAudioFormatsUnion) UnmarshalJSON(data []byte) error

type RealtimeAudioFormatsUnionParam

type RealtimeAudioFormatsUnionParam struct {
	OfAudioPCM  *RealtimeAudioFormatsAudioPCMParam  `json:",omitzero,inline"`
	OfAudioPCMU *RealtimeAudioFormatsAudioPCMUParam `json:",omitzero,inline"`
	OfAudioPCMA *RealtimeAudioFormatsAudioPCMAParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RealtimeAudioFormatsUnionParam) GetRate

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioFormatsUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioFormatsUnionParam) MarshalJSON

func (u RealtimeAudioFormatsUnionParam) MarshalJSON() ([]byte, error)

func (*RealtimeAudioFormatsUnionParam) UnmarshalJSON

func (u *RealtimeAudioFormatsUnionParam) UnmarshalJSON(data []byte) error

type RealtimeAudioInputTurnDetectionSemanticVadParam

type RealtimeAudioInputTurnDetectionSemanticVadParam struct {
	// Whether or not to automatically generate a response when a VAD stop event
	// occurs.
	CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
	// Whether or not to automatically interrupt any ongoing response with output to
	// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
	// occurs.
	InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
	// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
	// will wait longer for the user to continue speaking, `high` will respond more
	// quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`,
	// and `high` have max timeouts of 8s, 4s, and 2s respectively.
	//
	// Any of "low", "medium", "high", "auto".
	Eagerness string `json:"eagerness,omitzero"`
	// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
	//
	// This field can be elided, and will marshal its zero value as "semantic_vad".
	Type constant.SemanticVad `json:"type,required"`
	// contains filtered or unexported fields
}

Server-side semantic turn detection which uses a model to determine when the user has finished speaking.

The property Type is required.

func (RealtimeAudioInputTurnDetectionSemanticVadParam) MarshalJSON

func (r RealtimeAudioInputTurnDetectionSemanticVadParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioInputTurnDetectionSemanticVadParam) UnmarshalJSON

type RealtimeAudioInputTurnDetectionServerVadParam

type RealtimeAudioInputTurnDetectionServerVadParam struct {
	// Optional timeout after which a model response will be triggered automatically.
	// This is useful for situations in which a long pause from the user is unexpected,
	// such as a phone call. The model will effectively prompt the user to continue the
	// conversation based on the current context.
	//
	// The timeout value will be applied after the last model response's audio has
	// finished playing, i.e. it's set to the `response.done` time plus audio playback
	// duration.
	//
	// An `input_audio_buffer.timeout_triggered` event (plus events associated with the
	// Response) will be emitted when the timeout is reached. Idle timeout is currently
	// only supported for `server_vad` mode.
	IdleTimeoutMs param.Opt[int64] `json:"idle_timeout_ms,omitzero"`
	// Whether or not to automatically generate a response when a VAD stop event
	// occurs.
	CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
	// Whether or not to automatically interrupt any ongoing response with output to
	// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
	// occurs.
	InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
	// Used only for `server_vad` mode. Amount of audio to include before the VAD
	// detected speech (in milliseconds). Defaults to 300ms.
	PrefixPaddingMs param.Opt[int64] `json:"prefix_padding_ms,omitzero"`
	// Used only for `server_vad` mode. Duration of silence to detect speech stop (in
	// milliseconds). Defaults to 500ms. With shorter values the model will respond
	// more quickly, but may jump in on short pauses from the user.
	SilenceDurationMs param.Opt[int64] `json:"silence_duration_ms,omitzero"`
	// Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
	// defaults to 0.5. A higher threshold will require louder audio to activate the
	// model, and thus might perform better in noisy environments.
	Threshold param.Opt[float64] `json:"threshold,omitzero"`
	// Type of turn detection, `server_vad` to turn on simple Server VAD.
	//
	// This field can be elided, and will marshal its zero value as "server_vad".
	Type constant.ServerVad `json:"type,required"`
	// contains filtered or unexported fields
}

Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.

The property Type is required.

func (RealtimeAudioInputTurnDetectionServerVadParam) MarshalJSON

func (r RealtimeAudioInputTurnDetectionServerVadParam) MarshalJSON() (data []byte, err error)

func (*RealtimeAudioInputTurnDetectionServerVadParam) UnmarshalJSON

func (r *RealtimeAudioInputTurnDetectionServerVadParam) UnmarshalJSON(data []byte) error

type RealtimeAudioInputTurnDetectionUnionParam

type RealtimeAudioInputTurnDetectionUnionParam struct {
	OfServerVad   *RealtimeAudioInputTurnDetectionServerVadParam   `json:",omitzero,inline"`
	OfSemanticVad *RealtimeAudioInputTurnDetectionSemanticVadParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RealtimeAudioInputTurnDetectionUnionParam) GetCreateResponse

func (u RealtimeAudioInputTurnDetectionUnionParam) GetCreateResponse() *bool

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) GetEagerness

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs

func (u RealtimeAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs() *int64

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) GetInterruptResponse

func (u RealtimeAudioInputTurnDetectionUnionParam) GetInterruptResponse() *bool

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs

func (u RealtimeAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs() *int64

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) GetSilenceDurationMs

func (u RealtimeAudioInputTurnDetectionUnionParam) GetSilenceDurationMs() *int64

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) GetThreshold

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (RealtimeAudioInputTurnDetectionUnionParam) MarshalJSON

func (*RealtimeAudioInputTurnDetectionUnionParam) UnmarshalJSON

func (u *RealtimeAudioInputTurnDetectionUnionParam) UnmarshalJSON(data []byte) error

type RealtimeFunctionTool

type RealtimeFunctionTool struct {
	// The description of the function, including guidance on when and how to call it,
	// and guidance about what to tell the user when calling (if anything).
	Description string `json:"description"`
	// The name of the function.
	Name string `json:"name"`
	// Parameters of the function in JSON Schema.
	Parameters any `json:"parameters"`
	// The type of the tool, i.e. `function`.
	//
	// Any of "function".
	Type RealtimeFunctionToolType `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Name        respjson.Field
		Parameters  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RealtimeFunctionTool) RawJSON

func (r RealtimeFunctionTool) RawJSON() string

Returns the unmodified JSON received from the API

func (RealtimeFunctionTool) ToParam

ToParam converts this RealtimeFunctionTool to a RealtimeFunctionToolParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RealtimeFunctionToolParam.Overrides()

func (*RealtimeFunctionTool) UnmarshalJSON

func (r *RealtimeFunctionTool) UnmarshalJSON(data []byte) error

type RealtimeFunctionToolParam

type RealtimeFunctionToolParam struct {
	// The description of the function, including guidance on when and how to call it,
	// and guidance about what to tell the user when calling (if anything).
	Description param.Opt[string] `json:"description,omitzero"`
	// The name of the function.
	Name param.Opt[string] `json:"name,omitzero"`
	// Parameters of the function in JSON Schema.
	Parameters any `json:"parameters,omitzero"`
	// The type of the tool, i.e. `function`.
	//
	// Any of "function".
	Type RealtimeFunctionToolType `json:"type,omitzero"`
	// contains filtered or unexported fields
}

func (RealtimeFunctionToolParam) MarshalJSON

func (r RealtimeFunctionToolParam) MarshalJSON() (data []byte, err error)

func (*RealtimeFunctionToolParam) UnmarshalJSON

func (r *RealtimeFunctionToolParam) UnmarshalJSON(data []byte) error

type RealtimeFunctionToolType

type RealtimeFunctionToolType string

The type of the tool, i.e. `function`.

const (
	RealtimeFunctionToolTypeFunction RealtimeFunctionToolType = "function"
)

type RealtimeService

type RealtimeService struct {
	Options       []option.RequestOption
	ClientSecrets ClientSecretService
	Calls         CallService
}

RealtimeService contains methods and other services that help with interacting with the openai API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRealtimeService method instead.

func NewRealtimeService

func NewRealtimeService(opts ...option.RequestOption) (r RealtimeService)

NewRealtimeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type RealtimeSessionClientSecret

type RealtimeSessionClientSecret struct {
	// Timestamp for when the token expires. Currently, all tokens expire after one
	// minute.
	ExpiresAt int64 `json:"expires_at,required"`
	// Ephemeral key usable in client environments to authenticate connections to the
	// Realtime API. Use this in client-side environments rather than a standard API
	// token, which should only be used server-side.
	Value string `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExpiresAt   respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Ephemeral key returned by the API.

func (RealtimeSessionClientSecret) RawJSON

func (r RealtimeSessionClientSecret) RawJSON() string

Returns the unmodified JSON received from the API

func (*RealtimeSessionClientSecret) UnmarshalJSON

func (r *RealtimeSessionClientSecret) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateRequestMaxOutputTokensUnionParam

type RealtimeSessionCreateRequestMaxOutputTokensUnionParam struct {
	OfInt param.Opt[int64] `json:",omitzero,inline"`
	// Construct this variant with constant.ValueOf[constant.Inf]()
	OfInf constant.Inf `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RealtimeSessionCreateRequestMaxOutputTokensUnionParam) MarshalJSON

func (*RealtimeSessionCreateRequestMaxOutputTokensUnionParam) UnmarshalJSON

type RealtimeSessionCreateRequestModel

type RealtimeSessionCreateRequestModel = string

The Realtime model used for this session.

const (
	RealtimeSessionCreateRequestModelGPTRealtime                        RealtimeSessionCreateRequestModel = "gpt-realtime"
	RealtimeSessionCreateRequestModelGPTRealtime2025_08_28              RealtimeSessionCreateRequestModel = "gpt-realtime-2025-08-28"
	RealtimeSessionCreateRequestModelGPT4oRealtimePreview               RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview"
	RealtimeSessionCreateRequestModelGPT4oRealtimePreview2024_10_01     RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2024-10-01"
	RealtimeSessionCreateRequestModelGPT4oRealtimePreview2024_12_17     RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2024-12-17"
	RealtimeSessionCreateRequestModelGPT4oRealtimePreview2025_06_03     RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2025-06-03"
	RealtimeSessionCreateRequestModelGPT4oMiniRealtimePreview           RealtimeSessionCreateRequestModel = "gpt-4o-mini-realtime-preview"
	RealtimeSessionCreateRequestModelGPT4oMiniRealtimePreview2024_12_17 RealtimeSessionCreateRequestModel = "gpt-4o-mini-realtime-preview-2024-12-17"
	RealtimeSessionCreateRequestModelGPTRealtimeMini                    RealtimeSessionCreateRequestModel = "gpt-realtime-mini"
	RealtimeSessionCreateRequestModelGPTRealtimeMini2025_10_06          RealtimeSessionCreateRequestModel = "gpt-realtime-mini-2025-10-06"
	RealtimeSessionCreateRequestModelGPTAudioMini                       RealtimeSessionCreateRequestModel = "gpt-audio-mini"
	RealtimeSessionCreateRequestModelGPTAudioMini2025_10_06             RealtimeSessionCreateRequestModel = "gpt-audio-mini-2025-10-06"
)

type RealtimeSessionCreateRequestParam

type RealtimeSessionCreateRequestParam struct {
	// 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.created` event at the start of the
	// session.
	Instructions param.Opt[string] `json:"instructions,omitzero"`
	// Reference to a prompt template and its variables.
	// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
	Prompt responses.ResponsePromptParam `json:"prompt,omitzero"`
	// Realtime API can write session traces to the
	// [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
	// tracing is enabled for a session, the configuration cannot be modified.
	//
	// `auto` will create a trace for the session with default values for the workflow
	// name, group id, and metadata.
	Tracing RealtimeTracingConfigUnionParam `json:"tracing,omitzero"`
	// Configuration for input and output audio.
	Audio RealtimeAudioConfigParam `json:"audio,omitzero"`
	// Additional fields to include in server outputs.
	//
	// `item.input_audio_transcription.logprobs`: Include logprobs for input audio
	// transcription.
	//
	// Any of "item.input_audio_transcription.logprobs".
	Include []string `json:"include,omitzero"`
	// 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
	// `inf` for the maximum available tokens for a given model. Defaults to `inf`.
	MaxOutputTokens RealtimeSessionCreateRequestMaxOutputTokensUnionParam `json:"max_output_tokens,omitzero"`
	// The Realtime model used for this session.
	Model RealtimeSessionCreateRequestModel `json:"model,omitzero"`
	// 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 both `text` and `audio` at the same time.
	//
	// Any of "text", "audio".
	OutputModalities []string `json:"output_modalities,omitzero"`
	// How the model chooses tools. Provide one of the string modes or force a specific
	// function/MCP tool.
	ToolChoice RealtimeToolChoiceConfigUnionParam `json:"tool_choice,omitzero"`
	// Tools available to the model.
	Tools RealtimeToolsConfigParam `json:"tools,omitzero"`
	// Controls how the realtime conversation is truncated prior to model inference.
	// The default is `auto`.
	Truncation RealtimeTruncationUnionParam `json:"truncation,omitzero"`
	// The type of session to create. Always `realtime` for the Realtime API.
	//
	// This field can be elided, and will marshal its zero value as "realtime".
	Type constant.Realtime `json:"type,required"`
	// contains filtered or unexported fields
}

Realtime session object configuration.

The property Type is required.

func (RealtimeSessionCreateRequestParam) MarshalJSON

func (r RealtimeSessionCreateRequestParam) MarshalJSON() (data []byte, err error)

func (*RealtimeSessionCreateRequestParam) UnmarshalJSON

func (r *RealtimeSessionCreateRequestParam) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponse

type RealtimeSessionCreateResponse struct {
	// Ephemeral key returned by the API.
	ClientSecret RealtimeSessionClientSecret `json:"client_secret,required"`
	// The type of session to create. Always `realtime` for the Realtime API.
	Type constant.Realtime `json:"type,required"`
	// Configuration for input and output audio.
	Audio RealtimeSessionCreateResponseAudio `json:"audio"`
	// Additional fields to include in server outputs.
	//
	// `item.input_audio_transcription.logprobs`: Include logprobs for input audio
	// transcription.
	//
	// Any of "item.input_audio_transcription.logprobs".
	Include []string `json:"include"`
	// 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.created` event at the start of the
	// session.
	Instructions string `json:"instructions"`
	// 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
	// `inf` for the maximum available tokens for a given model. Defaults to `inf`.
	MaxOutputTokens RealtimeSessionCreateResponseMaxOutputTokensUnion `json:"max_output_tokens"`
	// The Realtime model used for this session.
	Model RealtimeSessionCreateResponseModel `json:"model"`
	// 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 both `text` and `audio` at the same time.
	//
	// Any of "text", "audio".
	OutputModalities []string `json:"output_modalities"`
	// Reference to a prompt template and its variables.
	// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
	Prompt responses.ResponsePrompt `json:"prompt,nullable"`
	// How the model chooses tools. Provide one of the string modes or force a specific
	// function/MCP tool.
	ToolChoice RealtimeSessionCreateResponseToolChoiceUnion `json:"tool_choice"`
	// Tools available to the model.
	Tools []RealtimeSessionCreateResponseToolUnion `json:"tools"`
	// Realtime API can write session traces to the
	// [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
	// tracing is enabled for a session, the configuration cannot be modified.
	//
	// `auto` will create a trace for the session with default values for the workflow
	// name, group id, and metadata.
	Tracing RealtimeSessionCreateResponseTracingUnion `json:"tracing,nullable"`
	// Controls how the realtime conversation is truncated prior to model inference.
	// The default is `auto`.
	Truncation RealtimeTruncationUnion `json:"truncation"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ClientSecret     respjson.Field
		Type             respjson.Field
		Audio            respjson.Field
		Include          respjson.Field
		Instructions     respjson.Field
		MaxOutputTokens  respjson.Field
		Model            respjson.Field
		OutputModalities respjson.Field
		Prompt           respjson.Field
		ToolChoice       respjson.Field
		Tools            respjson.Field
		Tracing          respjson.Field
		Truncation       respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A new Realtime session configuration, with an ephemeral key. Default TTL for keys is one minute.

func (RealtimeSessionCreateResponse) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponse) UnmarshalJSON

func (r *RealtimeSessionCreateResponse) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponseAudio

type RealtimeSessionCreateResponseAudio struct {
	Input  RealtimeSessionCreateResponseAudioInput  `json:"input"`
	Output RealtimeSessionCreateResponseAudioOutput `json:"output"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Input       respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for input and output audio.

func (RealtimeSessionCreateResponseAudio) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseAudio) UnmarshalJSON

func (r *RealtimeSessionCreateResponseAudio) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponseAudioInput

type RealtimeSessionCreateResponseAudioInput struct {
	// The format of the input audio.
	Format RealtimeAudioFormatsUnion `json:"format"`
	// Configuration for input audio noise reduction. This can be set to `null` to turn
	// off. Noise reduction filters audio added to the input audio buffer before it is
	// sent to VAD and the model. Filtering the audio can improve VAD and turn
	// detection accuracy (reducing false positives) and model performance by improving
	// perception of the input audio.
	NoiseReduction RealtimeSessionCreateResponseAudioInputNoiseReduction `json:"noise_reduction"`
	// Configuration for input audio transcription, defaults to off and can be set to
	// `null` to turn off once on. Input audio transcription is not native to the
	// model, since the model consumes audio directly. Transcription runs
	// asynchronously through
	// [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
	// and should be treated as guidance of input audio content rather than precisely
	// what the model heard. The client can optionally set the language and prompt for
	// transcription, these offer additional guidance to the transcription service.
	Transcription AudioTranscription `json:"transcription"`
	// Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
	// set to `null` to turn off, in which case the client must manually trigger model
	// response.
	//
	// Server VAD means that the model will detect the start and end of speech based on
	// audio volume and respond at the end of user speech.
	//
	// Semantic VAD is more advanced and uses a turn detection model (in conjunction
	// with VAD) to semantically estimate whether the user has finished speaking, then
	// dynamically sets a timeout based on this probability. For example, if user audio
	// trails off with "uhhm", the model will score a low probability of turn end and
	// wait longer for the user to continue speaking. This can be useful for more
	// natural conversations, but may have a higher latency.
	TurnDetection RealtimeSessionCreateResponseAudioInputTurnDetectionUnion `json:"turn_detection,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Format         respjson.Field
		NoiseReduction respjson.Field
		Transcription  respjson.Field
		TurnDetection  respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RealtimeSessionCreateResponseAudioInput) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseAudioInput) UnmarshalJSON

func (r *RealtimeSessionCreateResponseAudioInput) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponseAudioInputNoiseReduction

type RealtimeSessionCreateResponseAudioInputNoiseReduction struct {
	// Type of noise reduction. `near_field` is for close-talking microphones such as
	// headphones, `far_field` is for far-field microphones such as laptop or
	// conference room microphones.
	//
	// Any of "near_field", "far_field".
	Type NoiseReductionType `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for input audio noise reduction. This can be set to `null` to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.

func (RealtimeSessionCreateResponseAudioInputNoiseReduction) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseAudioInputNoiseReduction) UnmarshalJSON

type RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad

type RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad struct {
	// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
	Type constant.SemanticVad `json:"type,required"`
	// Whether or not to automatically generate a response when a VAD stop event
	// occurs.
	CreateResponse bool `json:"create_response"`
	// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
	// will wait longer for the user to continue speaking, `high` will respond more
	// quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`,
	// and `high` have max timeouts of 8s, 4s, and 2s respectively.
	//
	// Any of "low", "medium", "high", "auto".
	Eagerness string `json:"eagerness"`
	// Whether or not to automatically interrupt any ongoing response with output to
	// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
	// occurs.
	InterruptResponse bool `json:"interrupt_response"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type              respjson.Field
		CreateResponse    respjson.Field
		Eagerness         respjson.Field
		InterruptResponse respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Server-side semantic turn detection which uses a model to determine when the user has finished speaking.

func (RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad) UnmarshalJSON

type RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad

type RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad struct {
	// Type of turn detection, `server_vad` to turn on simple Server VAD.
	Type constant.ServerVad `json:"type,required"`
	// Whether or not to automatically generate a response when a VAD stop event
	// occurs.
	CreateResponse bool `json:"create_response"`
	// Optional timeout after which a model response will be triggered automatically.
	// This is useful for situations in which a long pause from the user is unexpected,
	// such as a phone call. The model will effectively prompt the user to continue the
	// conversation based on the current context.
	//
	// The timeout value will be applied after the last model response's audio has
	// finished playing, i.e. it's set to the `response.done` time plus audio playback
	// duration.
	//
	// An `input_audio_buffer.timeout_triggered` event (plus events associated with the
	// Response) will be emitted when the timeout is reached. Idle timeout is currently
	// only supported for `server_vad` mode.
	IdleTimeoutMs int64 `json:"idle_timeout_ms,nullable"`
	// Whether or not to automatically interrupt any ongoing response with output to
	// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
	// occurs.
	InterruptResponse bool `json:"interrupt_response"`
	// Used only for `server_vad` mode. Amount of audio to include before the VAD
	// detected speech (in milliseconds). Defaults to 300ms.
	PrefixPaddingMs int64 `json:"prefix_padding_ms"`
	// Used only for `server_vad` mode. Duration of silence to detect speech stop (in
	// milliseconds). Defaults to 500ms. With shorter values the model will respond
	// more quickly, but may jump in on short pauses from the user.
	SilenceDurationMs int64 `json:"silence_duration_ms"`
	// Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
	// defaults to 0.5. A higher threshold will require louder audio to activate the
	// model, and thus might perform better in noisy environments.
	Threshold float64 `json:"threshold"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type              respjson.Field
		CreateResponse    respjson.Field
		IdleTimeoutMs     respjson.Field
		InterruptResponse respjson.Field
		PrefixPaddingMs   respjson.Field
		SilenceDurationMs respjson.Field
		Threshold         respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.

func (RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad) UnmarshalJSON

type RealtimeSessionCreateResponseAudioInputTurnDetectionUnion

type RealtimeSessionCreateResponseAudioInputTurnDetectionUnion struct {
	// Any of "server_vad", "semantic_vad".
	Type           string `json:"type"`
	CreateResponse bool   `json:"create_response"`
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
	IdleTimeoutMs     int64 `json:"idle_timeout_ms"`
	InterruptResponse bool  `json:"interrupt_response"`
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
	PrefixPaddingMs int64 `json:"prefix_padding_ms"`
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
	SilenceDurationMs int64 `json:"silence_duration_ms"`
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
	Threshold float64 `json:"threshold"`
	// This field is from variant
	// [RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad].
	Eagerness string `json:"eagerness"`
	JSON      struct {
		Type              respjson.Field
		CreateResponse    respjson.Field
		IdleTimeoutMs     respjson.Field
		InterruptResponse respjson.Field
		PrefixPaddingMs   respjson.Field
		SilenceDurationMs respjson.Field
		Threshold         respjson.Field
		Eagerness         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeSessionCreateResponseAudioInputTurnDetectionUnion contains all possible properties and values from RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad, RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad.

Use the RealtimeSessionCreateResponseAudioInputTurnDetectionUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsAny

func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsAny() anyRealtimeSessionCreateResponseAudioInputTurnDetection

Use the following switch statement to find the correct variant

switch variant := RealtimeSessionCreateResponseAudioInputTurnDetectionUnion.AsAny().(type) {
case realtime.RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad:
case realtime.RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad:
default:
  fmt.Errorf("no variant present")
}

func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsSemanticVad

func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsServerVad

func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) UnmarshalJSON

type RealtimeSessionCreateResponseAudioOutput

type RealtimeSessionCreateResponseAudioOutput struct {
	// The format of the output audio.
	Format RealtimeAudioFormatsUnion `json:"format"`
	// The speed of the model's spoken response as a multiple of the original speed.
	// 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed.
	// This value can only be changed in between model turns, not while a response is
	// in progress.
	//
	// This parameter is a post-processing adjustment to the audio after it is
	// generated, it's also possible to prompt the model to speak faster or slower.
	Speed float64 `json:"speed"`
	// The voice the model uses to respond. Voice cannot be changed during the session
	// once the model has responded with audio at least once. Current voice options are
	// `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`,
	// and `cedar`. We recommend `marin` and `cedar` for best quality.
	Voice string `json:"voice"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Format      respjson.Field
		Speed       respjson.Field
		Voice       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RealtimeSessionCreateResponseAudioOutput) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseAudioOutput) UnmarshalJSON

func (r *RealtimeSessionCreateResponseAudioOutput) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponseMaxOutputTokensUnion

type RealtimeSessionCreateResponseMaxOutputTokensUnion struct {
	// This field will be present if the value is a [int64] instead of an object.
	OfInt int64 `json:",inline"`
	// This field will be present if the value is a [constant.Inf] instead of an
	// object.
	OfInf constant.Inf `json:",inline"`
	JSON  struct {
		OfInt respjson.Field
		OfInf respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeSessionCreateResponseMaxOutputTokensUnion contains all possible properties and values from [int64], constant.Inf.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfInt OfInf]

func (RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInf

func (RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInt

func (RealtimeSessionCreateResponseMaxOutputTokensUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseMaxOutputTokensUnion) UnmarshalJSON

type RealtimeSessionCreateResponseModel

type RealtimeSessionCreateResponseModel string

The Realtime model used for this session.

const (
	RealtimeSessionCreateResponseModelGPTRealtime                        RealtimeSessionCreateResponseModel = "gpt-realtime"
	RealtimeSessionCreateResponseModelGPTRealtime2025_08_28              RealtimeSessionCreateResponseModel = "gpt-realtime-2025-08-28"
	RealtimeSessionCreateResponseModelGPT4oRealtimePreview               RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview"
	RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_10_01     RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-10-01"
	RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_12_17     RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-12-17"
	RealtimeSessionCreateResponseModelGPT4oRealtimePreview2025_06_03     RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2025-06-03"
	RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview           RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview"
	RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview2024_12_17 RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview-2024-12-17"
	RealtimeSessionCreateResponseModelGPTRealtimeMini                    RealtimeSessionCreateResponseModel = "gpt-realtime-mini"
	RealtimeSessionCreateResponseModelGPTRealtimeMini2025_10_06          RealtimeSessionCreateResponseModel = "gpt-realtime-mini-2025-10-06"
	RealtimeSessionCreateResponseModelGPTAudioMini                       RealtimeSessionCreateResponseModel = "gpt-audio-mini"
	RealtimeSessionCreateResponseModelGPTAudioMini2025_10_06             RealtimeSessionCreateResponseModel = "gpt-audio-mini-2025-10-06"
)

type RealtimeSessionCreateResponseToolChoiceUnion

type RealtimeSessionCreateResponseToolChoiceUnion struct {
	// This field will be present if the value is a [responses.ToolChoiceOptions]
	// instead of an object.
	OfToolChoiceMode responses.ToolChoiceOptions `json:",inline"`
	Name             string                      `json:"name"`
	Type             string                      `json:"type"`
	// This field is from variant [responses.ToolChoiceMcp].
	ServerLabel string `json:"server_label"`
	JSON        struct {
		OfToolChoiceMode respjson.Field
		Name             respjson.Field
		Type             respjson.Field
		ServerLabel      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeSessionCreateResponseToolChoiceUnion contains all possible properties and values from responses.ToolChoiceOptions, responses.ToolChoiceFunction, responses.ToolChoiceMcp.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfToolChoiceMode]

func (RealtimeSessionCreateResponseToolChoiceUnion) AsFunctionTool

func (RealtimeSessionCreateResponseToolChoiceUnion) AsMcpTool

func (RealtimeSessionCreateResponseToolChoiceUnion) AsToolChoiceMode

func (RealtimeSessionCreateResponseToolChoiceUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolChoiceUnion) UnmarshalJSON

func (r *RealtimeSessionCreateResponseToolChoiceUnion) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponseToolMcpTool

type RealtimeSessionCreateResponseToolMcpTool struct {
	// A label for this MCP server, used to identify it in tool calls.
	ServerLabel string `json:"server_label,required"`
	// The type of the MCP tool. Always `mcp`.
	Type constant.Mcp `json:"type,required"`
	// List of allowed tool names or a filter object.
	AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion `json:"allowed_tools,nullable"`
	// An OAuth access token that can be used with a remote MCP server, either with a
	// custom MCP server URL or a service connector. Your application must handle the
	// OAuth authorization flow and provide the token here.
	Authorization string `json:"authorization"`
	// Identifier for service connectors, like those available in ChatGPT. One of
	// `server_url` or `connector_id` must be provided. Learn more about service
	// connectors
	// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
	//
	// Currently supported `connector_id` values are:
	//
	// - Dropbox: `connector_dropbox`
	// - Gmail: `connector_gmail`
	// - Google Calendar: `connector_googlecalendar`
	// - Google Drive: `connector_googledrive`
	// - Microsoft Teams: `connector_microsoftteams`
	// - Outlook Calendar: `connector_outlookcalendar`
	// - Outlook Email: `connector_outlookemail`
	// - SharePoint: `connector_sharepoint`
	//
	// Any of "connector_dropbox", "connector_gmail", "connector_googlecalendar",
	// "connector_googledrive", "connector_microsoftteams",
	// "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint".
	ConnectorID string `json:"connector_id"`
	// Optional HTTP headers to send to the MCP server. Use for authentication or other
	// purposes.
	Headers map[string]string `json:"headers,nullable"`
	// Specify which of the MCP server's tools require approval.
	RequireApproval RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion `json:"require_approval,nullable"`
	// Optional description of the MCP server, used to provide more context.
	ServerDescription string `json:"server_description"`
	// The URL for the MCP server. One of `server_url` or `connector_id` must be
	// provided.
	ServerURL string `json:"server_url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ServerLabel       respjson.Field
		Type              respjson.Field
		AllowedTools      respjson.Field
		Authorization     respjson.Field
		ConnectorID       respjson.Field
		Headers           respjson.Field
		RequireApproval   respjson.Field
		ServerDescription respjson.Field
		ServerURL         respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).

func (RealtimeSessionCreateResponseToolMcpTool) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolMcpTool) UnmarshalJSON

func (r *RealtimeSessionCreateResponseToolMcpTool) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter

type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter struct {
	// Indicates whether or not a tool modifies data or is read-only. If an MCP server
	// is
	// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
	// it will match this filter.
	ReadOnly bool `json:"read_only"`
	// List of allowed tool names.
	ToolNames []string `json:"tool_names"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ReadOnly    respjson.Field
		ToolNames   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter object to specify which tools are allowed.

func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter) UnmarshalJSON

type RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion

type RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion struct {
	// This field will be present if the value is a [[]string] instead of an object.
	OfMcpAllowedTools []string `json:",inline"`
	// This field is from variant
	// [RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter].
	ReadOnly bool `json:"read_only"`
	// This field is from variant
	// [RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter].
	ToolNames []string `json:"tool_names"`
	JSON      struct {
		OfMcpAllowedTools respjson.Field
		ReadOnly          respjson.Field
		ToolNames         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion contains all possible properties and values from [[]string], RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfMcpAllowedTools]

func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpAllowedTools

func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpToolFilter

func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) UnmarshalJSON

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter struct {
	// A filter object to specify which tools are allowed.
	Always RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
	// A filter object to specify which tools are allowed.
	Never RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever `json:"never"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Always      respjson.Field
		Never       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Specify which of the MCP server's tools require approval. Can be `always`, `never`, or a filter object associated with tools that require approval.

func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter) UnmarshalJSON

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways struct {
	// Indicates whether or not a tool modifies data or is read-only. If an MCP server
	// is
	// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
	// it will match this filter.
	ReadOnly bool `json:"read_only"`
	// List of allowed tool names.
	ToolNames []string `json:"tool_names"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ReadOnly    respjson.Field
		ToolNames   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter object to specify which tools are allowed.

func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways) UnmarshalJSON

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever struct {
	// Indicates whether or not a tool modifies data or is read-only. If an MCP server
	// is
	// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
	// it will match this filter.
	ReadOnly bool `json:"read_only"`
	// List of allowed tool names.
	ToolNames []string `json:"tool_names"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ReadOnly    respjson.Field
		ToolNames   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter object to specify which tools are allowed.

func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever) UnmarshalJSON

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of `always` or `never`. When set to `always`, all tools will require approval. When set to `never`, all tools will not require approval.

const (
	RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingAlways RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "always"
	RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingNever  RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "never"
)

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion

type RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfMcpToolApprovalSetting string `json:",inline"`
	// This field is from variant
	// [RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter].
	Always RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
	// This field is from variant
	// [RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter].
	Never RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever `json:"never"`
	JSON  struct {
		OfMcpToolApprovalSetting respjson.Field
		Always                   respjson.Field
		Never                    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion contains all possible properties and values from RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter, [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfMcpToolApprovalSetting]

func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalFilter

func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalSetting

func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) UnmarshalJSON

type RealtimeSessionCreateResponseToolUnion

type RealtimeSessionCreateResponseToolUnion struct {
	// This field is from variant [RealtimeFunctionTool].
	Description string `json:"description"`
	// This field is from variant [RealtimeFunctionTool].
	Name string `json:"name"`
	// This field is from variant [RealtimeFunctionTool].
	Parameters any    `json:"parameters"`
	Type       string `json:"type"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	ServerLabel string `json:"server_label"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion `json:"allowed_tools"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	Authorization string `json:"authorization"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	ConnectorID string `json:"connector_id"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	Headers map[string]string `json:"headers"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	RequireApproval RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion `json:"require_approval"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	ServerDescription string `json:"server_description"`
	// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
	ServerURL string `json:"server_url"`
	JSON      struct {
		Description       respjson.Field
		Name              respjson.Field
		Parameters        respjson.Field
		Type              respjson.Field
		ServerLabel       respjson.Field
		AllowedTools      respjson.Field
		Authorization     respjson.Field
		ConnectorID       respjson.Field
		Headers           respjson.Field
		RequireApproval   respjson.Field
		ServerDescription respjson.Field
		ServerURL         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeSessionCreateResponseToolUnion contains all possible properties and values from RealtimeFunctionTool, RealtimeSessionCreateResponseToolMcpTool.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (RealtimeSessionCreateResponseToolUnion) AsFunctionTool

func (RealtimeSessionCreateResponseToolUnion) AsMcpTool

func (RealtimeSessionCreateResponseToolUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseToolUnion) UnmarshalJSON

func (r *RealtimeSessionCreateResponseToolUnion) UnmarshalJSON(data []byte) error

type RealtimeSessionCreateResponseTracingTracingConfiguration

type RealtimeSessionCreateResponseTracingTracingConfiguration struct {
	// The group id to attach to this trace to enable filtering and grouping in the
	// Traces Dashboard.
	GroupID string `json:"group_id"`
	// The arbitrary metadata to attach to this trace to enable filtering in the Traces
	// Dashboard.
	Metadata any `json:"metadata"`
	// The name of the workflow to attach to this trace. This is used to name the trace
	// in the Traces Dashboard.
	WorkflowName string `json:"workflow_name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupID      respjson.Field
		Metadata     respjson.Field
		WorkflowName respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Granular configuration for tracing.

func (RealtimeSessionCreateResponseTracingTracingConfiguration) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseTracingTracingConfiguration) UnmarshalJSON

type RealtimeSessionCreateResponseTracingUnion

type RealtimeSessionCreateResponseTracingUnion struct {
	// This field will be present if the value is a [constant.Auto] instead of an
	// object.
	OfAuto constant.Auto `json:",inline"`
	// This field is from variant
	// [RealtimeSessionCreateResponseTracingTracingConfiguration].
	GroupID string `json:"group_id"`
	// This field is from variant
	// [RealtimeSessionCreateResponseTracingTracingConfiguration].
	Metadata any `json:"metadata"`
	// This field is from variant
	// [RealtimeSessionCreateResponseTracingTracingConfiguration].
	WorkflowName string `json:"workflow_name"`
	JSON         struct {
		OfAuto       respjson.Field
		GroupID      respjson.Field
		Metadata     respjson.Field
		WorkflowName respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeSessionCreateResponseTracingUnion contains all possible properties and values from constant.Auto, RealtimeSessionCreateResponseTracingTracingConfiguration.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfAuto]

func (RealtimeSessionCreateResponseTracingUnion) AsAuto

func (RealtimeSessionCreateResponseTracingUnion) AsTracingConfiguration

func (RealtimeSessionCreateResponseTracingUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeSessionCreateResponseTracingUnion) UnmarshalJSON

func (r *RealtimeSessionCreateResponseTracingUnion) UnmarshalJSON(data []byte) error

type RealtimeToolChoiceConfigUnionParam

type RealtimeToolChoiceConfigUnionParam struct {
	// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
	OfToolChoiceMode param.Opt[responses.ToolChoiceOptions] `json:",omitzero,inline"`
	OfFunctionTool   *responses.ToolChoiceFunctionParam     `json:",omitzero,inline"`
	OfMcpTool        *responses.ToolChoiceMcpParam          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func RealtimeToolChoiceConfigParamOfFunctionTool

func RealtimeToolChoiceConfigParamOfFunctionTool(name string) RealtimeToolChoiceConfigUnionParam

func RealtimeToolChoiceConfigParamOfMcpTool

func RealtimeToolChoiceConfigParamOfMcpTool(serverLabel string) RealtimeToolChoiceConfigUnionParam

func (RealtimeToolChoiceConfigUnionParam) GetName

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolChoiceConfigUnionParam) GetServerLabel

func (u RealtimeToolChoiceConfigUnionParam) GetServerLabel() *string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolChoiceConfigUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolChoiceConfigUnionParam) MarshalJSON

func (u RealtimeToolChoiceConfigUnionParam) MarshalJSON() ([]byte, error)

func (*RealtimeToolChoiceConfigUnionParam) UnmarshalJSON

func (u *RealtimeToolChoiceConfigUnionParam) UnmarshalJSON(data []byte) error

type RealtimeToolsConfigParam

type RealtimeToolsConfigParam []RealtimeToolsConfigUnionParam

type RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam

type RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam struct {
	// Indicates whether or not a tool modifies data or is read-only. If an MCP server
	// is
	// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
	// it will match this filter.
	ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
	// List of allowed tool names.
	ToolNames []string `json:"tool_names,omitzero"`
	// contains filtered or unexported fields
}

A filter object to specify which tools are allowed.

func (RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam) MarshalJSON

func (*RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam) UnmarshalJSON

type RealtimeToolsConfigUnionMcpAllowedToolsParam

type RealtimeToolsConfigUnionMcpAllowedToolsParam struct {
	OfMcpAllowedTools []string                                                   `json:",omitzero,inline"`
	OfMcpToolFilter   *RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RealtimeToolsConfigUnionMcpAllowedToolsParam) MarshalJSON

func (*RealtimeToolsConfigUnionMcpAllowedToolsParam) UnmarshalJSON

func (u *RealtimeToolsConfigUnionMcpAllowedToolsParam) UnmarshalJSON(data []byte) error

type RealtimeToolsConfigUnionMcpParam

type RealtimeToolsConfigUnionMcpParam struct {
	// A label for this MCP server, used to identify it in tool calls.
	ServerLabel string `json:"server_label,required"`
	// An OAuth access token that can be used with a remote MCP server, either with a
	// custom MCP server URL or a service connector. Your application must handle the
	// OAuth authorization flow and provide the token here.
	Authorization param.Opt[string] `json:"authorization,omitzero"`
	// Optional description of the MCP server, used to provide more context.
	ServerDescription param.Opt[string] `json:"server_description,omitzero"`
	// The URL for the MCP server. One of `server_url` or `connector_id` must be
	// provided.
	ServerURL param.Opt[string] `json:"server_url,omitzero"`
	// List of allowed tool names or a filter object.
	AllowedTools RealtimeToolsConfigUnionMcpAllowedToolsParam `json:"allowed_tools,omitzero"`
	// Optional HTTP headers to send to the MCP server. Use for authentication or other
	// purposes.
	Headers map[string]string `json:"headers,omitzero"`
	// Specify which of the MCP server's tools require approval.
	RequireApproval RealtimeToolsConfigUnionMcpRequireApprovalParam `json:"require_approval,omitzero"`
	// Identifier for service connectors, like those available in ChatGPT. One of
	// `server_url` or `connector_id` must be provided. Learn more about service
	// connectors
	// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
	//
	// Currently supported `connector_id` values are:
	//
	// - Dropbox: `connector_dropbox`
	// - Gmail: `connector_gmail`
	// - Google Calendar: `connector_googlecalendar`
	// - Google Drive: `connector_googledrive`
	// - Microsoft Teams: `connector_microsoftteams`
	// - Outlook Calendar: `connector_outlookcalendar`
	// - Outlook Email: `connector_outlookemail`
	// - SharePoint: `connector_sharepoint`
	//
	// Any of "connector_dropbox", "connector_gmail", "connector_googlecalendar",
	// "connector_googledrive", "connector_microsoftteams",
	// "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint".
	ConnectorID string `json:"connector_id,omitzero"`
	// The type of the MCP tool. Always `mcp`.
	//
	// This field can be elided, and will marshal its zero value as "mcp".
	Type constant.Mcp `json:"type,required"`
	// contains filtered or unexported fields
}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).

The properties ServerLabel, Type are required.

func (RealtimeToolsConfigUnionMcpParam) MarshalJSON

func (r RealtimeToolsConfigUnionMcpParam) MarshalJSON() (data []byte, err error)

func (*RealtimeToolsConfigUnionMcpParam) UnmarshalJSON

func (r *RealtimeToolsConfigUnionMcpParam) UnmarshalJSON(data []byte) error

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam struct {
	// Indicates whether or not a tool modifies data or is read-only. If an MCP server
	// is
	// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
	// it will match this filter.
	ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
	// List of allowed tool names.
	ToolNames []string `json:"tool_names,omitzero"`
	// contains filtered or unexported fields
}

A filter object to specify which tools are allowed.

func (RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) MarshalJSON

func (*RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) UnmarshalJSON

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam struct {
	// Indicates whether or not a tool modifies data or is read-only. If an MCP server
	// is
	// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
	// it will match this filter.
	ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
	// List of allowed tool names.
	ToolNames []string `json:"tool_names,omitzero"`
	// contains filtered or unexported fields
}

A filter object to specify which tools are allowed.

func (RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam) MarshalJSON

func (*RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam) UnmarshalJSON

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam struct {
	// A filter object to specify which tools are allowed.
	Always RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam `json:"always,omitzero"`
	// A filter object to specify which tools are allowed.
	Never RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam `json:"never,omitzero"`
	// contains filtered or unexported fields
}

Specify which of the MCP server's tools require approval. Can be `always`, `never`, or a filter object associated with tools that require approval.

func (RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam) MarshalJSON

func (*RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam) UnmarshalJSON

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting

type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of `always` or `never`. When set to `always`, all tools will require approval. When set to `never`, all tools will not require approval.

const (
	RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSettingAlways RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting = "always"
	RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSettingNever  RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting = "never"
)

type RealtimeToolsConfigUnionMcpRequireApprovalParam

type RealtimeToolsConfigUnionMcpRequireApprovalParam struct {
	OfMcpToolApprovalFilter *RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfMcpToolApprovalSetting)
	OfMcpToolApprovalSetting param.Opt[string] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RealtimeToolsConfigUnionMcpRequireApprovalParam) MarshalJSON

func (*RealtimeToolsConfigUnionMcpRequireApprovalParam) UnmarshalJSON

type RealtimeToolsConfigUnionParam

type RealtimeToolsConfigUnionParam struct {
	OfFunction *RealtimeFunctionToolParam        `json:",omitzero,inline"`
	OfMcp      *RealtimeToolsConfigUnionMcpParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func RealtimeToolsConfigUnionParamOfMcp

func RealtimeToolsConfigUnionParamOfMcp(serverLabel string) RealtimeToolsConfigUnionParam

func (RealtimeToolsConfigUnionParam) GetAllowedTools

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetAuthorization

func (u RealtimeToolsConfigUnionParam) GetAuthorization() *string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetConnectorID

func (u RealtimeToolsConfigUnionParam) GetConnectorID() *string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetDescription

func (u RealtimeToolsConfigUnionParam) GetDescription() *string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetHeaders

func (u RealtimeToolsConfigUnionParam) GetHeaders() map[string]string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetName

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetParameters

func (u RealtimeToolsConfigUnionParam) GetParameters() *any

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetRequireApproval

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetServerDescription

func (u RealtimeToolsConfigUnionParam) GetServerDescription() *string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetServerLabel

func (u RealtimeToolsConfigUnionParam) GetServerLabel() *string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetServerURL

func (u RealtimeToolsConfigUnionParam) GetServerURL() *string

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (RealtimeToolsConfigUnionParam) MarshalJSON

func (u RealtimeToolsConfigUnionParam) MarshalJSON() ([]byte, error)

func (*RealtimeToolsConfigUnionParam) UnmarshalJSON

func (u *RealtimeToolsConfigUnionParam) UnmarshalJSON(data []byte) error

type RealtimeTracingConfigTracingConfigurationParam

type RealtimeTracingConfigTracingConfigurationParam struct {
	// The group id to attach to this trace to enable filtering and grouping in the
	// Traces Dashboard.
	GroupID param.Opt[string] `json:"group_id,omitzero"`
	// The name of the workflow to attach to this trace. This is used to name the trace
	// in the Traces Dashboard.
	WorkflowName param.Opt[string] `json:"workflow_name,omitzero"`
	// The arbitrary metadata to attach to this trace to enable filtering in the Traces
	// Dashboard.
	Metadata any `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

Granular configuration for tracing.

func (RealtimeTracingConfigTracingConfigurationParam) MarshalJSON

func (r RealtimeTracingConfigTracingConfigurationParam) MarshalJSON() (data []byte, err error)

func (*RealtimeTracingConfigTracingConfigurationParam) UnmarshalJSON

type RealtimeTracingConfigUnionParam

type RealtimeTracingConfigUnionParam struct {
	// Construct this variant with constant.ValueOf[constant.Auto]()
	OfAuto                 constant.Auto                                   `json:",omitzero,inline"`
	OfTracingConfiguration *RealtimeTracingConfigTracingConfigurationParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func RealtimeTracingConfigParamOfAuto

func RealtimeTracingConfigParamOfAuto() RealtimeTracingConfigUnionParam

func (RealtimeTracingConfigUnionParam) MarshalJSON

func (u RealtimeTracingConfigUnionParam) MarshalJSON() ([]byte, error)

func (*RealtimeTracingConfigUnionParam) UnmarshalJSON

func (u *RealtimeTracingConfigUnionParam) UnmarshalJSON(data []byte) error

type RealtimeTranscriptionSessionAudioInputNoiseReductionParam

type RealtimeTranscriptionSessionAudioInputNoiseReductionParam struct {
	// Type of noise reduction. `near_field` is for close-talking microphones such as
	// headphones, `far_field` is for far-field microphones such as laptop or
	// conference room microphones.
	//
	// Any of "near_field", "far_field".
	Type NoiseReductionType `json:"type,omitzero"`
	// contains filtered or unexported fields
}

Configuration for input audio noise reduction. This can be set to `null` to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.

func (RealtimeTranscriptionSessionAudioInputNoiseReductionParam) MarshalJSON

func (*RealtimeTranscriptionSessionAudioInputNoiseReductionParam) UnmarshalJSON

type RealtimeTranscriptionSessionAudioInputParam

type RealtimeTranscriptionSessionAudioInputParam struct {
	// Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
	// set to `null` to turn off, in which case the client must manually trigger model
	// response.
	//
	// Server VAD means that the model will detect the start and end of speech based on
	// audio volume and respond at the end of user speech.
	//
	// Semantic VAD is more advanced and uses a turn detection model (in conjunction
	// with VAD) to semantically estimate whether the user has finished speaking, then
	// dynamically sets a timeout based on this probability. For example, if user audio
	// trails off with "uhhm", the model will score a low probability of turn end and
	// wait longer for the user to continue speaking. This can be useful for more
	// natural conversations, but may have a higher latency.
	TurnDetection RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam `json:"turn_detection,omitzero"`
	// The PCM audio format. Only a 24kHz sample rate is supported.
	Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
	// Configuration for input audio noise reduction. This can be set to `null` to turn
	// off. Noise reduction filters audio added to the input audio buffer before it is
	// sent to VAD and the model. Filtering the audio can improve VAD and turn
	// detection accuracy (reducing false positives) and model performance by improving
	// perception of the input audio.
	NoiseReduction RealtimeTranscriptionSessionAudioInputNoiseReductionParam `json:"noise_reduction,omitzero"`
	// Configuration for input audio transcription, defaults to off and can be set to
	// `null` to turn off once on. Input audio transcription is not native to the
	// model, since the model consumes audio directly. Transcription runs
	// asynchronously through
	// [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
	// and should be treated as guidance of input audio content rather than precisely
	// what the model heard. The client can optionally set the language and prompt for
	// transcription, these offer additional guidance to the transcription service.
	Transcription AudioTranscriptionParam `json:"transcription,omitzero"`
	// contains filtered or unexported fields
}

func (RealtimeTranscriptionSessionAudioInputParam) MarshalJSON

func (r RealtimeTranscriptionSessionAudioInputParam) MarshalJSON() (data []byte, err error)

func (*RealtimeTranscriptionSessionAudioInputParam) UnmarshalJSON

func (r *RealtimeTranscriptionSessionAudioInputParam) UnmarshalJSON(data []byte) error

type RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam

type RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam struct {
	// Whether or not to automatically generate a response when a VAD stop event
	// occurs.
	CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
	// Whether or not to automatically interrupt any ongoing response with output to
	// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
	// occurs.
	InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
	// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
	// will wait longer for the user to continue speaking, `high` will respond more
	// quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`,
	// and `high` have max timeouts of 8s, 4s, and 2s respectively.
	//
	// Any of "low", "medium", "high", "auto".
	Eagerness string `json:"eagerness,omitzero"`
	// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
	//
	// This field can be elided, and will marshal its zero value as "semantic_vad".
	Type constant.SemanticVad `json:"type,required"`
	// contains filtered or unexported fields
}

Server-side semantic turn detection which uses a model to determine when the user has finished speaking.

The property Type is required.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam) MarshalJSON

func (*RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam) UnmarshalJSON

type RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam

type RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam struct {
	// Optional timeout after which a model response will be triggered automatically.
	// This is useful for situations in which a long pause from the user is unexpected,
	// such as a phone call. The model will effectively prompt the user to continue the
	// conversation based on the current context.
	//
	// The timeout value will be applied after the last model response's audio has
	// finished playing, i.e. it's set to the `response.done` time plus audio playback
	// duration.
	//
	// An `input_audio_buffer.timeout_triggered` event (plus events associated with the
	// Response) will be emitted when the timeout is reached. Idle timeout is currently
	// only supported for `server_vad` mode.
	IdleTimeoutMs param.Opt[int64] `json:"idle_timeout_ms,omitzero"`
	// Whether or not to automatically generate a response when a VAD stop event
	// occurs.
	CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
	// Whether or not to automatically interrupt any ongoing response with output to
	// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
	// occurs.
	InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
	// Used only for `server_vad` mode. Amount of audio to include before the VAD
	// detected speech (in milliseconds). Defaults to 300ms.
	PrefixPaddingMs param.Opt[int64] `json:"prefix_padding_ms,omitzero"`
	// Used only for `server_vad` mode. Duration of silence to detect speech stop (in
	// milliseconds). Defaults to 500ms. With shorter values the model will respond
	// more quickly, but may jump in on short pauses from the user.
	SilenceDurationMs param.Opt[int64] `json:"silence_duration_ms,omitzero"`
	// Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
	// defaults to 0.5. A higher threshold will require louder audio to activate the
	// model, and thus might perform better in noisy environments.
	Threshold param.Opt[float64] `json:"threshold,omitzero"`
	// Type of turn detection, `server_vad` to turn on simple Server VAD.
	//
	// This field can be elided, and will marshal its zero value as "server_vad".
	Type constant.ServerVad `json:"type,required"`
	// contains filtered or unexported fields
}

Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.

The property Type is required.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam) MarshalJSON

func (*RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam) UnmarshalJSON

type RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam

type RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam struct {
	OfServerVad   *RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam   `json:",omitzero,inline"`
	OfSemanticVad *RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetCreateResponse

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetEagerness

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetInterruptResponse

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetSilenceDurationMs

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetThreshold

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) MarshalJSON

func (*RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) UnmarshalJSON

type RealtimeTranscriptionSessionAudioParam

type RealtimeTranscriptionSessionAudioParam struct {
	Input RealtimeTranscriptionSessionAudioInputParam `json:"input,omitzero"`
	// contains filtered or unexported fields
}

Configuration for input and output audio.

func (RealtimeTranscriptionSessionAudioParam) MarshalJSON

func (r RealtimeTranscriptionSessionAudioParam) MarshalJSON() (data []byte, err error)

func (*RealtimeTranscriptionSessionAudioParam) UnmarshalJSON

func (r *RealtimeTranscriptionSessionAudioParam) UnmarshalJSON(data []byte) error

type RealtimeTranscriptionSessionCreateRequestParam

type RealtimeTranscriptionSessionCreateRequestParam struct {
	// Configuration for input and output audio.
	Audio RealtimeTranscriptionSessionAudioParam `json:"audio,omitzero"`
	// Additional fields to include in server outputs.
	//
	// `item.input_audio_transcription.logprobs`: Include logprobs for input audio
	// transcription.
	//
	// Any of "item.input_audio_transcription.logprobs".
	Include []string `json:"include,omitzero"`
	// The type of session to create. Always `transcription` for transcription
	// sessions.
	//
	// This field can be elided, and will marshal its zero value as "transcription".
	Type constant.Transcription `json:"type,required"`
	// contains filtered or unexported fields
}

Realtime transcription session object configuration.

The property Type is required.

func (RealtimeTranscriptionSessionCreateRequestParam) MarshalJSON

func (r RealtimeTranscriptionSessionCreateRequestParam) MarshalJSON() (data []byte, err error)

func (*RealtimeTranscriptionSessionCreateRequestParam) UnmarshalJSON

type RealtimeTranscriptionSessionCreateResponse

type RealtimeTranscriptionSessionCreateResponse struct {
	// Unique identifier for the session that looks like `sess_1234567890abcdef`.
	ID string `json:"id,required"`
	// The object type. Always `realtime.transcription_session`.
	Object string `json:"object,required"`
	// The type of session. Always `transcription` for transcription sessions.
	Type constant.Transcription `json:"type,required"`
	// Configuration for input audio for the session.
	Audio RealtimeTranscriptionSessionCreateResponseAudio `json:"audio"`
	// Expiration timestamp for the session, in seconds since epoch.
	ExpiresAt int64 `json:"expires_at"`
	// Additional fields to include in server outputs.
	//
	//   - `item.input_audio_transcription.logprobs`: Include logprobs for input audio
	//     transcription.
	//
	// Any of "item.input_audio_transcription.logprobs".
	Include []string `json:"include"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Object      respjson.Field
		Type        respjson.Field
		Audio       respjson.Field
		ExpiresAt   respjson.Field
		Include     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A Realtime transcription session configuration object.

func (RealtimeTranscriptionSessionCreateResponse) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeTranscriptionSessionCreateResponse) UnmarshalJSON

func (r *RealtimeTranscriptionSessionCreateResponse) UnmarshalJSON(data []byte) error

type RealtimeTranscriptionSessionCreateResponseAudio

type RealtimeTranscriptionSessionCreateResponseAudio struct {
	Input RealtimeTranscriptionSessionCreateResponseAudioInput `json:"input"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Input       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for input audio for the session.

func (RealtimeTranscriptionSessionCreateResponseAudio) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeTranscriptionSessionCreateResponseAudio) UnmarshalJSON

type RealtimeTranscriptionSessionCreateResponseAudioInput

type RealtimeTranscriptionSessionCreateResponseAudioInput struct {
	// The PCM audio format. Only a 24kHz sample rate is supported.
	Format RealtimeAudioFormatsUnion `json:"format"`
	// Configuration for input audio noise reduction.
	NoiseReduction RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction `json:"noise_reduction"`
	// Configuration of the transcription model.
	Transcription AudioTranscription `json:"transcription"`
	// Configuration for turn detection. Can be set to `null` to turn off. Server VAD
	// means that the model will detect the start and end of speech based on audio
	// volume and respond at the end of user speech.
	TurnDetection RealtimeTranscriptionSessionTurnDetection `json:"turn_detection"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Format         respjson.Field
		NoiseReduction respjson.Field
		Transcription  respjson.Field
		TurnDetection  respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RealtimeTranscriptionSessionCreateResponseAudioInput) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeTranscriptionSessionCreateResponseAudioInput) UnmarshalJSON

type RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction

type RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction struct {
	// Type of noise reduction. `near_field` is for close-talking microphones such as
	// headphones, `far_field` is for far-field microphones such as laptop or
	// conference room microphones.
	//
	// Any of "near_field", "far_field".
	Type NoiseReductionType `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for input audio noise reduction.

func (RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction) UnmarshalJSON

type RealtimeTranscriptionSessionTurnDetection

type RealtimeTranscriptionSessionTurnDetection struct {
	// Amount of audio to include before the VAD detected speech (in milliseconds).
	// Defaults to 300ms.
	PrefixPaddingMs int64 `json:"prefix_padding_ms"`
	// Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms.
	// With shorter values the model will respond more quickly, but may jump in on
	// short pauses from the user.
	SilenceDurationMs int64 `json:"silence_duration_ms"`
	// Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher
	// threshold will require louder audio to activate the model, and thus might
	// perform better in noisy environments.
	Threshold float64 `json:"threshold"`
	// Type of turn detection, only `server_vad` is currently supported.
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PrefixPaddingMs   respjson.Field
		SilenceDurationMs respjson.Field
		Threshold         respjson.Field
		Type              respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.

func (RealtimeTranscriptionSessionTurnDetection) RawJSON

Returns the unmodified JSON received from the API

func (*RealtimeTranscriptionSessionTurnDetection) UnmarshalJSON

func (r *RealtimeTranscriptionSessionTurnDetection) UnmarshalJSON(data []byte) error

type RealtimeTruncationRealtimeTruncationStrategy

type RealtimeTruncationRealtimeTruncationStrategy string

The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.

const (
	RealtimeTruncationRealtimeTruncationStrategyAuto     RealtimeTruncationRealtimeTruncationStrategy = "auto"
	RealtimeTruncationRealtimeTruncationStrategyDisabled RealtimeTruncationRealtimeTruncationStrategy = "disabled"
)

type RealtimeTruncationRetentionRatio

type RealtimeTruncationRetentionRatio struct {
	// Fraction of post-instruction conversation tokens to retain (0.0 - 1.0) when the
	// conversation exceeds the input token limit.
	RetentionRatio float64 `json:"retention_ratio,required"`
	// Use retention ratio truncation.
	Type constant.RetentionRatio `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		RetentionRatio respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.

func (RealtimeTruncationRetentionRatio) RawJSON

Returns the unmodified JSON received from the API

func (RealtimeTruncationRetentionRatio) ToParam

ToParam converts this RealtimeTruncationRetentionRatio to a RealtimeTruncationRetentionRatioParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RealtimeTruncationRetentionRatioParam.Overrides()

func (*RealtimeTruncationRetentionRatio) UnmarshalJSON

func (r *RealtimeTruncationRetentionRatio) UnmarshalJSON(data []byte) error

type RealtimeTruncationRetentionRatioParam

type RealtimeTruncationRetentionRatioParam struct {
	// Fraction of post-instruction conversation tokens to retain (0.0 - 1.0) when the
	// conversation exceeds the input token limit.
	RetentionRatio float64 `json:"retention_ratio,required"`
	// Use retention ratio truncation.
	//
	// This field can be elided, and will marshal its zero value as "retention_ratio".
	Type constant.RetentionRatio `json:"type,required"`
	// contains filtered or unexported fields
}

Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.

The properties RetentionRatio, Type are required.

func (RealtimeTruncationRetentionRatioParam) MarshalJSON

func (r RealtimeTruncationRetentionRatioParam) MarshalJSON() (data []byte, err error)

func (*RealtimeTruncationRetentionRatioParam) UnmarshalJSON

func (r *RealtimeTruncationRetentionRatioParam) UnmarshalJSON(data []byte) error

type RealtimeTruncationUnion

type RealtimeTruncationUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfRealtimeTruncationStrategy string `json:",inline"`
	// This field is from variant [RealtimeTruncationRetentionRatio].
	RetentionRatio float64 `json:"retention_ratio"`
	// This field is from variant [RealtimeTruncationRetentionRatio].
	Type constant.RetentionRatio `json:"type"`
	JSON struct {
		OfRealtimeTruncationStrategy respjson.Field
		RetentionRatio               respjson.Field
		Type                         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RealtimeTruncationUnion contains all possible properties and values from [string], RealtimeTruncationRetentionRatio.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfRealtimeTruncationStrategy]

func (RealtimeTruncationUnion) AsRealtimeTruncationStrategy

func (u RealtimeTruncationUnion) AsRealtimeTruncationStrategy() (v string)

func (RealtimeTruncationUnion) AsRetentionRatioTruncation

func (u RealtimeTruncationUnion) AsRetentionRatioTruncation() (v RealtimeTruncationRetentionRatio)

func (RealtimeTruncationUnion) RawJSON

func (u RealtimeTruncationUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (RealtimeTruncationUnion) ToParam

ToParam converts this RealtimeTruncationUnion to a RealtimeTruncationUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RealtimeTruncationUnionParam.Overrides()

func (*RealtimeTruncationUnion) UnmarshalJSON

func (r *RealtimeTruncationUnion) UnmarshalJSON(data []byte) error

type RealtimeTruncationUnionParam

type RealtimeTruncationUnionParam struct {
	// Check if union is this variant with
	// !param.IsOmitted(union.OfRealtimeTruncationStrategy)
	OfRealtimeTruncationStrategy param.Opt[string]                      `json:",omitzero,inline"`
	OfRetentionRatioTruncation   *RealtimeTruncationRetentionRatioParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func RealtimeTruncationParamOfRetentionRatioTruncation

func RealtimeTruncationParamOfRetentionRatioTruncation(retentionRatio float64) RealtimeTruncationUnionParam

func (RealtimeTruncationUnionParam) MarshalJSON

func (u RealtimeTruncationUnionParam) MarshalJSON() ([]byte, error)

func (*RealtimeTruncationUnionParam) UnmarshalJSON

func (u *RealtimeTruncationUnionParam) UnmarshalJSON(data []byte) error

type Reasoning

type Reasoning = shared.Reasoning

**gpt-5 and o-series models only**

Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).

This is an alias to an internal type.

type ReasoningEffort

type ReasoningEffort = shared.ReasoningEffort

Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

Note: The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.

This is an alias to an internal type.

type ReasoningGenerateSummary

type ReasoningGenerateSummary = shared.ReasoningGenerateSummary

**Deprecated:** use `summary` instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.

This is an alias to an internal type.

type ReasoningParam

type ReasoningParam = shared.ReasoningParam

**gpt-5 and o-series models only**

Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).

This is an alias to an internal type.

type ReasoningSummary

type ReasoningSummary = shared.ReasoningSummary

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.

This is an alias to an internal type.

type ResponseFormatJSONObject

type ResponseFormatJSONObject = shared.ResponseFormatJSONObject

JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

This is an alias to an internal type.

type ResponseFormatJSONObjectParam

type ResponseFormatJSONObjectParam = shared.ResponseFormatJSONObjectParam

JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

This is an alias to an internal type.

type ResponseFormatJSONSchema

type ResponseFormatJSONSchema = shared.ResponseFormatJSONSchema

JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).

This is an alias to an internal type.

type ResponseFormatJSONSchemaJSONSchema

type ResponseFormatJSONSchemaJSONSchema = shared.ResponseFormatJSONSchemaJSONSchema

Structured Outputs configuration options, including a JSON Schema.

This is an alias to an internal type.

type ResponseFormatJSONSchemaJSONSchemaParam

type ResponseFormatJSONSchemaJSONSchemaParam = shared.ResponseFormatJSONSchemaJSONSchemaParam

Structured Outputs configuration options, including a JSON Schema.

This is an alias to an internal type.

type ResponseFormatJSONSchemaParam

type ResponseFormatJSONSchemaParam = shared.ResponseFormatJSONSchemaParam

JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).

This is an alias to an internal type.

type ResponseFormatText

type ResponseFormatText = shared.ResponseFormatText

Default response format. Used to generate text responses.

This is an alias to an internal type.

type ResponseFormatTextParam

type ResponseFormatTextParam = shared.ResponseFormatTextParam

Default response format. Used to generate text responses.

This is an alias to an internal type.

type ResponsesModel

type ResponsesModel = shared.ResponsesModel

This is an alias to an internal type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL