Functions

Link copied to clipboard
open suspend fun acceptLiveSession(id: String, session: LiveSessionConfig, requestOptions: RequestOptions? = null)

Accepts an incoming SIP call. Audio formats are negotiated by SIP; client data-channel settings do not apply.

Link copied to clipboard
open suspend fun acceptRealtimeCall(id: String, session: RealtimeSessionConfig, requestOptions: RequestOptions? = null)

Accepts an incoming SIP call using the supplied realtime session configuration.

Link copied to clipboard
abstract suspend fun assistant(id: AssistantId, requestOptions: RequestOptions? = null): Assistant?

Retrieves an assistant.

abstract suspend fun assistant(request: AssistantRequest, requestOptions: RequestOptions? = null): Assistant

Create an assistant with a model and instructions.

abstract suspend fun assistant(id: AssistantId, request: AssistantRequest, requestOptions: RequestOptions? = null): Assistant

Update an assistant.

Link copied to clipboard
abstract suspend fun assistants(limit: Int? = null, order: SortOrder? = null, after: AssistantId? = null, before: AssistantId? = null, requestOptions: RequestOptions? = null): List<Assistant>

Returns a list of assistants.

Link copied to clipboard
open suspend fun <T> attachLiveSession(id: String, secure: Boolean = true, requestOptions: RequestOptions? = null, block: suspend LiveConnection.() -> T): T

Attaches a trusted sideband to an existing session without sending session.start or replaying earlier events.

Link copied to clipboard

Attaches a file with attributes and chunking configuration.

Link copied to clipboard
abstract suspend fun batch(id: BatchId, requestOptions: RequestOptions? = null): Batch?

Retrieves a batch.

abstract suspend fun batch(request: BatchRequest, requestOptions: RequestOptions? = null): Batch

Creates and executes a batch from an uploaded file of requests.

Link copied to clipboard
abstract suspend fun batches(after: BatchId? = null, limit: Int? = null, requestOptions: RequestOptions? = null): List<Batch>

List your organization's batches.

Link copied to clipboard
abstract suspend fun cancel(id: BatchId, requestOptions: RequestOptions? = null): Batch?

Cancels an in-progress batch.

abstract suspend fun cancel(fineTuneId: FineTuneId): FineTune?
abstract suspend fun cancel(id: FineTuningId, requestOptions: RequestOptions? = null): FineTuningJob?

Immediately cancel a fine-tune job.

abstract suspend fun cancel(id: ResponseId, requestOptions: RequestOptions? = null): Response?

Cancels an in-progress response.

abstract suspend fun cancel(threadId: ThreadId, runId: RunId, requestOptions: RequestOptions? = null): Run

Cancels a run that is Status.InProgress.

abstract suspend fun cancel(vectorStoreId: VectorStoreId, batchId: BatchId, requestOptions: RequestOptions? = null): FilesBatch?

Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.

Link copied to clipboard
open suspend fun cancelResponse(id: ResponseId, requestOptions: RequestOptions? = null): ResponseResult?

Cancels a background response and returns its current result metadata.

Link copied to clipboard
open suspend fun cancelUpload(id: UploadId, requestOptions: RequestOptions? = null): Upload

Cancels an upload. Server errors, including invalid lifecycle transitions, propagate.

Link copied to clipboard
abstract suspend fun chatCompletion(request: ChatCompletionRequest, requestOptions: RequestOptions? = null): ChatCompletion

Creates a completion for the chat message.

Link copied to clipboard
open suspend fun chatCompletionMessages(id: String, after: String? = null, limit: Int? = null, order: SortOrder? = null, requestOptions: RequestOptions? = null): PaginatedList<ChatResultMessage>

List messages belonging to a stored completion.

Link copied to clipboard
abstract fun chatCompletions(request: ChatCompletionRequest, requestOptions: RequestOptions? = null): Flow<ChatCompletionChunk>

Stream variant of chatCompletion.

Link copied to clipboard
open suspend fun checkContentProvenance(file: FileSource, mediaType: String, requestOptions: RequestOptions? = null): ContentProvenanceCheck

Consumes and closes the upload source, using its actual media type such as image/png or audio/ogg. A not_detected result does not establish the asset's origin. The source is closed even on failure; uploads are not automatically retried.

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
open suspend fun compactResponse(request: ResponseCompactRequest, requestOptions: RequestOptions? = null): ResponseCompaction

Compacts context into items suitable for a later response.

Link copied to clipboard
open suspend fun completeUpload(id: UploadId, request: UploadCompletionRequest, requestOptions: RequestOptions? = null): Upload

Assembles the declared part IDs in their supplied order and returns the resulting file.

Link copied to clipboard
abstract suspend fun completion(request: CompletionRequest): TextCompletion

This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested.

Link copied to clipboard
abstract fun completions(request: CompletionRequest): Flow<TextCompletion>

Stream variant of completion.

Link copied to clipboard
open suspend fun containerFilesPage(id: ContainerId, query: ContainerFileListQuery = ContainerFileListQuery(), requestOptions: RequestOptions? = null): PaginatedList<ContainerFile>

Lists container files with pagination metadata.

