openai_core library

Classes

Annotation
AudioFormat
AudioFormatPcm
AudioFormatPcma
AudioFormatPcmu
AudioModel
AudioResponseFormat
AutoChunkingStrategy
Request/response variant: { "type":"auto" }
BaseRealtimeSession
CachedTokenDetails
Details about cached tokens used as input for a response.
ChatModel
ChunkingStrategy
ClientSecret
CodeInterpreterCall
CodeInterpreterContainer
CodeInterpreterContainerAuto
CodeInterpreterContainerId
CodeInterpreterFiles
CodeInterpreterLogs
CodeInterpreterResult
CodeInterpreterResultFile
CodeInterpreterResultOther
CodeInterpreterTool
— code_interpreter
CodeInterpreterToolCallStatus
CodeInterpreterToolHandler
ComputerAction
Base-class for every computer-action payload.
ComputerActionClick
ComputerActionDoubleClick
ComputerActionDrag
ComputerActionKeyPress
ComputerActionMove
ComputerActionScreenshot
ComputerActionScroll
ComputerActionType
ComputerActionWait
ComputerCall
ComputerCallOutput
ComputerResultStatus
ComputerSafetyCheck
ComputerSafetyCheckStatus
ComputerScreenshotOutput
ComputerUsePreviewTool<T>
— computer_use_preview
ComputerUsePreviewToolHandler
Container
ContainerDeleted
ContainerExpiresAfter
───────────────────────────────────────────────────────────────────────── Data models ─────────────────────────────────────────────────────────────────────────
ContainerFile
ContainerFileCitation
ContainerFileDeleted
ContainerFileList
ContainerList
Conversation
ConversationCreatedEvent
ConversationItemAddedEvent
ConversationItemCreatedEvent
ConversationItemDeletedEvent
ConversationItemDoneEvent
ConversationItemInputAudioTranscriptionCompletedEvent
ConversationItemInputAudioTranscriptionDeltaEvent
ConversationItemInputAudioTranscriptionFailedEvent
ConversationItemInputAudioTranscriptionSegmentEvent
ConversationItemRetrievedEvent
ConversationItemTruncatedEvent
CreateRealtimeCallResponse
Result of POST /v1/realtime/calls
CreateRealtimeClientSecretResponse
Result of POST /v1/realtime/client_secrets
DeletionStatus
Eagerness
Embedding
EmbeddingModel
EmbeddingsResult
ErrorEvent
ExpiresAfter
FileCitation
FileExpiresAfter
expires_after payload for /files and /uploads (anchor="created_at", seconds within 1h..30d).
FilePath
FilePurpose
FileSearchCall
FileSearchFilter
FileSearchFilterAnd
FileSearchFilterOr
FileSearchTool
— file_search
FileSearchToolCallResult
FileSearchToolCallStatus
FileSearchToolHandler
FunctionCall
FunctionCallOutput
FunctionTool
— function_tool
FunctionToolCallStatus
FunctionToolHandler
ImageData
ImageDetail
ImageGenerationBackground
ImageGenerationCall
ImageGenerationCallStatus
ImageGenerationModel
ImageGenerationTool
— image_generation
ImageGenerationToolHandler
ImageModeration
ImageOutputFormat
ImageOutputQuality
ImageOutputSize
ImageResponseFormat
ImagesResult
ImageStyle
IncompleteDetails
Explains why the response is incomplete.
Input
InputAudioBufferAppendEvent
Send base-64 audio bytes to the server-side buffer.
InputAudioBufferClearedEvent
InputAudioBufferClearEvent
Clear (discard) any audio currently in the buffer.
InputAudioBufferCommitEvent
Commit the current input-audio buffer.
InputAudioBufferCommittedEvent
InputAudioBufferSpeechStartedEvent
InputAudioBufferSpeechStoppedEvent
InputAudioBufferTimeoutTriggeredEvent
InputAudioTranscription
InputFileContent
input_file (inline or by ID)
InputImageContent
input_image (by URL or by file-ID)
InputImageMask
InputImageMaskFile
InputImageMaskUrl
InputMessage
InputText
InputTextContent
input_text
InputTokenDetails
Details about the input tokens used for transcription.
ItemReference
JsonEnum
LocalShellAction
LocalShellCall
LocalShellCallOutput
LocalShellCallStatus
LocalShellTool
— local_shell
LocalShellToolHandler
LogProb
LogProbs
McpApprovalRequest
McpApprovalResponse
McpCall
McpError
MCPListToolItem
McpListTools
McpTool
— mcp
McpToolApproval
McpToolApprovalAlways
McpToolApprovalList
MCPToolApprovalNever
McpToolHandler
Modality
NoiseReduction
NoiseReductionType
OpenAIClient
OpenAIFile
OpenAIFileList
OtherAnnotation
OtherChunkingStrategy
Response-only fallback when server returns unknown/legacy shape.
OtherComputerAction
OtherResponseContent
Simple wrapper for unexpected shapes.
OtherResponseEvent
Fallback wrapper for unseen summary part types.
OtherResponseItem
OtherTool
Fallback for bespoke tool types.
OutputAudioBufferClearedEvent
OutputAudioBufferClearEvent
Stop (truncate) the currently-playing assistant audio.
OutputAudioBufferStartedEvent
OutputAudioBufferStoppedEvent
OutputMessage
OutputTextContent
output_text
Point
Prompt
RankingOptions
RateLimit
Helpful little DTO for each list element; keeps unknown keys intact.
RateLimitsUpdatedEvent
RealtimeConversationItem
RealtimeConversationItemCreateEvent
Client → server event that inserts a new item into the conversation.
RealtimeConversationItemDeleteEvent
Delete an item from the conversation (→ conversation.item.deleted).
RealtimeConversationItemRetrieveEvent
Retrieve a single item (server → returns conversation.item.retrieved).
RealtimeConversationItemTruncateEvent
Truncate already-sent assistant audio (→ conversation.item.truncated).
RealtimeErrorEvent
RealtimeErrorInfo
RealtimeEvent
Base for every inbound / outbound realtime event. (You said this already exists – keeping a stub for context.)
RealtimeFunctionCall
RealtimeFunctionCallOutput
RealtimeFunctionTool
— function_tool
RealtimeFunctionToolHandler
RealtimeInputAudio
RealtimeInputText
RealtimeItemReferenceMessageContent
RealtimeMcpApprovalRequest
RealtimeMcpApprovalResponse
RealtimeMcpCall
RealtimeMcpListTools
RealtimeMcpListToolsCompletedEvent
Server → client: listing MCP tools completed for an item.
RealtimeMcpListToolsFailedEvent
Server → client: listing MCP tools failed for an item.
RealtimeMcpListToolsInProgressEvent
Server → client: listing MCP tools is in progress for an item.
RealtimeMcpTool
RealtimeMcpToolHandler
RealtimeMessageContent
RealtimeMessageItem
RealtimeModel
Realtime-capable, low-latency models (WebSocket / /realtime/* APIs).
RealtimeOutputAudio
RealtimeOutputText
RealtimeResponse
RealtimeResponseAudioDeltaEvent
RealtimeResponseAudioDoneEvent
RealtimeResponseAudioTranscriptDeltaEvent
RealtimeResponseAudioTranscriptDoneEvent
RealtimeResponseCancelEvent
Client → server event to cancel an in-progress assistant Response. The server will reply with response.done with a status of cancelled.
RealtimeResponseContentPartAddedEvent
RealtimeResponseContentPartDoneEvent
RealtimeResponseCreatedEvent
RealtimeResponseCreateEvent
Client → server event that requests a new assistant Response. The server replies with: response.created → …items… → response.done
RealtimeResponseDoneEvent
RealtimeResponseFunctionCallArgumentsDeltaEvent
RealtimeResponseFunctionCallArgumentsDoneEvent
RealtimeResponseMcpCallArgumentsDeltaEvent
Server → client: incremental JSON-string fragment of MCP tool-call args.
RealtimeResponseMcpCallArgumentsDoneEvent
Server → client: final JSON-encoded arguments for the MCP tool call.
RealtimeResponseMcpCallCompletedEvent
Server → client: MCP tool call completed successfully.
RealtimeResponseMcpCallFailedEvent
Server → client: MCP tool call failed.
RealtimeResponseMcpCallInProgressEvent
Server → client: MCP tool call has started and is in progress.
RealtimeResponseOptions
Per-request inference parameters (override session defaults only for this single response).
RealtimeResponseOutputAudioDeltaEvent
RealtimeResponseOutputAudioDoneEvent
RealtimeResponseOutputAudioTranscriptDeltaEvent
RealtimeResponseOutputAudioTranscriptDoneEvent
RealtimeResponseOutputItemAddedEvent
RealtimeResponseOutputItemDoneEvent
RealtimeResponseOutputTextDeltaEvent
RealtimeResponseOutputTextDoneEvent
RealtimeResponseStatusDetails
RealtimeResponseStatusDetailsError
RealtimeResponseTextDeltaEvent
RealtimeResponseTextDoneEvent
RealtimeResponseUsage
Usage statistics for a RealtimeResponse.
RealtimeSession
Full assistant session (speech + text etc.)
RealtimeSessionAudio
RealtimeSessionAudioInput
RealtimeSessionAudioOutput
RealtimeSessionController
RealtimeSessionType
RealtimeTool
RealtimeToolHandler<TMetadata>
RealtimeTranscriptionSession
Transcription-only realtime session.
RealtimeTruncation
RealtimeTruncationAuto
RealtimeTruncationDisabled
RealtimeTruncationRatio
Reasoning
ReasoningDetail
ReasoningEffort
ReasoningEvent
ReasoningOptions
ReasoningOutputStatus
ReasoningSummary
ReasoningSummaryEvent
ReasoningSummaryPart
ReasoningSummaryPartOther
Fallback wrapper for unseen summary part types.
ReasoningSummaryTextPart
The common “summary_text” variant.
RefusalContent
refusal
ResponeFunctionCallArgumentsDone
Response
Top-level result object returned by the API.
ResponseAudioOptions
ResponseAudioOutputOptions
ResponseCodeInterpreterCallCodeDelta
ResponseCodeInterpreterCallCodeDone
ResponseCodeInterpreterCallCompleted
ResponseCodeInterpreterCallEvent
ResponseCodeInterpreterCallInProgress
ResponseCodeInterpreterCallInterpreting
ResponseCompleted
Emitted once the model has fully finished generating a response.
ResponseContent
ResponseContentPartAdded
ResponseContentPartDone
ResponseCreated
Emitted whenever a new Response object is created.
ResponseError
Error information returned when the model fails to generate a response.
ResponseEvent
ResponseFailed
Emitted when the model fails to generate a response.
ResponseFileSearchCallCompleted
ResponseFileSearchCallEvent
ResponseFileSearchCallInProgress
ResponseFileSearchCallSearching
ResponseFunctionCallArgumentsDelta
ResponseImageGenerationCallCompleted
ResponseImageGenerationCallEvent
ResponseImageGenerationCallGenerating
ResponseImageGenerationCallInProgress
ResponseImageGenerationCallPartialImage
ResponseIncomplete
Emitted when the model finishes but the response is incomplete.
ResponseInProgress
Emitted while a Response is still being generated (streaming).
ResponseInputItems
Holds a list of structured input items.
ResponseInputText
Holds a single instruction / prompt string.
ResponseInputTokenDetails
Details about the input tokens used in a response.
ResponseItem
ResponseMcpCallArgumentsDelta
response.mcp_call_arguments.delta
ResponseMcpCallArgumentsDone
response.mcp_call_arguments.done
ResponseMcpCallArgumentsEvent
ResponseMcpCallCompleted
ResponseMcpCallEvent
ResponseMcpCallFailed
ResponseMcpCallInProgress
Thin wrappers for the simple lifecycle notifications.
ResponseMcpListToolsCompleted
ResponseMcpListToolsEvent
ResponseMcpListToolsFailed
ResponseMcpListToolsInProgress
ResponseOutputItemAdded
Emitted each time a new entry is appended to the Response.output array.
ResponseOutputItemDone
ResponseOutputTextDelta
ResponseOutputTextDone
ResponseOutputTokenDetails
Details about the output tokens used in a response.
ResponsePromptVariables
ResponseQueued
ResponseReasoningDelta
ResponseReasoningDone
ResponseReasoningSummaryDelta
ResponseReasoningSummaryDone
ResponseReasoningSummaryPartAdded
ResponseReasoningSummaryPartDone
ResponseReasoningSummaryTextDelta
ResponseReasoningSummaryTextDone
ResponseRefusalDelta
Emitted as partial refusal text streams in.
ResponseRefusalDone
Emitted once refusal text is finalised.
ResponsesSessionController
ResponseStream
ResponseTextAnnotationAdded
ResponseWebSearchCallCompleted
ResponseWebSearchCallEvent
ResponseWebSearchCallInProgress
ResponseWebSearchCallSearching
SearchContextSize
ServiceTier
SessionCreatedEvent
SessionUpdatedEvent
SessionUpdateEvent
Client → server event that requests the update.
SortOrder
SpeechAudioDelta
SpeechAudioDone
SpeechEvent
SpeechModel
SpeechResponseFormat
Audio container for TTS output.
SpeechStream
SpeechVoice
Built-in voice presets (TTS).
StaticChunkingStrategy
Request/response variant: { "type":"static", "static": { "max_chunk_size_tokens": 800, "chunk_overlap_tokens": 400 } }
TextFormat
TextFormatJsonObject
TextFormatJsonSchema
TextFormatOther
TextFormatText
Tool
ToolCallHandler<TMeta extends Tool, TInput extends ResponseItem, TOutput extends ResponseItem>
ToolChoice
ToolChoiceAuto
ToolChoiceCodeInterpreter
ToolChoiceComputerUsePreview
ToolChoiceFileSearch
ToolChoiceFunction
ToolChoiceImageGeneration
ToolChoiceMcp
ToolChoiceNone
ToolChoiceOther
ToolChoiceRequired
ToolChoiceWebSearchPreview
ToolHandler<TMeta extends Tool>
TopLogProb
Tracing
TracingAuto
Simple “use defaults” mode ("auto").
TracingDetailed
Fully-specified config object.
TracingDisabled
Explicitly disabled.
TranscriptEvent
TranscriptionResult
TranscriptionStream
TranscriptionUsage
Base class for polymorphic transcription usage statistics.
TranscriptionUsageDuration
Usage statistics for transcription models billed by audio duration.
TranscriptionUsageTokens
Usage statistics for transcription models billed by token count.
TranscriptTextDelta
TranscriptTextDone
Truncation
TurnDetection
TurnDetectionType
Upload
UploadPart
UrlCitation
Usage
Token-usage breakdown returned by the API.
UserLocation
VectorStore
VectorStoreFile
VectorStoreFileBatch
VectorStoreFileBatchFilesList
VectorStoreFileBatchStatus
VectorStoreFileCounts
VectorStoreFileError
VectorStoreFileList
VectorStoreFileStatus
VectorStoreList
VectorStoreSearchContent
VectorStoreSearchResult
VectorStoreSearchResultsPage
VectorStoreStatus
WebSearchCall
WebSearchPreviewTool
— web_search_preview
WebSearchToolCallStatus
WebSearchToolHandler

Extensions

AudioAPI on OpenAIClient
ContainersAPI on OpenAIClient
───────────────────────────────────────────────────────────────────────── API surface ─────────────────────────────────────────────────────────────────────────
EmbeddingsAPI on OpenAIClient
FilesAPI on OpenAIClient
ImagesAPI on OpenAIClient
RealtimeAPI on OpenAIClient
ResponsesAPI on OpenAIClient
TranscriptionAPI on OpenAIClient
VectorStoresAPI on OpenAIClient

Exceptions / Errors

MissingResponseCompletedException
MissingToolException
OpenAIAuthenticationException
──────────────────────────────────────────────────────────────── Concrete specialisations ────────────────────────────────────────────────────────────────
OpenAIException
──────────────────────────────────────────────────────────────── Base class ────────────────────────────────────────────────────────────────
OpenAIRateLimitException
OpenAIRequestException
──────────────────────────────────────────────────────────────── HTTP / request-level errors (non-2xx). ────────────────────────────────────────────────────────────────
OpenAIServiceException
RealtimeSessionException