Link copied to clipboard
open suspend fun containersPage(query: ContainerListQuery = ContainerListQuery(), requestOptions: RequestOptions? = null): PaginatedList<Container>

Lists containers while preserving pagination cursors and the has-more indicator.

Link copied to clipboard
open suspend fun conversation(id: ConversationId, requestOptions: RequestOptions? = null): Conversation?

Retrieves a conversation, or null when it does not exist.

open suspend fun conversation(request: ConversationRequest = ConversationRequest(), requestOptions: RequestOptions? = null): Conversation

Creates a conversation, optionally with initial items.

Link copied to clipboard
open suspend fun conversationItem(id: ConversationId, itemId: String, include: List<String>? = null, requestOptions: RequestOptions? = null): ConversationItem?

Retrieves an item, or null when it does not exist. Include requests additional item data.

Link copied to clipboard
open suspend fun conversationItems(id: ConversationId, limit: Int? = null, order: SortOrder? = null, after: String? = null, include: List<String>? = null, requestOptions: RequestOptions? = null): PaginatedList<ConversationItem>

Lists conversation items. Pass lastId as after to request the next page.

Link copied to clipboard
open suspend fun copyContainerFile(id: ContainerId, fileId: FileId, requestOptions: RequestOptions? = null): ContainerFile

Copies a regular File resource into the container using a JSON file_id request.

Link copied to clipboard
open suspend fun createBatch(request: BatchCreateRequest, requestOptions: RequestOptions? = null): Batch

Creates a batch with optional expiration for its output and error files.

Link copied to clipboard
open suspend fun createChatCompletion(request: ChatCompletionRequest, options: ChatCompletionOptions, requestOptions: RequestOptions? = null): ChatCompletionResult

Create a completion using richer content and custom tool declarations.

Link copied to clipboard
open suspend fun createContainer(request: ContainerRequest, requestOptions: RequestOptions? = null): Container

Creates a container with the requested files, skills and resource policy.

Link copied to clipboard
open suspend fun createConversationItems(id: ConversationId, request: ConversationItemsRequest, include: List<String>? = null, requestOptions: RequestOptions? = null): PaginatedList<ConversationItem>

Adds up to 20 items and returns the created items with pagination metadata.

Link copied to clipboard
open suspend fun createEmbeddings(request: EmbeddingCreateRequest, requestOptions: RequestOptions? = null): EmbeddingResult

Create embeddings from text or token IDs and retain vector encoding metadata.

Link copied to clipboard
open suspend fun createLiveSession(request: LiveSessionRequest, requestOptions: RequestOptions? = null): LiveSessionResult

Creates a WebRTC session or places a real SIP call. Automatic retries are disabled for SIP; manually retrying an uncertain result can create duplicate calls.

Link copied to clipboard
open suspend fun createResponse(request: ResponseCreateRequest, requestOptions: RequestOptions? = null): ResponseResult

Creates a response with current request controls and complete result metadata.

Link copied to clipboard
abstract suspend fun createRun(threadId: ThreadId, request: RunRequest, requestOptions: RequestOptions? = null): Run

Create a run.

Link copied to clipboard
open suspend fun createSkill(request: SkillUploadRequest, requestOptions: RequestOptions? = null): Skill

Uploads a skill directory or ZIP once. Every source is closed even on failure; uploads are not automatically retried.

Link copied to clipboard
open suspend fun createSkillVersion(id: SkillId, request: SkillVersionUploadRequest, requestOptions: RequestOptions? = null): SkillVersion

Uploads an immutable version once, closing all sources even on failure. Newly uploaded versions may briefly return 404 on retrieval.

Link copied to clipboard
open suspend fun createSpeech(request: SpeechRequest, options: SpeechOptions, requestOptions: RequestOptions? = null): ByteArray

Generates complete audio with voice instructions or a custom voice reference.

Link copied to clipboard
abstract suspend fun createStreamingRun(threadId: ThreadId, request: RunRequest, requestOptions: RequestOptions? = null): Flow<AssistantStreamEvent>

Create a run with event streaming.

Link copied to clipboard
abstract suspend fun createStreamingThreadRun(request: ThreadRunRequest, requestOptions: RequestOptions? = null): Flow<AssistantStreamEvent>

Create a thread and run it in one request with event streaming.

Link copied to clipboard
abstract suspend fun createThreadRun(request: ThreadRunRequest, requestOptions: RequestOptions? = null): Run

Create a thread and run it in one request.

Link copied to clipboard
abstract suspend fun createVectorStore(request: VectorStoreRequest? = null, requestOptions: RequestOptions? = null): VectorStore

Create a new vector store.

Link copied to clipboard
abstract suspend fun createVectorStoreFile(id: VectorStoreId, request: VectorStoreFileRequest, requestOptions: RequestOptions? = null): VectorStoreFile

Create a vector store file by attaching a File to a vector store.

Link copied to clipboard
open suspend fun createVectorStoreFileBatch(id: VectorStoreId, request: VectorStoreFileBatchRequest, requestOptions: RequestOptions? = null): FilesBatch

Creates a file batch with shared settings or per-file configuration.

Link copied to clipboard
abstract suspend fun createVectorStoreFilesBatch(id: VectorStoreId, request: FileBatchRequest, requestOptions: RequestOptions? = null): FilesBatch

Create a batch of vector store files.

Link copied to clipboard
open suspend fun createVectorStoreResource(request: VectorStoreCreateRequest, requestOptions: RequestOptions? = null): VectorStoreResource

Creates a vector store with current description and chunking options.

Link copied to clipboard
open suspend fun createVoice(request: VoiceCreateRequest, requestOptions: RequestOptions? = null): VoiceResource

Creates a prompt-generated or consented sample-based voice. Sample sources are consumed and closed on success or failure, without automatic retries.

Link copied to clipboard
open suspend fun createVoiceConsent(request: VoiceConsentRequest, requestOptions: RequestOptions? = null): VoiceConsent

Uploads a recording of the speaker providing the required consent phrase. Its source is consumed and closed on success or failure, without automatic retries.

Link copied to clipboard
open suspend fun decision(request: DecisionRequest, requestOptions: RequestOptions? = null): Decision

Answers the questions in request order. Any answer may be a refusal.

Link copied to clipboard
abstract suspend fun delete(id: AssistantId, requestOptions: RequestOptions? = null): Boolean

Delete an assistant.

open suspend fun delete(id: ConversationId, requestOptions: RequestOptions? = null): Boolean

Deletes a conversation. Returns false when it does not exist.

abstract suspend fun delete(fileId: FileId, requestOptions: RequestOptions? = null): Boolean

Delete a file. Only owners of organizations can delete files currently.

abstract suspend fun delete(fineTuneModel: ModelId): Boolean

Delete a fine-tuned model through the Models API. This operation remains available independently of retired fine-tunes jobs. You must have the Owner role in your organization.

abstract suspend fun delete(id: ResponseId, requestOptions: RequestOptions? = null): Boolean

Deletes a stored response.

abstract suspend fun delete(id: ThreadId, requestOptions: RequestOptions? = null): Boolean

Delete a thread.

abstract suspend fun delete(id: VectorStoreId, requestOptions: RequestOptions? = null): Boolean

Delete a vector store.

abstract suspend fun delete(id: VectorStoreId, fileId: FileId, requestOptions: RequestOptions? = null): Boolean

Delete a vector store file. This will remove the file from the vector store, but the file itself will not be deleted. To delete the file, OpenAI.delete(fileId).

Link copied to clipboard
open suspend fun deleteChatCompletion(id: String, requestOptions: RequestOptions? = null): Boolean

Delete a stored completion; returns false if it does not exist.

Link copied to clipboard
open suspend fun deleteContainer(id: ContainerId, requestOptions: RequestOptions? = null): Boolean

Deletes a container, returning false if it no longer exists.

Link copied to clipboard
open suspend fun deleteContainerFile(id: ContainerId, fileId: ContainerFileId, requestOptions: RequestOptions? = null): Boolean

Deletes a container file, returning false if it no longer exists.

Link copied to clipboard
open suspend fun deleteConversationItem(id: ConversationId, itemId: String, requestOptions: RequestOptions? = null): Conversation

Removes an item and returns the updated conversation.

Link copied to clipboard
open suspend fun deleteSkill(id: SkillId, requestOptions: RequestOptions? = null): Boolean

Deletes the skill and all its versions; returns false for HTTP 404.

Link copied to clipboard
open suspend fun deleteSkillVersion(id: SkillId, version: String, requestOptions: RequestOptions? = null): Boolean

Deletes a version by its version string; the API rejects deletion of a selected default.

Link copied to clipboard
open suspend fun deleteVoice(id: String, requestOptions: RequestOptions? = null): Boolean

Deletes a voice; returns false when it does not exist. Its consent recording remains available.

Link copied to clipboard
open suspend fun deleteVoiceConsent(id: String, requestOptions: RequestOptions? = null): Boolean

Deletes a consent recording; returns false when it does not exist.

Link copied to clipboard
open suspend fun deleteWebhookEndpoint(id: String, requestOptions: RequestOptions? = null): Boolean

Delete an endpoint; returns false when it no longer exists.

Link copied to clipboard
abstract suspend fun download(fileId: FileId, requestOptions: RequestOptions? = null): ByteArray

Returns the contents of the specified fileId.

Link copied to clipboard
open suspend fun downloadContainerFile(id: ContainerId, fileId: ContainerFileId, requestOptions: RequestOptions? = null): ByteArray

Downloads exact file bytes; missing files and other API errors propagate.

Link copied to clipboard
open suspend fun downloadLiveRecording(id: String, requestOptions: RequestOptions? = null): ByteArray

Downloads recording content for a session started with storage enabled.

Link copied to clipboard
open suspend fun downloadSkill(id: SkillId, requestOptions: RequestOptions? = null): ByteArray

Downloads the skill ZIP bundle as exact bytes. HTTP errors propagate.

Link copied to clipboard
open suspend fun downloadSkillVersion(id: SkillId, version: String, requestOptions: RequestOptions? = null): ByteArray

Downloads the specified version's ZIP as exact bytes. HTTP errors propagate.

Link copied to clipboard
abstract suspend fun edit(request: EditsRequest): Edit

Creates a new edit for the provided input, instruction, and parameters.

Link copied to clipboard
abstract suspend fun embeddings(request: EmbeddingRequest, requestOptions: RequestOptions? = null): EmbeddingResponse

Creates an embedding vector representing the input text.

Link copied to clipboard
abstract suspend fun file(fileId: FileId, requestOptions: RequestOptions? = null): File?

Returns information about a specific file.

abstract suspend fun file(request: FileUpload, requestOptions: RequestOptions? = null): File

Upload a file that contains document(s) to be used across various endpoints/features.

Link copied to clipboard
abstract suspend fun files(requestOptions: RequestOptions? = null): List<File>

Returns a list of files that belong to the user's organization.

Link copied to clipboard
open suspend fun filesPage(after: FileId? = null, limit: Int? = null, order: SortOrder? = null, purpose: Purpose? = null, requestOptions: RequestOptions? = null): PaginatedList<FileResource>

Lists a page of files while preserving pagination cursors.

Link copied to clipboard
abstract suspend fun fineTune(fineTuneId: FineTuneId): FineTune?

Gets info about to fine-tune job.

abstract suspend fun fineTune(request: FineTuneRequest): FineTune

Creates a job that fine-tunes a specified model from a given dataset.

Link copied to clipboard
abstract suspend fun fineTuneEvents(fineTuneId: FineTuneId): List<FineTuneEvent>

Get fine-grained status updates for fine-tune job.

Link copied to clipboard
abstract fun fineTuneEventsFlow(fineTuneId: FineTuneId): Flow<FineTuneEvent>

Get fine-grained status updates for fine-tune job.

Link copied to clipboard
abstract suspend fun fineTunes(): List<FineTune>

List your organization's fine-tuning jobs.

Link copied to clipboard
abstract suspend fun fineTuningEvents(id: FineTuningId, after: String? = null, limit: Int? = null, requestOptions: RequestOptions? = null): PaginatedList<FineTuningJobEvent>

Get status updates for a fine-tuning job.

Link copied to clipboard
abstract suspend fun fineTuningJob(id: FineTuningId, requestOptions: RequestOptions? = null): FineTuningJob?

Get info about a fine-tuning job.

abstract suspend fun fineTuningJob(request: FineTuningRequest, requestOptions: RequestOptions? = null): FineTuningJob

Creates a job that fine-tunes a specified model from a given dataset.

Link copied to clipboard
open suspend fun fineTuningJobCheckpoints(id: FineTuningId, after: String? = null, limit: Int? = null, requestOptions: RequestOptions? = null): FineTuningPage<FineTuningCheckpoint>

Lists checkpoints, retaining cursor metadata. Use the checkpoint model ID for permission operations.

Link copied to clipboard
open suspend fun fineTuningJobDetails(id: FineTuningId, requestOptions: RequestOptions? = null): FineTuningJobDetails?

Retrieves current job details, including nullable hyperparameters and paused states; returns null for HTTP 404.

Link copied to clipboard
abstract suspend fun fineTuningJobs(after: String? = null, limit: Int? = null, requestOptions: RequestOptions? = null): List<FineTuningJob>

List your organization's fine-tuning jobs.

Link copied to clipboard
open suspend fun <T> forkLiveConnection(id: String, session: LiveSessionOverrides = LiveSessionOverrides(), secure: Boolean = true, requestOptions: RequestOptions? = null, block: suspend LiveConnection.() -> T): T

Starts a primary WebSocket from stored conversation state; omitted overrides inherit the stored configuration.

Link copied to clipboard
open suspend fun forkLiveSession(id: String, request: LiveSessionForkRequest, requestOptions: RequestOptions? = null): LiveSessionResult

Forks stored conversation state into a new WebRTC session.

Link copied to clipboard
abstract suspend fun getRun(threadId: ThreadId, runId: RunId, requestOptions: RequestOptions? = null): Run

Retrieves a run.

Link copied to clipboard
open suspend fun hangupLiveSession(id: String, requestOptions: RequestOptions? = null)

Ends a SIP call.

Link copied to clipboard
open suspend fun hangupRealtimeCall(id: String, requestOptions: RequestOptions? = null)

Hangs up a call.

Link copied to clipboard
open suspend fun image(edit: ImageEditRequest, requestOptions: RequestOptions? = null): ImageResponse

Edits referenced images using the current JSON contract and returns response metadata.

open suspend fun image(creation: ImageGenerationRequest, requestOptions: RequestOptions? = null): ImageResponse

Generates base64 images with response metadata. An explicit current image model is required.

Link copied to clipboard
open fun imageEvents(edit: ImageEditRequest, requestOptions: RequestOptions? = null): Flow<ImageEvent>

Streams edit events. Collection starts the request; cancellation closes its response. Service errors are emitted as error events.

open fun imageEvents(creation: ImageGenerationRequest, requestOptions: RequestOptions? = null): Flow<ImageEvent>

Streams generation events. Collection starts the request; cancellation closes its response. Service errors are emitted as error events.

Link copied to clipboard
abstract suspend fun imageJSON(creation: ImageCreation, requestOptions: RequestOptions? = null): List<ImageJSON>

Creates an image given a prompt. Get images as base 64 JSON.

abstract suspend fun imageJSON(edit: ImageEdit, requestOptions: RequestOptions? = null): List<ImageJSON>

Creates an edited or extended image given an original image and a prompt. Get images as base 64 JSON.

abstract suspend fun imageJSON(variation: ImageVariation, requestOptions: RequestOptions? = null): List<ImageJSON>

Creates a variation of a given image. Get images as base 64 JSON.

Link copied to clipboard
abstract suspend fun imageURL(creation: ImageCreation, requestOptions: RequestOptions? = null): List<ImageURL>

Creates an image given a prompt. Get images as URLs.

abstract suspend fun imageURL(edit: ImageEdit, requestOptions: RequestOptions? = null): List<ImageURL>

Creates an edited or extended image given an original image and a prompt. Get images as URLs.

abstract suspend fun imageURL(variation: ImageVariation, requestOptions: RequestOptions? = null): List<ImageURL>

Creates a variation of a given image. Get images as URLs.

Link copied to clipboard
open suspend fun <T> liveSession(session: LiveSessionConfig, secure: Boolean = true, requestOptions: RequestOptions? = null, block: suspend LiveConnection.() -> T): T

Opens a primary WebSocket and sends session.start. secure=false is intended only for trusted local test servers.

Link copied to clipboard
abstract suspend fun message(threadId: ThreadId, messageId: MessageId, requestOptions: RequestOptions? = null): Message

Retrieve a message.

abstract suspend fun message(threadId: ThreadId, request: MessageRequest, requestOptions: RequestOptions? = null): Message

Create a message.

abstract suspend fun message(threadId: ThreadId, messageId: MessageId, metadata: Map<String, String>? = null, requestOptions: RequestOptions? = null): Message

Modify a message.

Link copied to clipboard
abstract suspend fun messages(threadId: ThreadId, limit: Int? = null, order: SortOrder? = null, after: MessageId? = null, before: MessageId? = null, requestOptions: RequestOptions? = null): List<Message>

Returns a list of messages for a given thread.

Link copied to clipboard
abstract suspend fun model(modelId: ModelId, requestOptions: RequestOptions? = null): Model

Retrieves a model instance, providing basic information about the model such as the owner and permission.

Link copied to clipboard
abstract suspend fun models(requestOptions: RequestOptions? = null): List<Model>

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Link copied to clipboard
open suspend fun moderate(request: MultimodalModerationRequest, requestOptions: RequestOptions? = null): TextModeration

Classifies text and image content together using an omni-moderation model.

Link copied to clipboard
abstract suspend fun moderations(request: ModerationRequest, requestOptions: RequestOptions? = null): TextModeration

Classifies if a text violates OpenAI's Content Policy.

Link copied to clipboard
open suspend fun pauseFineTuningJob(id: FineTuningId, requestOptions: RequestOptions? = null): FineTuningJobDetails

Requests a pause and returns current job details. The job can initially be in the pausing state.

Link copied to clipboard
open suspend fun realtimeCall(sdp: String, session: RealtimeSessionConfig? = null, requestOptions: RequestOptions? = null): RealtimeCall

Exchanges an SDP offer for an answer. The caller owns the WebRTC peer connection and media tracks.

Link copied to clipboard
open suspend fun realtimeClientSecret(request: RealtimeClientSecretRequest = RealtimeClientSecretRequest(), requestOptions: RequestOptions? = null): RealtimeClientSecret

Creates an ephemeral credential without exposing the server API key to a client.

Link copied to clipboard
open suspend fun <T> realtimeSession(model: ModelId? = null, callId: String? = null, secure: Boolean = true, requestOptions: RequestOptions? = null, block: suspend RealtimeConnection.() -> T): T

Opens a scoped WebSocket conversation. Use model for a new session or callId for an existing call's sideband. secure=false is only for trusted local test servers.

Link copied to clipboard
open suspend fun <T> realtimeTranslation(model: ModelId, secure: Boolean = true, requestOptions: RequestOptions? = null, block: suspend RealtimeConnection.() -> T): T

Opens a scoped continuous translation WebSocket. The server requires the model query parameter.

Link copied to clipboard

Creates a continuous translation credential.

Link copied to clipboard
open suspend fun referLiveSession(id: String, targetUri: String, requestOptions: RequestOptions? = null)

Transfers a SIP call to a nonblank tel: or sip: target URI.

Link copied to clipboard
open suspend fun referRealtimeCall(id: String, targetUri: String, requestOptions: RequestOptions? = null)

Transfers a SIP call to a tel: or sip: URI.

Link copied to clipboard
open suspend fun rejectLiveSession(id: String, statusCode: Int, requestOptions: RequestOptions? = null)

Rejects an incoming SIP call with a required SIP status from 300 to 699.

Link copied to clipboard
open suspend fun rejectRealtimeCall(id: String, statusCode: Int? = null, requestOptions: RequestOptions? = null)

Rejects an incoming SIP call; statusCode is an optional SIP status.

Link copied to clipboard
abstract suspend fun response(id: ResponseId, requestOptions: RequestOptions? = null): Response?

Retrieves a response by its identifier.

abstract suspend fun response(request: ResponseRequest, requestOptions: RequestOptions? = null): Response

Creates a model response.

Link copied to clipboard
abstract suspend fun responseInputItems(id: ResponseId, limit: Int? = null, order: SortOrder? = null, after: String? = null, before: String? = null, requestOptions: RequestOptions? = null): PaginatedList<ResponseInputItem>

Lists input items for a response.

Link copied to clipboard
open suspend fun responseInputItemsPage(id: ResponseId, include: List<String> = emptyList(), limit: Int? = null, order: SortOrder? = null, after: String? = null, before: String? = null, requestOptions: RequestOptions? = null): PaginatedList<ResponseInputEntry>

Lists current input items, optionally including tool or reasoning fields.

Link copied to clipboard
open suspend fun responseInputTokens(request: ResponseTokenCountRequest, requestOptions: RequestOptions? = null): ResponseTokenCount

Counts input tokens without generating output.

Link copied to clipboard
open suspend fun <T> responseSession(secure: Boolean = true, requestOptions: RequestOptions? = null, block: suspend ResponseConnection.() -> T): T

Opens a scoped Responses WebSocket. The block owns the connection lifetime. Requires a WebSocket-capable engine. secure=false is intended only for trusted local servers.

Link copied to clipboard
open suspend fun resumeFineTuningJob(id: FineTuningId, requestOptions: RequestOptions? = null): FineTuningJobDetails

Resumes a paused job and returns current job details.

Link copied to clipboard
open fun resumeResponse(id: ResponseId, startingAfter: Int? = null, include: List<String>? = null, includeObfuscation: Boolean? = null, requestOptions: RequestOptions? = null): Flow<ResponseStreamEvent>

Resumes events from a stored background response after a sequence number.

Link copied to clipboard
open suspend fun retrieveContainer(id: ContainerId, requestOptions: RequestOptions? = null): Container?

Retrieves a container, or null if it does not exist.

Link copied to clipboard
open suspend fun retrieveContainerFile(id: ContainerId, fileId: ContainerFileId, requestOptions: RequestOptions? = null): ContainerFile?

Retrieves a container-file resource, or null if it no longer exists.

Link copied to clipboard
open suspend fun retrieveFile(fileId: FileId, requestOptions: RequestOptions? = null): FileResource?

Retrieves current file metadata, including its expiration timestamp.

Link copied to clipboard
open suspend fun retrieveResponse(id: ResponseId, include: List<String> = emptyList(), requestOptions: RequestOptions? = null): ResponseResult?

Retrieves a current response, optionally including additional tool or reasoning fields.

Link copied to clipboard
open suspend fun retrieveSkill(id: SkillId, requestOptions: RequestOptions? = null): Skill?

Retrieves skill metadata, or null for HTTP 404.

Link copied to clipboard
open suspend fun retrieveSkillVersion(id: SkillId, version: String, requestOptions: RequestOptions? = null): SkillVersion?

Retrieves a version by its version string, or null for HTTP 404.

Link copied to clipboard
open suspend fun rotateWebhookSecret(id: String, request: WebhookSecretRotation = WebhookSecretRotation(), requestOptions: RequestOptions? = null): WebhookEndpoint

Rotate a signing key, optionally retaining the old key for 24 hours.

Link copied to clipboard
abstract suspend fun runs(threadId: ThreadId, limit: Int? = null, order: SortOrder? = null, after: RunId? = null, before: RunId? = null, requestOptions: RequestOptions? = null): List<Run>

Returns a list of runs belonging to a thread.

Link copied to clipboard
abstract suspend fun runStep(threadId: ThreadId, runId: RunId, stepId: RunStepId, requestOptions: RequestOptions? = null): RunStep

Retrieves a run step.

Link copied to clipboard
abstract suspend fun runSteps(threadId: ThreadId, runId: RunId, limit: Int? = null, order: SortOrder? = null, after: RunStepId? = null, before: RunStepId? = null, requestOptions: RequestOptions? = null): List<RunStep>

Retrieves a run step.

Link copied to clipboard
open suspend fun safetyAlert(id: String, requestOptions: RequestOptions? = null): SafetyAlert

Retrieves a project safety alert. API errors, including missing resources, propagate.

Link copied to clipboard
open suspend fun safetyCase(id: String, requestOptions: RequestOptions? = null): SafetyCase

Retrieves a safety case. API errors, including missing resources, propagate.

Link copied to clipboard
open suspend fun searchVectorStore(id: VectorStoreId, request: VectorStoreSearchRequest, requestOptions: RequestOptions? = null): VectorStoreSearchPage

Searches indexed file chunks with optional attribute filters.

Link copied to clipboard
open suspend fun skillsPage(query: SkillListQuery = SkillListQuery(), requestOptions: RequestOptions? = null): PaginatedList<Skill>

Lists project skills with cursor metadata.

Link copied to clipboard
open suspend fun skillVersionsPage(id: SkillId, query: SkillVersionListQuery = SkillVersionListQuery(), requestOptions: RequestOptions? = null): PaginatedList<SkillVersion>

Lists immutable versions with version-resource cursor IDs.

Link copied to clipboard
abstract suspend fun speech(request: SpeechRequest, requestOptions: RequestOptions? = null): ByteArray

Generates audio from the input text.

Link copied to clipboard
open fun speechAudio(request: SpeechRequest, options: SpeechOptions = SpeechOptions(), requestOptions: RequestOptions? = null): Flow<ByteArray>

Streams binary speech audio chunks. Collection starts the request; cancellation closes it.

Link copied to clipboard
open fun speechEvents(request: SpeechRequest, options: SpeechOptions = SpeechOptions(), requestOptions: RequestOptions? = null): Flow<SpeechEvent>

Streams base64 audio deltas and completion usage using server-sent events.

Link copied to clipboard
open suspend fun storedChatCompletion(id: String, requestOptions: RequestOptions? = null): ChatCompletionResult?

Retrieve a stored completion; returns null if it does not exist.

Link copied to clipboard
open suspend fun storedChatCompletions(query: ChatCompletionListQuery = ChatCompletionListQuery(), requestOptions: RequestOptions? = null): PaginatedList<ChatCompletionResult>

List stored completions with pagination and optional filters.

Link copied to clipboard
open fun streamChatCompletions(request: ChatCompletionRequest, options: ChatCompletionOptions, requestOptions: RequestOptions? = null): Flow<ChatCompletionResult>

Stream richer message and custom tool deltas.

Link copied to clipboard
open fun streamResponses(request: ResponseCreateRequest, requestOptions: RequestOptions? = null): Flow<ResponseStreamEvent>

Streams a current response. Cancelling collection closes the HTTP connection.

Link copied to clipboard
abstract suspend fun submitStreamingToolOutput(threadId: ThreadId, runId: RunId, output: List<ToolOutput>, requestOptions: RequestOptions? = null): Flow<AssistantStreamEvent>

When a run has the status: Status.RequiresAction and required action is RequiredAction.SubmitToolOutputs, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request using event streaming.

Link copied to clipboard
abstract suspend fun submitToolOutput(threadId: ThreadId, runId: RunId, output: List<ToolOutput>, requestOptions: RequestOptions? = null): Run

When a run has the status: Status.RequiresAction and required action is RequiredAction.SubmitToolOutputs, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.

Link copied to clipboard
open suspend fun testWebhookEndpoint(id: String, request: WebhookTestRequest, requestOptions: RequestOptions? = null): WebhookTestResult

Send a sample event; inspect the returned statusCode for receiver success.

Link copied to clipboard
abstract suspend fun thread(id: ThreadId, requestOptions: RequestOptions? = null): Thread?

Retrieve a thread.

abstract suspend fun thread(request: ThreadRequest? = null, requestOptions: RequestOptions? = null): Thread

Create a thread.

abstract suspend fun thread(id: ThreadId, metadata: Map<String, String>, requestOptions: RequestOptions? = null): Thread

Modify a thread.

Link copied to clipboard
open suspend fun transcribe(request: TranscriptionRequest, options: TranscriptionOptions, requestOptions: RequestOptions? = null): AudioTranscription

Transcribes audio with modern controls and returns usage, confidence and speaker data.

Link copied to clipboard
abstract suspend fun transcription(request: TranscriptionRequest, requestOptions: RequestOptions? = null): Transcription

Transcribes audio into the input language.

Link copied to clipboard
open fun transcriptions(request: TranscriptionRequest, options: TranscriptionOptions = TranscriptionOptions(), requestOptions: RequestOptions? = null): Flow<TranscriptionEvent>

Streams transcription text, completion and speaker-segment events. Collection starts the request. Cancelling collection releases the response. Model support for streaming varies.

Link copied to clipboard
abstract suspend fun translation(request: TranslationRequest, requestOptions: RequestOptions? = null): Translation

Translates audio into English.

Link copied to clipboard
open suspend fun updateChatCompletion(id: String, request: ChatCompletionUpdate, requestOptions: RequestOptions? = null): ChatCompletionResult

Update metadata on a stored completion.

Link copied to clipboard
open suspend fun updateConversation(id: ConversationId, request: ConversationUpdateRequest, requestOptions: RequestOptions? = null): Conversation

Updates the supplied metadata keys, preserving existing keys that are not included.

Link copied to clipboard
abstract suspend fun updateRun(threadId: ThreadId, runId: RunId, metadata: Map<String, String>? = null, requestOptions: RequestOptions? = null): Run

Modifies a run.

Link copied to clipboard
open suspend fun updateSkillDefaultVersion(id: SkillId, request: SkillDefaultVersionRequest, requestOptions: RequestOptions? = null): Skill

Changes the default version pointer to an existing version string.

Link copied to clipboard
abstract suspend fun updateVectorStore(id: VectorStoreId, request: VectorStoreRequest, requestOptions: RequestOptions? = null): VectorStore

Update a vector store.

Link copied to clipboard
open suspend fun updateVectorStoreFields(id: VectorStoreId, request: VectorStoreUpdateRequest, requestOptions: RequestOptions? = null): VectorStoreResource

Updates supplied fields, including explicit nulls, without create-only file IDs.

Link copied to clipboard
open suspend fun updateVectorStoreFile(id: VectorStoreId, fileId: FileId, attributes: Map<String, JsonPrimitive>?, requestOptions: RequestOptions? = null): VectorStoreFileResource

Replaces file attributes; null clears all attributes.

Link copied to clipboard
open suspend fun updateVoiceConsent(id: String, request: VoiceConsentUpdateRequest, requestOptions: RequestOptions? = null): VoiceConsent

Changes only the recording's label; its audio and language are unchanged.

Link copied to clipboard
open suspend fun updateWebhookEndpoint(id: String, request: WebhookEndpointUpdate, requestOptions: RequestOptions? = null): WebhookEndpoint

Update an endpoint configuration.

Link copied to clipboard
open suspend fun upload(request: UploadRequest, requestOptions: RequestOptions? = null): Upload

Creates an upload with its expected total length and resulting file's expiration policy.

Link copied to clipboard
open suspend fun uploadContainerFile(id: ContainerId, file: FileSource, requestOptions: RequestOptions? = null): ContainerFile

Uploads raw bytes once, closing the source even on failure. Use a fresh source for each request; uploads are not automatically retried.

Link copied to clipboard
open suspend fun uploadFile(request: FileUploadRequest, requestOptions: RequestOptions? = null): FileResource

Uploads a file with optional expiration and returns current response metadata.

Link copied to clipboard
open suspend fun uploadPart(id: UploadId, data: FileSource, requestOptions: RequestOptions? = null): UploadPart

Uploads one part. Consumes and closes data's source; use a new source for every call. Parts may be uploaded concurrently; their final order is chosen by completeUpload.

Link copied to clipboard
abstract suspend fun vectorStore(id: VectorStoreId, requestOptions: RequestOptions? = null): VectorStore?

Retrieve a vector store.

Link copied to clipboard
open suspend fun vectorStoreBatchFilesPage(id: VectorStoreId, batchId: BatchId, limit: Int? = null, order: SortOrder? = null, after: FileId? = null, before: FileId? = null, filter: Status? = null, requestOptions: RequestOptions? = null): PaginatedList<VectorStoreFileResource>

Lists files in a batch using file identifiers as cursors.

Link copied to clipboard
open suspend fun vectorStoreFile(id: VectorStoreId, fileId: FileId, requestOptions: RequestOptions? = null): VectorStoreFileResource?

Retrieves an indexed file, or null if it does not exist.

Link copied to clipboard
abstract suspend fun vectorStoreFileBatch(vectorStoreId: VectorStoreId, batchId: BatchId, requestOptions: RequestOptions? = null): FilesBatch?

Retrieves a vector store file batch.

Link copied to clipboard
open suspend fun vectorStoreFileContent(id: VectorStoreId, fileId: FileId, requestOptions: RequestOptions? = null): VectorStoreContentPage

Retrieves parsed content rather than the original binary file.

Link copied to clipboard
abstract suspend fun vectorStoreFiles(id: VectorStoreId, limit: Int? = null, order: SortOrder? = null, after: VectorStoreId? = null, before: VectorStoreId? = null, filter: Status? = null, requestOptions: RequestOptions? = null): List<VectorStoreFile>

Returns a list of vector store files.

Link copied to clipboard
abstract suspend fun vectorStoreFilesBatches(vectorStoreId: VectorStoreId, batchId: BatchId, limit: Int? = null, order: SortOrder? = null, after: VectorStoreId? = null, before: VectorStoreId? = null, filter: Status? = null, requestOptions: RequestOptions? = null): List<VectorStoreFile>

Returns a list of vector store files in a batch.

Link copied to clipboard
open suspend fun vectorStoreFilesPage(id: VectorStoreId, limit: Int? = null, order: SortOrder? = null, after: FileId? = null, before: FileId? = null, filter: Status? = null, requestOptions: RequestOptions? = null): PaginatedList<VectorStoreFileResource>

Lists indexed files using file identifiers as cursors and preserves pagination metadata.

Link copied to clipboard
abstract suspend fun vectorStores(limit: Int? = null, order: SortOrder? = null, after: VectorStoreId? = null, before: VectorStoreId? = null, requestOptions: RequestOptions? = null): List<VectorStore>

List all vector stores.

Link copied to clipboard
open suspend fun voiceConsent(id: String, requestOptions: RequestOptions? = null): VoiceConsent?

Retrieves a consent recording's metadata, or null when it does not exist.

Link copied to clipboard
open suspend fun voiceConsents(after: String? = null, limit: Int? = null, requestOptions: RequestOptions? = null): VoiceConsentPage

Lists consent recordings; use the lastId cursor to retrieve another page.

Link copied to clipboard
open suspend fun webhookEndpoint(request: WebhookEndpointRequest, requestOptions: RequestOptions? = null): WebhookEndpoint

Create an endpoint; signingSecret is returned only here and during rotation.

open suspend fun webhookEndpoint(id: String, requestOptions: RequestOptions? = null): WebhookEndpoint?

Retrieve endpoint configuration without returning its signing key.

Link copied to clipboard
open suspend fun webhookEndpoints(after: String? = null, limit: Int? = null, requestOptions: RequestOptions? = null): PaginatedList<WebhookEndpoint>

List project endpoints with cursor metadata.