view release on metacpan or search on metacpan
share/openapi.yaml view on Meta::CPAN
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
MessageListPage page = client.chat().completions().messages().list("completion_id");
}
}
ruby: |-
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
page = openai.chat.completions.messages.list("completion_id")
puts(page)
response: |
{
"object": "list",
"data": [
{
"id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0",
"role": "user",
"content": "write a haiku about ai",
"name": null,
"content_parts": null
}
],
"first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0",
"last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0",
"has_more": false
}
/completions:
post:
operationId: createCompletion
tags:
- Completions
summary: >
Creates a completion for the provided prompt and parameters.
Returns a completion object, or a sequence of completion objects if the
request is streamed.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateCompletionRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CreateCompletionResponse'
x-oaiMeta:
name: Create completion
group: completions
legacy: true
examples:
- title: No streaming
request:
curl: |
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "VAR_completion_model_id",
"prompt": "Say this is a test",
"max_tokens": 7,
"temperature": 0
}'
python: |-
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
for completion in client.completions.create(
model="gpt-3.5-turbo-instruct",
prompt="This is a test.",
):
print(completion)
javascript: |-
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
const completion = await openai.completions.create({
model: "VAR_completion_model_id",
prompt: "Say this is a test.",
max_tokens: 7,
temperature: 0,
});
console.log(completion);
}
main();
node.js: |-
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const completion = await client.completions.create({
model: 'gpt-3.5-turbo-instruct',
prompt: 'This is a test.',
});
console.log(completion);
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tco...
java: |-
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.completions.Completion;
import com.openai.models.completions.CompletionCreateParams;
share/openapi.yaml view on Meta::CPAN
"temperature": 1.0,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1.0,
"truncation": "disabled",
"usage": {
"input_tokens": 81,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 1035,
"output_tokens_details": {
"reasoning_tokens": 832
},
"total_tokens": 1116
},
"user": null,
"metadata": {}
}
/responses/{response_id}:
get:
operationId: getResponse
tags:
- Responses
summary: |
Retrieves a model response with the given ID.
parameters:
- in: path
name: response_id
required: true
schema:
type: string
example: resp_677efb5139a88190b512bc3fef8e535d
description: The ID of the response to retrieve.
- in: query
name: include
schema:
type: array
items:
$ref: '#/components/schemas/IncludeEnum'
description: |
Additional fields to include in the response. See the `include`
parameter for Response creation above for more information.
- in: query
name: stream
schema:
type: boolean
description: >
If set to true, the model response data will be streamed to the
client
as it is generated using [server-sent
events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
See the [Streaming section
below](/docs/api-reference/responses-streaming)
for more information.
- in: query
name: starting_after
schema:
type: integer
description: |
The sequence number of the event after which to start streaming.
- in: query
name: include_obfuscation
schema:
type: boolean
description: >
When true, stream obfuscation will be enabled. Stream obfuscation
adds
random characters to an `obfuscation` field on streaming delta
events
to normalize payload sizes as a mitigation to certain side-channel
attacks. These obfuscation fields are included by default, but add a
small amount of overhead to the data stream. You can set
`include_obfuscation` to false to optimize for bandwidth if you
trust
the network links between your application and the OpenAI API.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Response'
x-oaiMeta:
name: Get a model response
group: responses
examples:
request:
curl: |
curl https://api.openai.com/v1/responses/resp_123 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY"
javascript: |
import OpenAI from "openai";
const client = new OpenAI();
const response = await client.responses.retrieve("resp_123");
console.log(response);
python: |-
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
for response in client.responses.retrieve(
response_id="resp_677efb5139a88190b512bc3fef8e535d",
):
print(response)
node.js: >-
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const response = await
client.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d');
console.log(response.id);
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\top...
share/openapi.yaml view on Meta::CPAN
minimum: 0
maximum: 2
default: 1
example: 1
- type: 'null'
top_p:
anyOf:
- type: number
minimum: 0
maximum: 1
default: 1
example: 1
description: >
An alternative to sampling with temperature, called nucleus
sampling, where the model considers the results of the tokens
with top_p probability mass. So 0.1 means only the tokens
comprising the top 10% probability mass are considered.
We generally recommend altering this or temperature but not
both.
- type: 'null'
response_format:
anyOf:
- $ref: '#/components/schemas/AssistantsApiResponseFormatOption'
- type: 'null'
required:
- id
- object
- created_at
- name
- description
- model
- instructions
- tools
- metadata
x-oaiMeta:
name: The assistant object
example: |
{
"id": "asst_abc123",
"object": "assistant",
"created_at": 1698984975,
"name": "Math Tutor",
"description": null,
"model": "gpt-4o",
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"tools": [
{
"type": "code_interpreter"
}
],
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
deprecated: true
AssistantStreamEvent:
description: >
Represents an event emitted when streaming a Run.
Each event in a server-sent events stream has an `event` and `data`
property:
```
event: thread.created
data: {"id": "thread_123", "object": "thread", ...}
```
We emit events whenever a new object is created, transitions to a new
state, or is being
streamed in parts (deltas). For example, we emit `thread.run.created`
when a new run
is created, `thread.run.completed` when a run completes, and so on. When
an Assistant chooses
to create a message during a run, we emit a `thread.message.created
event`, a
`thread.message.in_progress` event, many `thread.message.delta` events,
and finally a
`thread.message.completed` event.
We may add additional events over time, so we recommend handling unknown
events gracefully
in your code. See the [Assistants API
quickstart](/docs/assistants/overview) to learn how to
integrate the Assistants API with streaming.
oneOf:
- $ref: '#/components/schemas/ThreadStreamEvent'
- $ref: '#/components/schemas/RunStreamEvent'
- $ref: '#/components/schemas/RunStepStreamEvent'
- $ref: '#/components/schemas/MessageStreamEvent'
- $ref: '#/components/schemas/ErrorEvent'
- $ref: '#/components/schemas/DoneEvent'
x-oaiMeta:
name: Assistant stream events
beta: true
AssistantSupportedModels:
type: string
enum:
- gpt-5
- gpt-5-mini
- gpt-5-nano
- gpt-5-2025-08-07
- gpt-5-mini-2025-08-07
- gpt-5-nano-2025-08-07
- gpt-4.1
- gpt-4.1-mini
- gpt-4.1-nano
- gpt-4.1-2025-04-14
- gpt-4.1-mini-2025-04-14
- gpt-4.1-nano-2025-04-14
- o3-mini
- o3-mini-2025-01-31
- o1
- o1-2024-12-17
- gpt-4o
- gpt-4o-2024-11-20
- gpt-4o-2024-08-06
- gpt-4o-2024-05-13
- gpt-4o-mini
- gpt-4o-mini-2024-07-18
- gpt-4.5-preview
- gpt-4.5-preview-2025-02-27
- gpt-4-turbo
- gpt-4-turbo-2024-04-09
- gpt-4-0125-preview
- gpt-4-turbo-preview
- gpt-4-1106-preview
- gpt-4-vision-preview
- gpt-4
- gpt-4-0314
- gpt-4-0613
- gpt-4-32k
- gpt-4-32k-0314
- gpt-4-32k-0613
- gpt-3.5-turbo
- gpt-3.5-turbo-16k
- gpt-3.5-turbo-0613
- gpt-3.5-turbo-1106
- gpt-3.5-turbo-0125
- gpt-3.5-turbo-16k-0613
AssistantToolsCode:
type: object
title: Code interpreter tool
properties:
type:
share/openapi.yaml view on Meta::CPAN
description: The name of the function to call.
required:
- name
- arguments
audio:
anyOf:
- type: object
description: >
If the audio output modality is requested, this object contains
data
about the audio response from the model. [Learn
more](/docs/guides/audio).
required:
- id
- expires_at
- data
- transcript
properties:
id:
type: string
description: Unique identifier for this audio response.
expires_at:
type: integer
format: unixtime
description: >
The Unix timestamp (in seconds) for when this audio response
will
no longer be accessible on the server for use in multi-turn
conversations.
data:
type: string
description: >
Base64 encoded audio bytes generated by the model, in the
format
specified in the request.
transcript:
type: string
description: Transcript of the audio generated by the model.
- type: 'null'
required:
- role
- content
- refusal
ChatCompletionRole:
type: string
description: The role of the author of a message
enum:
- developer
- system
- user
- assistant
- tool
- function
ChatCompletionStreamOptions:
anyOf:
- description: >
Options for streaming response. Only set this when you set `stream:
true`.
type: object
default: null
properties:
include_usage:
type: boolean
description: >
If set, an additional chunk will be streamed before the `data:
[DONE]`
message. The `usage` field on this chunk shows the token usage
statistics
for the entire request, and the `choices` field will always be
an empty
array.
All other chunks will also include a `usage` field, but with a
null
value. **NOTE:** If the stream is interrupted, you may not
receive the
final usage chunk which contains the total token usage for the
request.
include_obfuscation:
type: boolean
description: >
When true, stream obfuscation will be enabled. Stream
obfuscation adds
random characters to an `obfuscation` field on streaming delta
events to
normalize payload sizes as a mitigation to certain side-channel
attacks.
These obfuscation fields are included by default, but add a
small amount
of overhead to the data stream. You can set
`include_obfuscation` to
false to optimize for bandwidth if you trust the network links
between
your application and the OpenAI API.
- type: 'null'
ChatCompletionStreamResponseDelta:
type: object
description: A chat completion delta generated by streamed model responses.
properties:
content:
anyOf:
- type: string
description: The contents of the chunk message.
- type: 'null'
function_call:
deprecated: true
type: object
description: >-
Deprecated and replaced by `tool_calls`. The name and arguments of a
function that should be called, as generated by the model.
properties:
arguments:
type: string
description: >-
The arguments to call the function with, as generated by the
model in JSON format. Note that the model does not always
generate valid JSON, and may hallucinate parameters not defined
by your function schema. Validate the arguments in your code
before calling your function.
name:
type: string
description: The name of the function to call.
tool_calls:
type: array
items:
$ref: '#/components/schemas/ChatCompletionMessageToolCallChunk'
role:
type: string
enum:
- developer
- system
- user
- assistant
- tool
description: The role of the author of this message.
refusal:
anyOf:
- type: string
description: The refusal message generated by the model.
share/openapi.yaml view on Meta::CPAN
Parameters for audio output. Required when audio output is
requested with
`modalities: ["audio"]`. [Learn more](/docs/guides/audio).
required:
- voice
- format
properties:
voice:
$ref: '#/components/schemas/VoiceIdsOrCustomVoice'
description: >
The voice the model uses to respond. Supported built-in
voices are
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`,
`onyx`,
`sage`, `shimmer`, `marin`, and `cedar`. You may also
provide a
custom voice object with an `id`, for example `{ "id":
"voice_1234" }`.
format:
type: string
enum:
- wav
- aac
- mp3
- flac
- opus
- pcm16
description: >
Specifies the output audio format. Must be one of `wav`,
`mp3`, `flac`,
`opus`, or `pcm16`.
store:
type: boolean
default: false
nullable: true
description: >
Whether or not to store the output of this chat completion
request for
use in our [model distillation](/docs/guides/distillation) or
[evals](/docs/guides/evals) products.
Supports text and image inputs. Note: image inputs over 8MB will
be dropped.
stream:
description: >
If set to true, the model response data will be streamed to the
client
as it is generated using [server-sent
events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
See the [Streaming section
below](/docs/api-reference/chat/streaming)
for more information, along with the [streaming
responses](/docs/guides/streaming-responses)
guide for more information on how to handle the streaming
events.
type: boolean
nullable: true
default: false
stop:
$ref: '#/components/schemas/StopConfiguration'
logit_bias:
type: object
x-oaiTypeLabel: map
default: null
nullable: true
additionalProperties:
type: integer
description: >
Modify the likelihood of specified tokens appearing in the
completion.
Accepts a JSON object that maps tokens (specified by their token
ID in the
tokenizer) to an associated bias value from -100 to 100.
Mathematically,
the bias is added to the logits generated by the model prior to
sampling.
The exact effect will vary per model, but values between -1 and
1 should
decrease or increase likelihood of selection; values like -100
or 100
should result in a ban or exclusive selection of the relevant
token.
logprobs:
description: >
Whether to return log probabilities of the output tokens or not.
If true,
returns the log probabilities of each output token returned in
the
`content` of `message`.
type: boolean
default: false
nullable: true
max_tokens:
description: >
The maximum number of [tokens](/tokenizer) that can be generated
in the
chat completion. This value can be used to control
[costs](https://openai.com/api/pricing/) for text generated via
API.
This value is now deprecated in favor of
`max_completion_tokens`, and is
share/openapi.yaml view on Meta::CPAN
determinism.
object:
type: string
description: The object type, which is always `chat.completion`.
enum:
- chat.completion
x-stainless-const: true
usage:
$ref: '#/components/schemas/CompletionUsage'
required:
- choices
- created
- id
- model
- object
x-oaiMeta:
name: The chat completion object
group: chat
example: |
{
"id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG",
"object": "chat.completion",
"created": 1741570283,
"model": "gpt-4o-2024-08-06",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in ...
"refusal": null,
"annotations": []
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1117,
"completion_tokens": 46,
"total_tokens": 1163,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
},
"service_tier": "default",
"system_fingerprint": "fp_fc9f1d7035"
}
CreateChatCompletionStreamResponse:
type: object
description: |
Represents a streamed chunk of a chat completion response returned
by the model, based on the provided input.
[Learn more](/docs/guides/streaming-responses).
properties:
id:
type: string
description: >-
A unique identifier for the chat completion. Each chunk has the same
ID.
choices:
type: array
description: >
A list of chat completion choices. Can contain more than one
elements if `n` is greater than 1. Can also be empty for the
last chunk if you set `stream_options: {"include_usage": true}`.
items:
type: object
required:
- delta
- finish_reason
- index
properties:
delta:
$ref: '#/components/schemas/ChatCompletionStreamResponseDelta'
logprobs:
description: Log probability information for the choice.
type: object
nullable: true
properties:
content:
description: >-
A list of message content tokens with log probability
information.
type: array
items:
$ref: '#/components/schemas/ChatCompletionTokenLogprob'
nullable: true
refusal:
description: >-
A list of message refusal tokens with log probability
information.
type: array
items:
$ref: '#/components/schemas/ChatCompletionTokenLogprob'
nullable: true
required:
- content
- refusal
finish_reason:
type: string
description: >
The reason the model stopped generating tokens. This will be
`stop` if the model hit a natural stop point or a provided
stop sequence,
`length` if the maximum number of tokens specified in the
request was reached,
`content_filter` if content was omitted due to a flag from our
content filters,
`tool_calls` if the model called a tool, or `function_call`
share/openapi.yaml view on Meta::CPAN
response_format:
type: string
enum:
- url
- b64_json
example: url
nullable: true
description: >-
The format in which the generated images are returned. Must be one
of `url` or `b64_json`. URLs are only valid for 60 minutes after the
image has been generated. This parameter is only supported for
`dall-e-2` (default is `url` for `dall-e-2`), as GPT image models
always return base64-encoded images.
output_format:
type: string
enum:
- png
- jpeg
- webp
default: png
example: png
nullable: true
description: >
The format in which the generated images are returned. This
parameter is
only supported for the GPT image models. Must be one of `png`,
`jpeg`, or `webp`.
The default value is `png`.
output_compression:
type: integer
default: 100
example: 100
nullable: true
description: >
The compression level (0-100%) for the generated images. This
parameter
is only supported for the GPT image models with the `webp` or `jpeg`
output
formats, and defaults to 100.
user:
type: string
example: user-1234
description: >
A unique identifier representing your end-user, which can help
OpenAI to monitor and detect abuse. [Learn
more](/docs/guides/safety-best-practices#end-user-ids).
input_fidelity:
anyOf:
- $ref: '#/components/schemas/InputFidelity'
- type: 'null'
stream:
type: boolean
default: false
example: false
nullable: true
description: >
Edit the image in streaming mode. Defaults to `false`. See the
[Image generation guide](/docs/guides/image-generation) for more
information.
partial_images:
$ref: '#/components/schemas/PartialImages'
quality:
type: string
enum:
- standard
- low
- medium
- high
- auto
default: auto
example: high
nullable: true
description: >
The quality of the image that will be generated for GPT image
models. Defaults to `auto`.
required:
- prompt
- image
CreateImageRequest:
type: object
properties:
prompt:
description: >-
A text description of the desired image(s). The maximum length is
32000 characters for the GPT image models, 1000 characters for
`dall-e-2` and 4000 characters for `dall-e-3`.
type: string
example: A cute baby sea otter
model:
anyOf:
- type: string
- type: string
enum:
- gpt-image-1.5
- dall-e-2
- dall-e-3
- gpt-image-1
- gpt-image-1-mini
x-oaiTypeLabel: string
default: dall-e-2
example: gpt-image-1.5
nullable: true
description: >-
The model to use for image generation. One of `dall-e-2`,
`dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`,
`gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter specific
to the GPT image models is used.
'n':
type: integer
minimum: 1
maximum: 10
default: 1
example: 1
nullable: true
description: >-
The number of images to generate. Must be between 1 and 10. For
share/openapi.yaml view on Meta::CPAN
- medium
- high
- auto
default: auto
example: medium
nullable: true
description: >
The quality of the image that will be generated.
- `auto` (default value) will automatically select the best quality
for the given model.
- `high`, `medium` and `low` are supported for the GPT image models.
- `hd` and `standard` are supported for `dall-e-3`.
- `standard` is the only option for `dall-e-2`.
response_format:
type: string
enum:
- url
- b64_json
default: url
example: url
nullable: true
description: >-
The format in which generated images with `dall-e-2` and `dall-e-3`
are returned. Must be one of `url` or `b64_json`. URLs are only
valid for 60 minutes after the image has been generated. This
parameter isn't supported for the GPT image models, which always
return base64-encoded images.
output_format:
type: string
enum:
- png
- jpeg
- webp
default: png
example: png
nullable: true
description: >-
The format in which the generated images are returned. This
parameter is only supported for the GPT image models. Must be one of
`png`, `jpeg`, or `webp`.
output_compression:
type: integer
default: 100
example: 100
nullable: true
description: >-
The compression level (0-100%) for the generated images. This
parameter is only supported for the GPT image models with the `webp`
or `jpeg` output formats, and defaults to 100.
stream:
type: boolean
default: false
example: false
nullable: true
description: >
Generate the image in streaming mode. Defaults to `false`. See the
[Image generation guide](/docs/guides/image-generation) for more
information.
This parameter is only supported for the GPT image models.
partial_images:
$ref: '#/components/schemas/PartialImages'
size:
anyOf:
- type: string
- type: string
enum:
- auto
- 1024x1024
- 1536x1024
- 1024x1536
- 256x256
- 512x512
- 1792x1024
- 1024x1792
default: auto
example: 1024x1024
nullable: true
description: >-
The size of the generated images. For `gpt-image-2` and
`gpt-image-2-2026-04-21`, arbitrary resolutions are supported as
`WIDTHxHEIGHT` strings, for example `1536x864`. Width and height
must both be divisible by 16 and the requested aspect ratio must be
between 1:3 and 3:1. Resolutions above `2560x1440` are experimental,
and the maximum supported resolution is `3840x2160`. The requested
size must also satisfy the model's current pixel and edge limits.
The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
supported by the GPT image models; `auto` is supported for models
that allow automatic sizing. For `dall-e-2`, use one of `256x256`,
`512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`,
`1792x1024`, or `1024x1792`.
moderation:
type: string
enum:
- low
- auto
default: auto
example: low
nullable: true
description: >-
Control the content-moderation level for images generated by the GPT
image models. Must be either `low` for less restrictive filtering or
`auto` (default value).
background:
type: string
enum:
- transparent
- opaque
- auto
default: auto
example: transparent
nullable: true
description: >
Allows to set transparency for the background of the generated
image(s).
share/openapi.yaml view on Meta::CPAN
- `message.input_image.image_url`: Include image urls from
the input message.
- `message.output_text.logprobs`: Include logprobs with
assistant messages.
- `reasoning.encrypted_content`: Includes an encrypted
version of reasoning tokens in reasoning item outputs. This
enables reasoning items to be used in multi-turn
conversations when using the Responses API statelessly (like
when the `store` parameter is set to `false`, or when an
organization is enrolled in the zero data retention
program).
items:
$ref: '#/components/schemas/IncludeEnum'
- type: 'null'
parallel_tool_calls:
anyOf:
- type: boolean
description: |
Whether to allow the model to run tool calls in parallel.
default: true
- type: 'null'
store:
anyOf:
- type: boolean
description: >
Whether to store the generated model response for later
retrieval via
API.
default: true
- type: 'null'
instructions:
anyOf:
- type: string
description: >
A system (or developer) message inserted into the model's
context.
When using along with `previous_response_id`, the
instructions from a previous
response will not be carried over to the next response. This
makes it simple
to swap out system (or developer) messages in new responses.
- type: 'null'
stream:
anyOf:
- description: >
If set to true, the model response data will be streamed to
the client
as it is generated using [server-sent
events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
See the [Streaming section
below](/docs/api-reference/responses-streaming)
for more information.
type: boolean
default: false
- type: 'null'
stream_options:
$ref: '#/components/schemas/ResponseStreamOptions'
conversation:
anyOf:
- $ref: '#/components/schemas/ConversationParam'
- type: 'null'
context_management:
anyOf:
- type: array
description: |
Context management configuration for this request.
minItems: 1
items:
$ref: '#/components/schemas/ContextManagementParam'
- type: 'null'
max_output_tokens:
anyOf:
- description: >
An upper bound for the number of tokens that can be
generated for a response, including visible output tokens
and [reasoning tokens](/docs/guides/reasoning).
type: integer
minimum: 16
- type: 'null'
CreateRunRequest:
type: object
additionalProperties: false
properties:
assistant_id:
description: >-
The ID of the [assistant](/docs/api-reference/assistants) to use to
execute this run.
type: string
model:
description: >-
The ID of the [Model](/docs/api-reference/models) to be used to
execute this run. If a value is provided here, it will override the
model associated with the assistant. If not, the model associated
with the assistant will be used.
example: gpt-4o
anyOf:
- type: string
- $ref: '#/components/schemas/AssistantSupportedModels'
x-oaiTypeLabel: string
nullable: true
reasoning_effort:
$ref: '#/components/schemas/ReasoningEffort'
instructions:
description: >-
Overrides the
[instructions](/docs/api-reference/assistants/createAssistant) of
the assistant. This is useful for modifying the behavior on a
per-run basis.
type: string
nullable: true
share/openapi.yaml view on Meta::CPAN
should match the audio language. This field is not supported when
using `gpt-4o-transcribe-diarize`.
type: string
response_format:
$ref: '#/components/schemas/AudioResponseFormat'
temperature:
description: >
The sampling temperature, between 0 and 1. Higher values like 0.8
will make the output more random, while lower values like 0.2 will
make it more focused and deterministic. If set to 0, the model will
use [log probability](https://en.wikipedia.org/wiki/Log_probability)
to automatically increase the temperature until certain thresholds
are hit.
type: number
default: 0
include:
description: >
Additional information to include in the transcription response.
`logprobs` will return the log probabilities of the tokens in the
response to understand the model's confidence in the transcription.
`logprobs` only works with response_format set to `json` and only
with
the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and
`gpt-4o-mini-transcribe-2025-12-15`. This field is not supported
when using `gpt-4o-transcribe-diarize`.
type: array
items:
$ref: '#/components/schemas/TranscriptionInclude'
timestamp_granularities:
description: >
The timestamp granularities to populate for this transcription.
`response_format` must be set `verbose_json` to use timestamp
granularities. Either or both of these options are supported:
`word`, or `segment`. Note: There is no additional latency for
segment timestamps, but generating word timestamps incurs additional
latency.
This option is not available for `gpt-4o-transcribe-diarize`.
type: array
items:
type: string
enum:
- word
- segment
default:
- segment
stream:
anyOf:
- description: >
If set to true, the model response data will be streamed to the
client
as it is generated using [server-sent
events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
See the [Streaming section of the Speech-to-Text
guide](/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
for more information.
Note: Streaming is not supported for the `whisper-1` model and
will be ignored.
type: boolean
default: false
- type: 'null'
chunking_strategy:
anyOf:
- description: >-
Controls how the audio is cut into chunks. When set to `"auto"`,
the server first normalizes loudness and then uses voice
activity detection (VAD) to choose boundaries. `server_vad`
object can be provided to tweak VAD detection parameters
manually. If unset, the audio is transcribed as a single block.
Required when using `gpt-4o-transcribe-diarize` for inputs
longer than 30 seconds.
anyOf:
- type: string
enum:
- auto
default: auto
description: >
Automatically set chunking parameters based on the audio.
Must be set to `"auto"`.
x-stainless-const: true
- $ref: '#/components/schemas/VadConfig'
x-oaiTypeLabel: string
- type: 'null'
known_speaker_names:
description: >
Optional list of speaker names that correspond to the audio samples
provided in `known_speaker_references[]`. Each entry should be a
short identifier (for example `customer` or `agent`). Up to 4
speakers are supported.
type: array
maxItems: 4
items:
type: string
known_speaker_references:
description: >
Optional list of audio samples (as [data
URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs))
that contain known speaker references matching
`known_speaker_names[]`. Each sample must be between 2 and 10
seconds, and can use any of the same input audio formats supported
by `file`.
type: array
maxItems: 4
items:
type: string
required:
- file
- model
CreateTranscriptionResponseDiarizedJson:
type: object
description: >
Represents a diarized transcription response returned by the model,
share/openapi.yaml view on Meta::CPAN
description: |
The quality setting for the edited image.
enum:
- low
- medium
- high
- auto
background:
type: string
description: |
The background setting for the edited image.
enum:
- transparent
- opaque
- auto
output_format:
type: string
description: |
The output format for the edited image.
enum:
- png
- webp
- jpeg
usage:
$ref: '#/components/schemas/ImagesUsage'
required:
- type
- b64_json
- created_at
- size
- quality
- background
- output_format
- usage
x-oaiMeta:
name: image_edit.completed
group: images
example: |
{
"type": "image_edit.completed",
"b64_json": "...",
"created_at": 1620000000,
"size": "1024x1024",
"quality": "high",
"background": "transparent",
"output_format": "png",
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}
ImageEditPartialImageEvent:
type: object
description: >
Emitted when a partial image is available during image editing
streaming.
properties:
type:
type: string
description: |
The type of the event. Always `image_edit.partial_image`.
enum:
- image_edit.partial_image
x-stainless-const: true
b64_json:
type: string
description: >
Base64-encoded partial image data, suitable for rendering as an
image.
created_at:
type: integer
format: unixtime
description: |
The Unix timestamp when the event was created.
size:
type: string
description: |
The size of the requested edited image.
enum:
- 1024x1024
- 1024x1536
- 1536x1024
- auto
quality:
type: string
description: |
The quality setting for the requested edited image.
enum:
- low
- medium
- high
- auto
background:
type: string
description: |
The background setting for the requested edited image.
enum:
- transparent
- opaque
- auto
output_format:
type: string
description: |
The output format for the requested edited image.
enum:
- png
- webp
- jpeg
partial_image_index:
type: integer
description: |
0-based index for the partial image (streaming).
required:
- type
- b64_json
- created_at
- size
- quality
- background
- output_format
- partial_image_index
x-oaiMeta:
name: image_edit.partial_image
group: images
example: |
{
"type": "image_edit.partial_image",
"b64_json": "...",
"created_at": 1620000000,
"size": "1024x1024",
"quality": "high",
"background": "transparent",
"output_format": "png",
"partial_image_index": 0
}
ImageEditStreamEvent:
anyOf:
- $ref: '#/components/schemas/ImageEditPartialImageEvent'
- $ref: '#/components/schemas/ImageEditCompletedEvent'
discriminator:
propertyName: type
ImageGenCompletedEvent:
type: object
description: >
Emitted when image generation has completed and the final image is
available.
properties:
type:
type: string
description: |
The type of the event. Always `image_generation.completed`.
enum:
- image_generation.completed
x-stainless-const: true
b64_json:
type: string
description: |
Base64-encoded image data, suitable for rendering as an image.
created_at:
type: integer
format: unixtime
description: |
The Unix timestamp when the event was created.
size:
type: string
description: |
The size of the generated image.
enum:
- 1024x1024
- 1024x1536
- 1536x1024
- auto
share/openapi.yaml view on Meta::CPAN
description: |
The quality setting for the generated image.
enum:
- low
- medium
- high
- auto
background:
type: string
description: |
The background setting for the generated image.
enum:
- transparent
- opaque
- auto
output_format:
type: string
description: |
The output format for the generated image.
enum:
- png
- webp
- jpeg
usage:
$ref: '#/components/schemas/ImagesUsage'
required:
- type
- b64_json
- created_at
- size
- quality
- background
- output_format
- usage
x-oaiMeta:
name: image_generation.completed
group: images
example: |
{
"type": "image_generation.completed",
"b64_json": "...",
"created_at": 1620000000,
"size": "1024x1024",
"quality": "high",
"background": "transparent",
"output_format": "png",
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}
ImageGenPartialImageEvent:
type: object
description: >
Emitted when a partial image is available during image generation
streaming.
properties:
type:
type: string
description: |
The type of the event. Always `image_generation.partial_image`.
enum:
- image_generation.partial_image
x-stainless-const: true
b64_json:
type: string
description: >
Base64-encoded partial image data, suitable for rendering as an
image.
created_at:
type: integer
format: unixtime
description: |
The Unix timestamp when the event was created.
size:
type: string
description: |
The size of the requested image.
enum:
- 1024x1024
- 1024x1536
- 1536x1024
- auto
quality:
type: string
description: |
The quality setting for the requested image.
enum:
- low
- medium
- high
- auto
background:
type: string
description: |
The background setting for the requested image.
enum:
- transparent
- opaque
- auto
output_format:
type: string
description: |
The output format for the requested image.
enum:
- png
- webp
- jpeg
partial_image_index:
type: integer
description: |
0-based index for the partial image (streaming).
required:
- type
- b64_json
- created_at
- size
- quality
- background
- output_format
- partial_image_index
x-oaiMeta:
name: image_generation.partial_image
group: images
example: |
{
"type": "image_generation.partial_image",
"b64_json": "...",
"created_at": 1620000000,
"size": "1024x1024",
"quality": "high",
"background": "transparent",
"output_format": "png",
"partial_image_index": 0
}
ImageGenStreamEvent:
anyOf:
- $ref: '#/components/schemas/ImageGenPartialImageEvent'
- $ref: '#/components/schemas/ImageGenCompletedEvent'
discriminator:
propertyName: type
ImageGenTool:
type: object
title: Image generation tool
description: |
A tool that generates images using the GPT image models.
properties:
type:
type: string
enum:
- image_generation
description: |
The type of the image generation tool. Always `image_generation`.
x-stainless-const: true
model:
anyOf:
- type: string
- type: string
enum:
- gpt-image-1
- gpt-image-1-mini
- gpt-image-1.5
description: |
The image generation model to use. Default: `gpt-image-1`.
default: gpt-image-1
quality:
type: string
enum:
- low
- medium
- high
- auto
share/openapi.yaml view on Meta::CPAN
output_format:
type: string
enum:
- png
- webp
- jpeg
description: |
The output format of the generated image. One of `png`, `webp`, or
`jpeg`. Default: `png`.
default: png
output_compression:
type: integer
minimum: 0
maximum: 100
description: |
Compression level for the output image. Default: 100.
default: 100
moderation:
type: string
enum:
- auto
- low
description: |
Moderation level for the generated image. Default: `auto`.
default: auto
background:
type: string
enum:
- transparent
- opaque
- auto
description: |
Background type for the generated image. One of `transparent`,
`opaque`, or `auto`. Default: `auto`.
default: auto
input_fidelity:
anyOf:
- $ref: '#/components/schemas/InputFidelity'
- type: 'null'
input_image_mask:
type: object
description: |
Optional mask for inpainting. Contains `image_url`
(string, optional) and `file_id` (string, optional).
properties:
image_url:
type: string
description: |
Base64-encoded mask image.
file_id:
type: string
description: |
File ID for the mask image.
required: []
additionalProperties: false
partial_images:
type: integer
minimum: 0
maximum: 3
description: >
Number of partial images to generate in streaming mode, from 0
(default value) to 3.
default: 0
action:
description: >
Whether to generate a new image or edit an existing image. Default:
`auto`.
$ref: '#/components/schemas/ImageGenActionEnum'
required:
- type
ImageGenToolCall:
type: object
title: Image generation call
description: |
An image generation request made by the model.
properties:
type:
type: string
enum:
- image_generation_call
description: >
The type of the image generation call. Always
`image_generation_call`.
x-stainless-const: true
id:
type: string
description: |
The unique ID of the image generation call.
status:
type: string
enum:
- in_progress
- completed
- generating
- failed
description: |
The status of the image generation call.
result:
anyOf:
- type: string
description: |
The generated image encoded in base64.
- type: 'null'
required:
- type
- id
- status
- result
ImageRefParam:
type: object
description: |
Reference an input image by either URL or uploaded file ID.
Provide exactly one of `image_url` or `file_id`.
properties:
image_url:
type: string
format: uri
maxLength: 20971520
description: A fully qualified URL or base64-encoded data URL.
example: https://example.com/source-image.png
file_id:
share/openapi.yaml view on Meta::CPAN
type:
description: Always `file_path`.
type: string
enum:
- file_path
x-stainless-const: true
text:
description: The text in the message content that needs to be replaced.
type: string
file_path:
type: object
properties:
file_id:
description: The ID of the file that was generated.
type: string
start_index:
type: integer
minimum: 0
end_index:
type: integer
minimum: 0
required:
- index
- type
MessageDeltaContentTextObject:
title: Text
type: object
description: The text content that is part of a message.
properties:
index:
type: integer
description: The index of the content part in the message.
type:
description: Always `text`.
type: string
enum:
- text
x-stainless-const: true
text:
type: object
properties:
value:
description: The data that makes up the text.
type: string
annotations:
type: array
items:
oneOf:
- $ref: >-
#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject
- $ref: >-
#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject
required:
- index
- type
MessageDeltaObject:
type: object
title: Message delta object
description: >
Represents a message delta i.e. any changed fields on a message during
streaming.
properties:
id:
description: >-
The identifier of the message, which can be referenced in API
endpoints.
type: string
object:
description: The object type, which is always `thread.message.delta`.
type: string
enum:
- thread.message.delta
x-stainless-const: true
delta:
description: The delta containing the fields that have changed on the Message.
type: object
properties:
role:
description: >-
The entity that produced the message. One of `user` or
`assistant`.
type: string
enum:
- user
- assistant
content:
description: The content of the message in array of text and/or images.
type: array
items:
oneOf:
- $ref: '#/components/schemas/MessageDeltaContentImageFileObject'
- $ref: '#/components/schemas/MessageDeltaContentTextObject'
- $ref: '#/components/schemas/MessageDeltaContentRefusalObject'
- $ref: '#/components/schemas/MessageDeltaContentImageUrlObject'
required:
- id
- object
- delta
x-oaiMeta:
name: The message delta object
beta: true
example: |
{
"id": "msg_123",
"object": "thread.message.delta",
"delta": {
"content": [
{
"index": 0,
"type": "text",
"text": { "value": "Hello", "annotations": [] }
}
]
}
}
MessageObject:
type: object
title: The message object
description: Represents a message within a [thread](/docs/api-reference/threads).
properties:
id:
share/openapi.yaml view on Meta::CPAN
text:
type: string
description: Text content to be sent to the model
required:
- type
- text
MessageStreamEvent:
oneOf:
- type: object
properties:
event:
type: string
enum:
- thread.message.created
x-stainless-const: true
data:
$ref: '#/components/schemas/MessageObject'
required:
- event
- data
description: >-
Occurs when a [message](/docs/api-reference/messages/object) is
created.
x-oaiMeta:
dataDescription: '`data` is a [message](/docs/api-reference/messages/object)'
- type: object
properties:
event:
type: string
enum:
- thread.message.in_progress
x-stainless-const: true
data:
$ref: '#/components/schemas/MessageObject'
required:
- event
- data
description: >-
Occurs when a [message](/docs/api-reference/messages/object) moves
to an `in_progress` state.
x-oaiMeta:
dataDescription: '`data` is a [message](/docs/api-reference/messages/object)'
- type: object
properties:
event:
type: string
enum:
- thread.message.delta
x-stainless-const: true
data:
$ref: '#/components/schemas/MessageDeltaObject'
required:
- event
- data
description: >-
Occurs when parts of a
[Message](/docs/api-reference/messages/object) are being streamed.
x-oaiMeta:
dataDescription: >-
`data` is a [message
delta](/docs/api-reference/assistants-streaming/message-delta-object)
- type: object
properties:
event:
type: string
enum:
- thread.message.completed
x-stainless-const: true
data:
$ref: '#/components/schemas/MessageObject'
required:
- event
- data
description: >-
Occurs when a [message](/docs/api-reference/messages/object) is
completed.
x-oaiMeta:
dataDescription: '`data` is a [message](/docs/api-reference/messages/object)'
- type: object
properties:
event:
type: string
enum:
- thread.message.incomplete
x-stainless-const: true
data:
$ref: '#/components/schemas/MessageObject'
required:
- event
- data
description: >-
Occurs when a [message](/docs/api-reference/messages/object) ends
before it is completed.
x-oaiMeta:
dataDescription: '`data` is a [message](/docs/api-reference/messages/object)'
Metadata:
anyOf:
- type: object
description: >
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.
additionalProperties:
type: string
x-oaiTypeLabel: map
- type: 'null'
Model:
title: Model
description: Describes an OpenAI model offering that can be used with the API.
properties:
id:
share/openapi.yaml view on Meta::CPAN
enum:
- message
x-stainless-const: true
role:
type: string
description: |
The role of the output message. Always `assistant`.
enum:
- assistant
x-stainless-const: true
content:
type: array
description: |
The content of the output message.
items:
$ref: '#/components/schemas/OutputMessageContent'
phase:
anyOf:
- $ref: '#/components/schemas/MessagePhase'
- type: 'null'
status:
type: string
description: >
The status of the message input. One of `in_progress`, `completed`,
or
`incomplete`. Populated when input items are returned via API.
enum:
- in_progress
- completed
- incomplete
required:
- id
- type
- role
- content
- status
OutputMessageContent:
oneOf:
- $ref: '#/components/schemas/OutputTextContent'
- $ref: '#/components/schemas/RefusalContent'
discriminator:
propertyName: type
ParallelToolCalls:
description: >-
Whether to enable [parallel function
calling](/docs/guides/function-calling#configuring-parallel-function-calling)
during tool use.
type: boolean
default: true
PartialImages:
anyOf:
- type: integer
maximum: 3
minimum: 0
default: 0
example: 1
description: >
The number of partial images to generate. This parameter is used for
streaming responses that return partial images. Value must be
between 0 and 3.
When set to 0, the response will be a single image sent in one
streaming event.
Note that the final image may be sent before the full number of
partial images
are generated if the full image is generated more quickly.
- type: 'null'
PredictionContent:
type: object
title: Static Content
description: >
Static predicted output content, such as the content of a text file that
is
being regenerated.
required:
- type
- content
properties:
type:
type: string
enum:
- content
description: |
The type of the predicted content you want to provide. This type is
currently always `content`.
x-stainless-const: true
content:
description: >
The content that should be matched when generating a model response.
If generated tokens would match this content, the entire model
response
can be returned much more quickly.
oneOf:
- type: string
title: Text content
description: |
The content used for a Predicted Output. This is often the
text of a file you are regenerating with minor changes.
- type: array
description: >-
An array of content parts with a defined type. Supported options
differ based on the [model](/docs/models) being used to generate
the response. Can contain text inputs.
title: Array of content parts
items:
$ref: >-
#/components/schemas/ChatCompletionRequestMessageContentPartText
minItems: 1
Project:
type: object
description: Represents an individual project.
properties:
id:
type: string
description: The identifier, which can be referenced in API endpoints
object:
type: string
share/openapi.yaml view on Meta::CPAN
- conversation.item.truncate
description: The event type, must be `conversation.item.truncate`.
x-stainless-const: true
item_id:
type: string
description: >
The ID of the assistant message item to truncate. Only assistant
message
items can be truncated.
content_index:
type: integer
description: The index of the content part to truncate. Set this to 0.
audio_end_ms:
type: integer
description: >
Inclusive duration up to which audio is truncated, in milliseconds.
If
the audio_end_ms is greater than the actual audio duration, the
server
will respond with an error.
required:
- type
- item_id
- content_index
- audio_end_ms
x-oaiMeta:
name: conversation.item.truncate
group: realtime
example: |
{
"event_id": "event_678",
"type": "conversation.item.truncate",
"item_id": "msg_002",
"content_index": 0,
"audio_end_ms": 1500
}
RealtimeBetaClientEventInputAudioBufferAppend:
type: object
description: >
Send this event to append audio bytes to the input audio buffer. The
audio
buffer is temporary storage you can write to and later commit. In Server
VAD
mode, the audio buffer is used to detect speech and the server will
decide
when to commit. When Server VAD is disabled, you must commit the audio
buffer
manually.
The client may choose how much audio to place in each event up to a
maximum
of 15 MiB, for example streaming smaller chunks from the client may
allow the
VAD to be more responsive. Unlike made other client events, the server
will
not send a confirmation response to this event.
properties:
event_id:
type: string
description: Optional client-generated ID used to identify this event.
type:
type: string
enum:
- input_audio_buffer.append
description: The event type, must be `input_audio_buffer.append`.
x-stainless-const: true
audio:
type: string
description: >
Base64-encoded audio bytes. This must be in the format specified by
the
`input_audio_format` field in the session configuration.
required:
- type
- audio
x-oaiMeta:
name: input_audio_buffer.append
group: realtime
example: |
{
"event_id": "event_456",
"type": "input_audio_buffer.append",
"audio": "Base64EncodedAudioData"
}
RealtimeBetaClientEventInputAudioBufferClear:
type: object
description: |
Send this event to clear the audio bytes in the buffer. The server will
respond with an `input_audio_buffer.cleared` event.
properties:
event_id:
type: string
description: Optional client-generated ID used to identify this event.
type:
type: string
enum:
- input_audio_buffer.clear
description: The event type, must be `input_audio_buffer.clear`.
x-stainless-const: true
required:
- type
x-oaiMeta:
name: input_audio_buffer.clear
group: realtime
example: |
{
"event_id": "event_012",
"type": "input_audio_buffer.clear"
}
share/openapi.yaml view on Meta::CPAN
"response_id": "resp_001",
"item_id": "msg_008",
"output_index": 0,
"content_index": 0
}
RealtimeBetaServerEventResponseAudioTranscriptDelta:
type: object
description: >
Returned when the model-generated transcription of audio output is
updated.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_audio_transcript.delta
description: The event type, must be `response.output_audio_transcript.delta`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
delta:
type: string
description: The transcript delta.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- delta
x-oaiMeta:
name: response.output_audio_transcript.delta
group: realtime
example: |
{
"event_id": "event_4546",
"type": "response.output_audio_transcript.delta",
"response_id": "resp_001",
"item_id": "msg_008",
"output_index": 0,
"content_index": 0,
"delta": "Hello, how can I a"
}
RealtimeBetaServerEventResponseAudioTranscriptDone:
type: object
description: |
Returned when the model-generated transcription of audio output is done
streaming. Also emitted when a Response is interrupted, incomplete, or
cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_audio_transcript.done
description: The event type, must be `response.output_audio_transcript.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
transcript:
type: string
description: The final transcript of the audio.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- transcript
x-oaiMeta:
name: response.output_audio_transcript.done
group: realtime
example: |
{
"event_id": "event_4748",
"type": "response.output_audio_transcript.done",
"response_id": "resp_001",
"item_id": "msg_008",
"output_index": 0,
"content_index": 0,
"transcript": "Hello, how can I assist you today?"
}
RealtimeBetaServerEventResponseContentPartAdded:
type: object
description: >
Returned when a new content part is added to an assistant message item
during
response generation.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
share/openapi.yaml view on Meta::CPAN
description: The event type, must be `response.content_part.added`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item to which the content part was added.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
part:
type: object
description: The content part that was added.
properties:
type:
type: string
enum:
- audio
- text
description: The content type ("text", "audio").
text:
type: string
description: The text content (if type is "text").
audio:
type: string
description: Base64-encoded audio data (if type is "audio").
transcript:
type: string
description: The transcript of the audio (if type is "audio").
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- part
x-oaiMeta:
name: response.content_part.added
group: realtime
example: |
{
"event_id": "event_3738",
"type": "response.content_part.added",
"response_id": "resp_001",
"item_id": "msg_007",
"output_index": 0,
"content_index": 0,
"part": {
"type": "text",
"text": ""
}
}
RealtimeBetaServerEventResponseContentPartDone:
type: object
description: >
Returned when a content part is done streaming in an assistant message
item.
Also emitted when a Response is interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.content_part.done
description: The event type, must be `response.content_part.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
part:
type: object
description: The content part that is done.
properties:
type:
type: string
enum:
- audio
- text
description: The content type ("text", "audio").
text:
type: string
description: The text content (if type is "text").
audio:
type: string
description: Base64-encoded audio data (if type is "audio").
transcript:
type: string
description: The transcript of the audio (if type is "audio").
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- part
x-oaiMeta:
name: response.content_part.done
group: realtime
example: |
{
"event_id": "event_3940",
"type": "response.content_part.done",
"response_id": "resp_001",
share/openapi.yaml view on Meta::CPAN
}
}
RealtimeBetaServerEventResponseCreated:
type: object
description: >
Returned when a new Response is created. The first event of response
creation,
where the response is in an initial state of `in_progress`.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.created
description: The event type, must be `response.created`.
x-stainless-const: true
response:
$ref: '#/components/schemas/RealtimeBetaResponse'
required:
- event_id
- type
- response
x-oaiMeta:
name: response.created
group: realtime
example: |
{
"type": "response.created",
"event_id": "event_C9G8pqbTEddBSIxbBN6Os",
"response": {
"object": "realtime.response",
"id": "resp_C9G8p7IH2WxLbkgPNouYL",
"status": "in_progress",
"status_details": null,
"output": [],
"conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN",
"output_modalities": [
"audio"
],
"max_output_tokens": "inf",
"audio": {
"output": {
"format": {
"type": "audio/pcm",
"rate": 24000
},
"voice": "marin"
}
},
"usage": null,
"metadata": null
},
"timestamp": "2:30:35 PM"
}
RealtimeBetaServerEventResponseDone:
type: object
description: >
Returned when a Response is done streaming. Always emitted, no matter
the
final state. The Response object included in the `response.done` event
will
include all output Items in the Response but will omit the raw audio
data.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.done
description: The event type, must be `response.done`.
x-stainless-const: true
response:
$ref: '#/components/schemas/RealtimeBetaResponse'
required:
- event_id
- type
- response
x-oaiMeta:
name: response.done
group: realtime
example: |
{
"event_id": "event_3132",
"type": "response.done",
"response": {
"id": "resp_001",
"object": "realtime.response",
"status": "completed",
"status_details": null,
"output": [
{
"id": "msg_006",
"object": "realtime.item",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Sure, how can I assist you today?"
}
]
}
],
"usage": {
"total_tokens":275,
"input_tokens":127,
"output_tokens":148,
"input_token_details": {
"cached_tokens":384,
"text_tokens":119,
"audio_tokens":8,
"cached_tokens_details": {
"text_tokens": 128,
share/openapi.yaml view on Meta::CPAN
"audio_tokens":112
}
}
}
}
RealtimeBetaServerEventResponseFunctionCallArgumentsDelta:
type: object
description: |
Returned when the model-generated function call arguments are updated.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.function_call_arguments.delta
description: |
The event type, must be `response.function_call_arguments.delta`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the function call item.
output_index:
type: integer
description: The index of the output item in the response.
call_id:
type: string
description: The ID of the function call.
delta:
type: string
description: The arguments delta as a JSON string.
required:
- event_id
- type
- response_id
- item_id
- output_index
- call_id
- delta
x-oaiMeta:
name: response.function_call_arguments.delta
group: realtime
example: |
{
"event_id": "event_5354",
"type": "response.function_call_arguments.delta",
"response_id": "resp_002",
"item_id": "fc_001",
"output_index": 0,
"call_id": "call_001",
"delta": "{\"location\": \"San\""
}
RealtimeBetaServerEventResponseFunctionCallArgumentsDone:
type: object
description: >
Returned when the model-generated function call arguments are done
streaming.
Also emitted when a Response is interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.function_call_arguments.done
description: |
The event type, must be `response.function_call_arguments.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the function call item.
output_index:
type: integer
description: The index of the output item in the response.
call_id:
type: string
description: The ID of the function call.
name:
type: string
description: The name of the function that was called.
arguments:
type: string
description: The final arguments as a JSON string.
required:
- event_id
- type
- response_id
- item_id
- output_index
- call_id
- name
- arguments
x-oaiMeta:
name: response.function_call_arguments.done
group: realtime
example: |
{
"event_id": "event_5556",
"type": "response.function_call_arguments.done",
"response_id": "resp_002",
"item_id": "fc_001",
"output_index": 0,
"call_id": "call_001",
"name": "get_weather",
"arguments": "{\"location\": \"San Francisco\"}"
}
RealtimeBetaServerEventResponseMCPCallArgumentsDelta:
type: object
description: >-
Returned when MCP tool call arguments are updated during response
generation.
properties:
share/openapi.yaml view on Meta::CPAN
- output_index
- item_id
x-oaiMeta:
name: response.mcp_call.in_progress
group: realtime
example: |
{
"event_id": "event_6301",
"type": "response.mcp_call.in_progress",
"output_index": 0,
"item_id": "mcp_call_001"
}
RealtimeBetaServerEventResponseOutputItemAdded:
type: object
description: Returned when a new Item is created during Response generation.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_item.added
description: The event type, must be `response.output_item.added`.
x-stainless-const: true
response_id:
type: string
description: The ID of the Response to which the item belongs.
output_index:
type: integer
description: The index of the output item in the Response.
item:
$ref: '#/components/schemas/RealtimeConversationItem'
required:
- event_id
- type
- response_id
- output_index
- item
x-oaiMeta:
name: response.output_item.added
group: realtime
example: |
{
"event_id": "event_3334",
"type": "response.output_item.added",
"response_id": "resp_001",
"output_index": 0,
"item": {
"id": "msg_007",
"object": "realtime.item",
"type": "message",
"status": "in_progress",
"role": "assistant",
"content": []
}
}
RealtimeBetaServerEventResponseOutputItemDone:
type: object
description: >
Returned when an Item is done streaming. Also emitted when a Response
is
interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_item.done
description: The event type, must be `response.output_item.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the Response to which the item belongs.
output_index:
type: integer
description: The index of the output item in the Response.
item:
$ref: '#/components/schemas/RealtimeConversationItem'
required:
- event_id
- type
- response_id
- output_index
- item
x-oaiMeta:
name: response.output_item.done
group: realtime
example: |
{
"event_id": "event_3536",
"type": "response.output_item.done",
"response_id": "resp_001",
"output_index": 0,
"item": {
"id": "msg_007",
"object": "realtime.item",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Sure, I can help with that."
}
]
}
}
RealtimeBetaServerEventResponseTextDelta:
type: object
description: >-
Returned when the text value of an "output_text" content part is
updated.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_text.delta
description: The event type, must be `response.output_text.delta`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
delta:
type: string
description: The text delta.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- delta
x-oaiMeta:
name: response.output_text.delta
group: realtime
example: |
{
"event_id": "event_4142",
"type": "response.output_text.delta",
"response_id": "resp_001",
"item_id": "msg_007",
"output_index": 0,
"content_index": 0,
"delta": "Sure, I can h"
}
RealtimeBetaServerEventResponseTextDone:
type: object
description: >
Returned when the text value of an "output_text" content part is done
streaming. Also
emitted when a Response is interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_text.done
description: The event type, must be `response.output_text.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
text:
type: string
description: The final text content.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- text
x-oaiMeta:
name: response.output_text.done
group: realtime
example: |
{
"event_id": "event_4344",
"type": "response.output_text.done",
"response_id": "resp_001",
"item_id": "msg_007",
"output_index": 0,
"content_index": 0,
"text": "Sure, I can help with that."
}
RealtimeBetaServerEventSessionCreated:
type: object
description: >
Returned when a Session is created. Emitted automatically when a new
connection is established as the first server event. This event will
contain
the default Session configuration.
properties:
event_id:
type: string
share/openapi.yaml view on Meta::CPAN
items can be truncated.
content_index:
type: integer
description: The index of the content part to truncate. Set this to `0`.
audio_end_ms:
type: integer
description: >
Inclusive duration up to which audio is truncated, in milliseconds.
If
the audio_end_ms is greater than the actual audio duration, the
server
will respond with an error.
required:
- type
- item_id
- content_index
- audio_end_ms
x-oaiMeta:
name: conversation.item.truncate
group: realtime
example: |
{
"event_id": "event_678",
"type": "conversation.item.truncate",
"item_id": "item_002",
"content_index": 0,
"audio_end_ms": 1500
}
RealtimeClientEventInputAudioBufferAppend:
type: object
description: >
Send this event to append audio bytes to the input audio buffer. The
audio
buffer is temporary storage you can write to and later commit. A
"commit" will create a new
user message item in the conversation history from the buffer content
and clear the buffer.
Input audio transcription (if enabled) will be generated when the buffer
is committed.
If VAD is enabled the audio buffer is used to detect speech and the
server will decide
when to commit. When Server VAD is disabled, you must commit the audio
buffer
manually. Input audio noise reduction operates on writes to the audio
buffer.
The client may choose how much audio to place in each event up to a
maximum
of 15 MiB, for example streaming smaller chunks from the client may
allow the
VAD to be more responsive. Unlike most other client events, the server
will
not send a confirmation response to this event.
properties:
event_id:
type: string
maxLength: 512
description: Optional client-generated ID used to identify this event.
type:
type: string
enum:
- input_audio_buffer.append
description: The event type, must be `input_audio_buffer.append`.
x-stainless-const: true
audio:
type: string
description: >
Base64-encoded audio bytes. This must be in the format specified by
the
`input_audio_format` field in the session configuration.
required:
- type
- audio
x-oaiMeta:
name: input_audio_buffer.append
group: realtime
example: |
{
"event_id": "event_456",
"type": "input_audio_buffer.append",
"audio": "Base64EncodedAudioData"
}
RealtimeClientEventInputAudioBufferClear:
type: object
description: |
Send this event to clear the audio bytes in the buffer. The server will
respond with an `input_audio_buffer.cleared` event.
properties:
event_id:
type: string
maxLength: 512
description: Optional client-generated ID used to identify this event.
type:
type: string
enum:
- input_audio_buffer.clear
description: The event type, must be `input_audio_buffer.clear`.
x-stainless-const: true
required:
- type
x-oaiMeta:
name: input_audio_buffer.clear
group: realtime
example: |
{
"event_id": "event_012",
share/openapi.yaml view on Meta::CPAN
type: string
description: The ID of the MCP list tools item.
required:
- event_id
- type
- item_id
x-oaiMeta:
name: mcp_list_tools.in_progress
group: realtime
example: |
{
"event_id": "event_6101",
"type": "mcp_list_tools.in_progress",
"item_id": "mcp_list_tools_001"
}
RealtimeServerEventOutputAudioBufferCleared:
type: object
description: >
**WebRTC/SIP Only:** Emitted when the output audio buffer is cleared.
This happens either in VAD
mode when the user has interrupted
(`input_audio_buffer.speech_started`),
or when the client has emitted the `output_audio_buffer.clear` event to
manually
cut off the current audio response.
[Learn
more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- output_audio_buffer.cleared
description: The event type, must be `output_audio_buffer.cleared`.
x-stainless-const: true
response_id:
type: string
description: The unique ID of the response that produced the audio.
required:
- event_id
- type
- response_id
x-oaiMeta:
name: output_audio_buffer.cleared
group: realtime
example: |
{
"event_id": "event_abc123",
"type": "output_audio_buffer.cleared",
"response_id": "resp_abc123"
}
RealtimeServerEventOutputAudioBufferStarted:
type: object
description: >
**WebRTC/SIP Only:** Emitted when the server begins streaming audio to
the client. This event is
emitted after an audio content part has been added
(`response.content_part.added`)
to the response.
[Learn
more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- output_audio_buffer.started
description: The event type, must be `output_audio_buffer.started`.
x-stainless-const: true
response_id:
type: string
description: The unique ID of the response that produced the audio.
required:
- event_id
- type
- response_id
x-oaiMeta:
name: output_audio_buffer.started
group: realtime
example: |
{
"event_id": "event_abc123",
"type": "output_audio_buffer.started",
"response_id": "resp_abc123"
}
RealtimeServerEventOutputAudioBufferStopped:
type: object
description: >
**WebRTC/SIP Only:** Emitted when the output audio buffer has been
completely drained on the server,
and no more audio is forthcoming. This event is emitted after the full
response
data has been sent to the client (`response.done`).
[Learn
more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- output_audio_buffer.stopped
description: The event type, must be `output_audio_buffer.stopped`.
x-stainless-const: true
response_id:
type: string
share/openapi.yaml view on Meta::CPAN
"response_id": "resp_001",
"item_id": "msg_008",
"output_index": 0,
"content_index": 0
}
RealtimeServerEventResponseAudioTranscriptDelta:
type: object
description: >
Returned when the model-generated transcription of audio output is
updated.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_audio_transcript.delta
description: The event type, must be `response.output_audio_transcript.delta`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
delta:
type: string
description: The transcript delta.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- delta
x-oaiMeta:
name: response.output_audio_transcript.delta
group: realtime
example: |
{
"event_id": "event_4546",
"type": "response.output_audio_transcript.delta",
"response_id": "resp_001",
"item_id": "msg_008",
"output_index": 0,
"content_index": 0,
"delta": "Hello, how can I a"
}
RealtimeServerEventResponseAudioTranscriptDone:
type: object
description: |
Returned when the model-generated transcription of audio output is done
streaming. Also emitted when a Response is interrupted, incomplete, or
cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_audio_transcript.done
description: The event type, must be `response.output_audio_transcript.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
transcript:
type: string
description: The final transcript of the audio.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- transcript
x-oaiMeta:
name: response.output_audio_transcript.done
group: realtime
example: |
{
"event_id": "event_4748",
"type": "response.output_audio_transcript.done",
"response_id": "resp_001",
"item_id": "msg_008",
"output_index": 0,
"content_index": 0,
"transcript": "Hello, how can I assist you today?"
}
RealtimeServerEventResponseContentPartAdded:
type: object
description: >
Returned when a new content part is added to an assistant message item
during
response generation.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
share/openapi.yaml view on Meta::CPAN
description: The event type, must be `response.content_part.added`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item to which the content part was added.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
part:
type: object
description: The content part that was added.
properties:
type:
type: string
enum:
- audio
- text
description: The content type ("text", "audio").
text:
type: string
description: The text content (if type is "text").
audio:
type: string
description: Base64-encoded audio data (if type is "audio").
transcript:
type: string
description: The transcript of the audio (if type is "audio").
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- part
x-oaiMeta:
name: response.content_part.added
group: realtime
example: |
{
"event_id": "event_3738",
"type": "response.content_part.added",
"response_id": "resp_001",
"item_id": "msg_007",
"output_index": 0,
"content_index": 0,
"part": {
"type": "text",
"text": ""
}
}
RealtimeServerEventResponseContentPartDone:
type: object
description: >
Returned when a content part is done streaming in an assistant message
item.
Also emitted when a Response is interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.content_part.done
description: The event type, must be `response.content_part.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
part:
type: object
description: The content part that is done.
properties:
type:
type: string
enum:
- audio
- text
description: The content type ("text", "audio").
text:
type: string
description: The text content (if type is "text").
audio:
type: string
description: Base64-encoded audio data (if type is "audio").
transcript:
type: string
description: The transcript of the audio (if type is "audio").
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- part
x-oaiMeta:
name: response.content_part.done
group: realtime
example: |
{
"event_id": "event_3940",
"type": "response.content_part.done",
"response_id": "resp_001",
share/openapi.yaml view on Meta::CPAN
"text": "Sure, I can help with that."
}
}
RealtimeServerEventResponseCreated:
type: object
description: >
Returned when a new Response is created. The first event of response
creation,
where the response is in an initial state of `in_progress`.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.created
description: The event type, must be `response.created`.
x-stainless-const: true
response:
$ref: '#/components/schemas/RealtimeResponse'
required:
- event_id
- type
- response
x-oaiMeta:
name: response.created
group: realtime
example: |
{
"type": "response.created",
"event_id": "event_C9G8pqbTEddBSIxbBN6Os",
"response": {
"object": "realtime.response",
"id": "resp_C9G8p7IH2WxLbkgPNouYL",
"status": "in_progress",
"status_details": null,
"output": [],
"conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN",
"output_modalities": [
"audio"
],
"max_output_tokens": "inf",
"audio": {
"output": {
"format": {
"type": "audio/pcm",
"rate": 24000
},
"voice": "marin"
}
},
"usage": null,
"metadata": null
},
}
RealtimeServerEventResponseDone:
type: object
description: >
Returned when a Response is done streaming. Always emitted, no matter
the
final state. The Response object included in the `response.done` event
will
include all output Items in the Response but will omit the raw audio
data.
Clients should check the `status` field of the Response to determine if
it was successful
(`completed`) or if there was another outcome: `cancelled`, `failed`, or
`incomplete`.
A response will contain all output items that were generated during the
response, excluding
any audio content.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.done
description: The event type, must be `response.done`.
x-stainless-const: true
response:
$ref: '#/components/schemas/RealtimeResponse'
required:
- event_id
- type
- response
x-oaiMeta:
name: response.done
group: realtime
example: |
{
"type": "response.done",
"event_id": "event_CCXHxcMy86rrKhBLDdqCh",
"response": {
"object": "realtime.response",
"id": "resp_CCXHw0UJld10EzIUXQCNh",
"status": "completed",
"status_details": null,
"output": [
{
"id": "item_CCXHwGjjDUfOXbiySlK7i",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_audio",
"transcript": "Loud and clear! I can hear you perfectly. How can I help you today?"
}
]
share/openapi.yaml view on Meta::CPAN
}
},
"metadata": null
}
}
RealtimeServerEventResponseFunctionCallArgumentsDelta:
type: object
description: |
Returned when the model-generated function call arguments are updated.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.function_call_arguments.delta
description: |
The event type, must be `response.function_call_arguments.delta`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the function call item.
output_index:
type: integer
description: The index of the output item in the response.
call_id:
type: string
description: The ID of the function call.
delta:
type: string
description: The arguments delta as a JSON string.
required:
- event_id
- type
- response_id
- item_id
- output_index
- call_id
- delta
x-oaiMeta:
name: response.function_call_arguments.delta
group: realtime
example: |
{
"event_id": "event_5354",
"type": "response.function_call_arguments.delta",
"response_id": "resp_002",
"item_id": "fc_001",
"output_index": 0,
"call_id": "call_001",
"delta": "{\"location\": \"San\""
}
RealtimeServerEventResponseFunctionCallArgumentsDone:
type: object
description: >
Returned when the model-generated function call arguments are done
streaming.
Also emitted when a Response is interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.function_call_arguments.done
description: |
The event type, must be `response.function_call_arguments.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the function call item.
output_index:
type: integer
description: The index of the output item in the response.
call_id:
type: string
description: The ID of the function call.
name:
type: string
description: The name of the function that was called.
arguments:
type: string
description: The final arguments as a JSON string.
required:
- event_id
- type
- response_id
- item_id
- output_index
- call_id
- name
- arguments
x-oaiMeta:
name: response.function_call_arguments.done
group: realtime
example: |
{
"event_id": "event_5556",
"type": "response.function_call_arguments.done",
"response_id": "resp_002",
"item_id": "fc_001",
"output_index": 0,
"call_id": "call_001",
"name": "get_weather",
"arguments": "{\"location\": \"San Francisco\"}"
}
RealtimeServerEventResponseMCPCallArgumentsDelta:
type: object
description: >-
Returned when MCP tool call arguments are updated during response
generation.
properties:
share/openapi.yaml view on Meta::CPAN
- output_index
- item_id
x-oaiMeta:
name: response.mcp_call.in_progress
group: realtime
example: |
{
"event_id": "event_6301",
"type": "response.mcp_call.in_progress",
"output_index": 0,
"item_id": "mcp_call_001"
}
RealtimeServerEventResponseOutputItemAdded:
type: object
description: Returned when a new Item is created during Response generation.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_item.added
description: The event type, must be `response.output_item.added`.
x-stainless-const: true
response_id:
type: string
description: The ID of the Response to which the item belongs.
output_index:
type: integer
description: The index of the output item in the Response.
item:
$ref: '#/components/schemas/RealtimeConversationItem'
required:
- event_id
- type
- response_id
- output_index
- item
x-oaiMeta:
name: response.output_item.added
group: realtime
example: |
{
"event_id": "event_3334",
"type": "response.output_item.added",
"response_id": "resp_001",
"output_index": 0,
"item": {
"id": "msg_007",
"object": "realtime.item",
"type": "message",
"status": "in_progress",
"role": "assistant",
"content": []
}
}
RealtimeServerEventResponseOutputItemDone:
type: object
description: >
Returned when an Item is done streaming. Also emitted when a Response
is
interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_item.done
description: The event type, must be `response.output_item.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the Response to which the item belongs.
output_index:
type: integer
description: The index of the output item in the Response.
item:
$ref: '#/components/schemas/RealtimeConversationItem'
required:
- event_id
- type
- response_id
- output_index
- item
x-oaiMeta:
name: response.output_item.done
group: realtime
example: |
{
"event_id": "event_3536",
"type": "response.output_item.done",
"response_id": "resp_001",
"output_index": 0,
"item": {
"id": "msg_007",
"object": "realtime.item",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Sure, I can help with that."
}
]
}
}
RealtimeServerEventResponseTextDelta:
type: object
description: >-
Returned when the text value of an "output_text" content part is
updated.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_text.delta
description: The event type, must be `response.output_text.delta`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
delta:
type: string
description: The text delta.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- delta
x-oaiMeta:
name: response.output_text.delta
group: realtime
example: |
{
"event_id": "event_4142",
"type": "response.output_text.delta",
"response_id": "resp_001",
"item_id": "msg_007",
"output_index": 0,
"content_index": 0,
"delta": "Sure, I can h"
}
RealtimeServerEventResponseTextDone:
type: object
description: >
Returned when the text value of an "output_text" content part is done
streaming. Also
emitted when a Response is interrupted, incomplete, or cancelled.
properties:
event_id:
type: string
description: The unique ID of the server event.
type:
type: string
enum:
- response.output_text.done
description: The event type, must be `response.output_text.done`.
x-stainless-const: true
response_id:
type: string
description: The ID of the response.
item_id:
type: string
description: The ID of the item.
output_index:
type: integer
description: The index of the output item in the response.
content_index:
type: integer
description: The index of the content part in the item's content array.
text:
type: string
description: The final text content.
required:
- event_id
- type
- response_id
- item_id
- output_index
- content_index
- text
x-oaiMeta:
name: response.output_text.done
group: realtime
example: |
{
"event_id": "event_4344",
"type": "response.output_text.done",
"response_id": "resp_001",
"item_id": "msg_007",
"output_index": 0,
"content_index": 0,
"text": "Sure, I can help with that."
}
RealtimeServerEventSessionCreated:
type: object
description: >
Returned when a Session is created. Emitted automatically when a new
connection is established as the first server event. This event will
contain
the default Session configuration.
properties:
event_id:
type: string
share/openapi.yaml view on Meta::CPAN
group: responses
example: |
{
"type": "response.audio.transcript.delta",
"response_id": "resp_123",
"delta": " ... partial transcript ... ",
"sequence_number": 1
}
ResponseAudioTranscriptDoneEvent:
type: object
description: Emitted when the full audio transcript is completed.
properties:
type:
type: string
description: |
The type of the event. Always `response.audio.transcript.done`.
enum:
- response.audio.transcript.done
x-stainless-const: true
sequence_number:
type: integer
description: The sequence number of this event.
required:
- type
- response_id
- sequence_number
x-oaiMeta:
name: response.audio.transcript.done
group: responses
example: |
{
"type": "response.audio.transcript.done",
"response_id": "resp_123",
"sequence_number": 1
}
ResponseCodeInterpreterCallCodeDeltaEvent:
type: object
description: Emitted when a partial code snippet is streamed by the code interpreter.
properties:
type:
type: string
description: >-
The type of the event. Always
`response.code_interpreter_call_code.delta`.
enum:
- response.code_interpreter_call_code.delta
x-stainless-const: true
output_index:
type: integer
description: >-
The index of the output item in the response for which the code is
being streamed.
item_id:
type: string
description: The unique identifier of the code interpreter tool call item.
delta:
type: string
description: The partial code snippet being streamed by the code interpreter.
sequence_number:
type: integer
description: The sequence number of this event, used to order streaming events.
required:
- type
- output_index
- item_id
- delta
- sequence_number
x-oaiMeta:
name: response.code_interpreter_call_code.delta
group: responses
example: |
{
"type": "response.code_interpreter_call_code.delta",
"output_index": 0,
"item_id": "ci_12345",
"delta": "print('Hello, world')",
"sequence_number": 1
}
ResponseCodeInterpreterCallCodeDoneEvent:
type: object
description: Emitted when the code snippet is finalized by the code interpreter.
properties:
type:
type: string
description: >-
The type of the event. Always
`response.code_interpreter_call_code.done`.
enum:
- response.code_interpreter_call_code.done
x-stainless-const: true
output_index:
type: integer
description: >-
The index of the output item in the response for which the code is
finalized.
item_id:
type: string
description: The unique identifier of the code interpreter tool call item.
code:
type: string
description: The final code snippet output by the code interpreter.
sequence_number:
type: integer
description: The sequence number of this event, used to order streaming events.
required:
- type
- output_index
- item_id
- code
- sequence_number
x-oaiMeta:
name: response.code_interpreter_call_code.done
group: responses
example: |
{
"type": "response.code_interpreter_call_code.done",
"output_index": 3,
"item_id": "ci_12345",
"code": "print('done')",
"sequence_number": 1
}
ResponseCodeInterpreterCallCompletedEvent:
type: object
description: Emitted when the code interpreter call is completed.
properties:
type:
type: string
description: >-
The type of the event. Always
`response.code_interpreter_call.completed`.
enum:
- response.code_interpreter_call.completed
x-stainless-const: true
output_index:
type: integer
description: >-
The index of the output item in the response for which the code
interpreter call is completed.
item_id:
type: string
description: The unique identifier of the code interpreter tool call item.
sequence_number:
type: integer
description: The sequence number of this event, used to order streaming events.
required:
- type
- output_index
- item_id
- sequence_number
x-oaiMeta:
name: response.code_interpreter_call.completed
group: responses
example: |
{
"type": "response.code_interpreter_call.completed",
"output_index": 5,
"item_id": "ci_12345",
"sequence_number": 1
}
ResponseCodeInterpreterCallInProgressEvent:
type: object
description: Emitted when a code interpreter call is in progress.
properties:
type:
type: string
description: >-
The type of the event. Always
`response.code_interpreter_call.in_progress`.
enum:
- response.code_interpreter_call.in_progress
x-stainless-const: true
output_index:
type: integer
description: >-
The index of the output item in the response for which the code
interpreter call is in progress.
item_id:
type: string
description: The unique identifier of the code interpreter tool call item.
sequence_number:
type: integer
description: The sequence number of this event, used to order streaming events.
required:
- type
- output_index
- item_id
- sequence_number
x-oaiMeta:
name: response.code_interpreter_call.in_progress
group: responses
example: |
{
"type": "response.code_interpreter_call.in_progress",
"output_index": 0,
"item_id": "ci_12345",
"sequence_number": 1
}
ResponseCodeInterpreterCallInterpretingEvent:
type: object
description: >-
Emitted when the code interpreter is actively interpreting the code
snippet.
properties:
type:
type: string
description: >-
The type of the event. Always
`response.code_interpreter_call.interpreting`.
enum:
- response.code_interpreter_call.interpreting
x-stainless-const: true
output_index:
type: integer
description: >-
The index of the output item in the response for which the code
interpreter is interpreting code.
item_id:
type: string
description: The unique identifier of the code interpreter tool call item.
sequence_number:
type: integer
description: The sequence number of this event, used to order streaming events.
required:
- type
- output_index
- item_id
- sequence_number
x-oaiMeta:
name: response.code_interpreter_call.interpreting
group: responses
example: |
{
"type": "response.code_interpreter_call.interpreting",
"output_index": 4,
"item_id": "ci_12345",
"sequence_number": 1
}
ResponseCompletedEvent:
type: object
description: Emitted when the model response is complete.
properties:
type:
type: string
description: |
The type of the event. Always `response.completed`.
enum:
- response.completed
x-stainless-const: true
response:
$ref: '#/components/schemas/Response'
description: |
Properties of the completed response.
sequence_number:
type: integer
description: The sequence number for this event.
required:
- type
- response
- sequence_number
x-oaiMeta:
name: response.completed
group: responses
example: |
{
"type": "response.completed",
"response": {
"id": "resp_123",
"object": "response",
"created_at": 1740855869,
"status": "completed",
"completed_at": 1740855870,
"error": null,
"incomplete_details": null,
"input": [],
"instructions": null,
"max_output_tokens": null,
"model": "gpt-4o-mini-2024-07-18",
"output": [
{
"id": "msg_123",
"type": "message",
"role": "assistant",
share/openapi.yaml view on Meta::CPAN
type: integer
description: The sequence number of the image generation item being processed.
required:
- type
- output_index
- item_id
- sequence_number
x-oaiMeta:
name: response.image_generation_call.generating
group: responses
example: |
{
"type": "response.image_generation_call.generating",
"output_index": 0,
"item_id": "item-123",
"sequence_number": 0
}
ResponseImageGenCallInProgressEvent:
type: object
title: ResponseImageGenCallInProgressEvent
description: |
Emitted when an image generation tool call is in progress.
properties:
type:
type: string
enum:
- response.image_generation_call.in_progress
description: >-
The type of the event. Always
'response.image_generation_call.in_progress'.
x-stainless-const: true
output_index:
type: integer
description: The index of the output item in the response's output array.
item_id:
type: string
description: The unique identifier of the image generation item being processed.
sequence_number:
type: integer
description: The sequence number of the image generation item being processed.
required:
- type
- output_index
- item_id
- sequence_number
x-oaiMeta:
name: response.image_generation_call.in_progress
group: responses
example: |
{
"type": "response.image_generation_call.in_progress",
"output_index": 0,
"item_id": "item-123",
"sequence_number": 0
}
ResponseImageGenCallPartialImageEvent:
type: object
title: ResponseImageGenCallPartialImageEvent
description: >
Emitted when a partial image is available during image generation
streaming.
properties:
type:
type: string
enum:
- response.image_generation_call.partial_image
description: >-
The type of the event. Always
'response.image_generation_call.partial_image'.
x-stainless-const: true
output_index:
type: integer
description: The index of the output item in the response's output array.
item_id:
type: string
description: The unique identifier of the image generation item being processed.
sequence_number:
type: integer
description: The sequence number of the image generation item being processed.
partial_image_index:
type: integer
description: >-
0-based index for the partial image (backend is 1-based, but this is
0-based for the user).
partial_image_b64:
type: string
description: >-
Base64-encoded partial image data, suitable for rendering as an
image.
required:
- type
- output_index
- item_id
- sequence_number
- partial_image_index
- partial_image_b64
x-oaiMeta:
name: response.image_generation_call.partial_image
group: responses
example: |
{
"type": "response.image_generation_call.partial_image",
"output_index": 0,
"item_id": "item-123",
"sequence_number": 0,
"partial_image_index": 0,
"partial_image_b64": "..."
}
ResponseInProgressEvent:
type: object
description: Emitted when the response is in progress.
properties:
type:
type: string
description: |
The type of the event. Always `response.in_progress`.
enum:
- response.in_progress
x-stainless-const: true
response:
$ref: '#/components/schemas/Response'
share/openapi.yaml view on Meta::CPAN
ResponseStreamEvent:
anyOf:
- $ref: '#/components/schemas/ResponseAudioDeltaEvent'
- $ref: '#/components/schemas/ResponseAudioDoneEvent'
- $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent'
- $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent'
- $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent'
- $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent'
- $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent'
- $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent'
- $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent'
- $ref: '#/components/schemas/ResponseCompletedEvent'
- $ref: '#/components/schemas/ResponseContentPartAddedEvent'
- $ref: '#/components/schemas/ResponseContentPartDoneEvent'
- $ref: '#/components/schemas/ResponseCreatedEvent'
- $ref: '#/components/schemas/ResponseErrorEvent'
- $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent'
- $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent'
- $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent'
- $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent'
- $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent'
- $ref: '#/components/schemas/ResponseInProgressEvent'
- $ref: '#/components/schemas/ResponseFailedEvent'
- $ref: '#/components/schemas/ResponseIncompleteEvent'
- $ref: '#/components/schemas/ResponseOutputItemAddedEvent'
- $ref: '#/components/schemas/ResponseOutputItemDoneEvent'
- $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent'
- $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent'
- $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent'
- $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent'
- $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent'
- $ref: '#/components/schemas/ResponseReasoningTextDoneEvent'
- $ref: '#/components/schemas/ResponseRefusalDeltaEvent'
- $ref: '#/components/schemas/ResponseRefusalDoneEvent'
- $ref: '#/components/schemas/ResponseTextDeltaEvent'
- $ref: '#/components/schemas/ResponseTextDoneEvent'
- $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent'
- $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent'
- $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent'
- $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent'
- $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent'
- $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent'
- $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent'
- $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent'
- $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent'
- $ref: '#/components/schemas/ResponseMCPCallCompletedEvent'
- $ref: '#/components/schemas/ResponseMCPCallFailedEvent'
- $ref: '#/components/schemas/ResponseMCPCallInProgressEvent'
- $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent'
- $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent'
- $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent'
- $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent'
- $ref: '#/components/schemas/ResponseQueuedEvent'
- $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent'
- $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent'
discriminator:
propertyName: type
ResponseStreamOptions:
anyOf:
- description: >
Options for streaming responses. Only set this when you set `stream:
true`.
type: object
default: null
properties:
include_obfuscation:
type: boolean
description: >
When true, stream obfuscation will be enabled. Stream
obfuscation adds
random characters to an `obfuscation` field on streaming delta
events to
normalize payload sizes as a mitigation to certain side-channel
attacks.
These obfuscation fields are included by default, but add a
small amount
of overhead to the data stream. You can set
`include_obfuscation` to
false to optimize for bandwidth if you trust the network links
between
your application and the OpenAI API.
- type: 'null'
ResponseTextDeltaEvent:
type: object
description: Emitted when there is an additional text delta.
properties:
type:
type: string
description: |
The type of the event. Always `response.output_text.delta`.
enum:
- response.output_text.delta
x-stainless-const: true
item_id:
type: string
description: |
The ID of the output item that the text delta was added to.
output_index:
type: integer
description: |
The index of the output item that the text delta was added to.
content_index:
type: integer
description: |
The index of the content part that the text delta was added to.
delta:
type: string
description: |
The text delta that was added.
sequence_number:
type: integer
description: The sequence number for this event.
logprobs:
type: array
description: |
The log probabilities of the tokens in the delta.
items:
$ref: '#/components/schemas/ResponseLogProb'
required:
- type
- item_id
- output_index
- content_index
- delta
- sequence_number
- logprobs
share/openapi.yaml view on Meta::CPAN
"created_at": 1698107661,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "completed",
"started_at": 1699073476,
"expires_at": null,
"cancelled_at": null,
"failed_at": null,
"completed_at": 1699073498,
"last_error": null,
"model": "gpt-4o",
"instructions": null,
"tools": [{"type": "file_search"}, {"type": "code_interpreter"}],
"metadata": {},
"incomplete_details": null,
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"total_tokens": 579
},
"temperature": 1.0,
"top_p": 1.0,
"max_prompt_tokens": 1000,
"max_completion_tokens": 1000,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"response_format": "auto",
"tool_choice": "auto",
"parallel_tool_calls": true
}
RunStepCompletionUsage:
anyOf:
- type: object
description: >-
Usage statistics related to the run step. This value will be `null`
while the run step's status is `in_progress`.
properties:
completion_tokens:
type: integer
description: >-
Number of completion tokens used over the course of the run
step.
prompt_tokens:
type: integer
description: Number of prompt tokens used over the course of the run step.
total_tokens:
type: integer
description: Total number of tokens used (prompt + completion).
required:
- prompt_tokens
- completion_tokens
- total_tokens
- type: 'null'
RunStepDeltaObject:
type: object
title: Run step delta object
description: >
Represents a run step delta i.e. any changed fields on a run step during
streaming.
properties:
id:
description: >-
The identifier of the run step, which can be referenced in API
endpoints.
type: string
object:
description: The object type, which is always `thread.run.step.delta`.
type: string
enum:
- thread.run.step.delta
x-stainless-const: true
delta:
description: The delta containing the fields that have changed on the run step.
type: object
properties:
step_details:
type: object
description: The details of the run step.
oneOf:
- $ref: >-
#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject
- $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsObject'
required:
- id
- object
- delta
x-oaiMeta:
name: The run step delta object
beta: true
example: |
{
"id": "step_123",
"object": "thread.run.step.delta",
"delta": {
"step_details": {
"type": "tool_calls",
"tool_calls": [
{
"index": 0,
"id": "call_123",
"type": "code_interpreter",
"code_interpreter": { "input": "", "outputs": [] }
}
]
}
}
}
RunStepDeltaStepDetailsMessageCreationObject:
title: Message creation
type: object
description: Details of the message creation by the run step.
properties:
type:
description: Always `message_creation`.
type: string
enum:
- message_creation
x-stainless-const: true
message_creation:
share/openapi.yaml view on Meta::CPAN
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"total_tokens": 579
}
}
RunStepStreamEvent:
oneOf:
- type: object
properties:
event:
type: string
enum:
- thread.run.step.created
x-stainless-const: true
data:
$ref: '#/components/schemas/RunStepObject'
required:
- event
- data
description: >-
Occurs when a [run step](/docs/api-reference/run-steps/step-object)
is created.
x-oaiMeta:
dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)'
- type: object
properties:
event:
type: string
enum:
- thread.run.step.in_progress
x-stainless-const: true
data:
$ref: '#/components/schemas/RunStepObject'
required:
- event
- data
description: >-
Occurs when a [run step](/docs/api-reference/run-steps/step-object)
moves to an `in_progress` state.
x-oaiMeta:
dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)'
- type: object
properties:
event:
type: string
enum:
- thread.run.step.delta
x-stainless-const: true
data:
$ref: '#/components/schemas/RunStepDeltaObject'
required:
- event
- data
description: >-
Occurs when parts of a [run
step](/docs/api-reference/run-steps/step-object) are being streamed.
x-oaiMeta:
dataDescription: >-
`data` is a [run step
delta](/docs/api-reference/assistants-streaming/run-step-delta-object)
- type: object
properties:
event:
type: string
enum:
- thread.run.step.completed
x-stainless-const: true
data:
$ref: '#/components/schemas/RunStepObject'
required:
- event
- data
description: >-
Occurs when a [run step](/docs/api-reference/run-steps/step-object)
is completed.
x-oaiMeta:
dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)'
- type: object
properties:
event:
type: string
enum:
- thread.run.step.failed
x-stainless-const: true
data:
$ref: '#/components/schemas/RunStepObject'
required:
- event
- data
description: >-
Occurs when a [run step](/docs/api-reference/run-steps/step-object)
fails.
x-oaiMeta:
dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)'
- type: object
properties:
event:
type: string
enum:
- thread.run.step.cancelled
x-stainless-const: true
data:
$ref: '#/components/schemas/RunStepObject'
required:
- event
- data
description: >-
Occurs when a [run step](/docs/api-reference/run-steps/step-object)
is cancelled.
x-oaiMeta:
dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)'
- type: object
properties:
event:
type: string
enum:
- thread.run.step.expired
x-stainless-const: true
data:
$ref: '#/components/schemas/RunStepObject'
share/openapi.yaml view on Meta::CPAN
has_more:
type: boolean
description: Whether there are more items available.
type: object
required:
- object
- data
- first_id
- last_id
- has_more
title: Threads
description: A paginated list of ChatKit threads.
DragPoint:
properties:
x:
type: integer
description: The x-coordinate.
'y':
type: integer
description: The y-coordinate.
type: object
required:
- x
- 'y'
title: Coordinate
description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.'
securitySchemes:
ApiKeyAuth:
type: http
scheme: bearer
AdminApiKeyAuth:
type: http
scheme: bearer
x-oaiMeta:
navigationGroups:
- id: responses
title: Responses API
- id: webhooks
title: Webhooks
- id: endpoints
title: Platform APIs
- id: vector_stores
title: Vector stores
- id: chatkit
title: ChatKit
beta: true
- id: containers
title: Containers
- id: realtime
title: Realtime
- id: chat
title: Chat Completions
- id: assistants
title: Assistants
deprecated: true
- id: administration
title: Administration
- id: legacy
title: Legacy
groups:
- id: responses-streaming
title: Streaming events
description: >
When you [create a Response](/docs/api-reference/responses/create) with
`stream` set to `true`, the server will emit server-sent events to the
client as the Response is generated. This section contains the events
that
are emitted by the server.
[Learn more about streaming
responses](/docs/guides/streaming-responses?api-mode=responses).
navigationGroup: responses
sections:
- type: object
key: ResponseCreatedEvent
path: <auto>
- type: object
key: ResponseInProgressEvent
path: <auto>
- type: object
key: ResponseCompletedEvent
path: <auto>
- type: object
key: ResponseFailedEvent
path: <auto>
- type: object
key: ResponseIncompleteEvent
path: <auto>
- type: object
key: ResponseOutputItemAddedEvent
path: <auto>
- type: object
key: ResponseOutputItemDoneEvent
path: <auto>
- type: object
key: ResponseContentPartAddedEvent
path: <auto>
- type: object
key: ResponseContentPartDoneEvent
path: <auto>
- type: object
key: ResponseTextDeltaEvent
path: response/output_text/delta
- type: object
key: ResponseTextDoneEvent
path: response/output_text/done
- type: object
key: ResponseRefusalDeltaEvent
path: <auto>
- type: object
key: ResponseRefusalDoneEvent
path: <auto>
- type: object
key: ResponseFunctionCallArgumentsDeltaEvent
path: <auto>
- type: object
key: ResponseFunctionCallArgumentsDoneEvent
path: <auto>
- type: object
key: ResponseFileSearchCallInProgressEvent
path: <auto>
- type: object
key: ResponseFileSearchCallSearchingEvent
path: <auto>
- type: object
key: ResponseFileSearchCallCompletedEvent
path: <auto>
- type: object
key: ResponseWebSearchCallInProgressEvent
path: <auto>
- type: object
share/openapi.yaml view on Meta::CPAN
- type: object
key: ResponseErrorEvent
path: <auto>
- id: webhook-events
title: Webhook Events
description: >
Webhooks are HTTP requests sent by OpenAI to a URL you specify when
certain
events happen during the course of API usage.
[Learn more about webhooks](/docs/guides/webhooks).
navigationGroup: webhooks
sections:
- type: object
key: WebhookResponseCompleted
path: <auto>
- type: object
key: WebhookResponseCancelled
path: <auto>
- type: object
key: WebhookResponseFailed
path: <auto>
- type: object
key: WebhookResponseIncomplete
path: <auto>
- type: object
key: WebhookBatchCompleted
path: <auto>
- type: object
key: WebhookBatchCancelled
path: <auto>
- type: object
key: WebhookBatchExpired
path: <auto>
- type: object
key: WebhookBatchFailed
path: <auto>
- type: object
key: WebhookFineTuningJobSucceeded
path: <auto>
- type: object
key: WebhookFineTuningJobFailed
path: <auto>
- type: object
key: WebhookFineTuningJobCancelled
path: <auto>
- type: object
key: WebhookEvalRunSucceeded
path: <auto>
- type: object
key: WebhookEvalRunFailed
path: <auto>
- type: object
key: WebhookEvalRunCanceled
path: <auto>
- type: object
key: WebhookRealtimeCallIncoming
path: <auto>
- id: images-streaming
title: Image Streaming
description: >
Stream image generation and editing in real time with server-sent
events.
[Learn more about image streaming](/docs/guides/image-generation).
navigationGroup: endpoints
sections:
- type: object
key: ImageGenPartialImageEvent
path: <auto>
- type: object
key: ImageGenCompletedEvent
path: <auto>
- type: object
key: ImageEditPartialImageEvent
path: <auto>
- type: object
key: ImageEditCompletedEvent
path: <auto>
- id: realtime-client-events
title: Client events
description: >
These are events that the OpenAI Realtime WebSocket server will accept
from the client.
navigationGroup: realtime
sections:
- type: object
key: RealtimeClientEventSessionUpdate
path: <auto>
- type: object
key: RealtimeClientEventInputAudioBufferAppend
path: <auto>
- type: object
key: RealtimeClientEventInputAudioBufferCommit
path: <auto>
- type: object
key: RealtimeClientEventInputAudioBufferClear
path: <auto>
- type: object
key: RealtimeClientEventConversationItemCreate
path: <auto>
- type: object
key: RealtimeClientEventConversationItemRetrieve
path: <auto>
- type: object
key: RealtimeClientEventConversationItemTruncate
path: <auto>
- type: object
key: RealtimeClientEventConversationItemDelete
path: <auto>
- type: object
key: RealtimeClientEventResponseCreate
path: <auto>
- type: object
key: RealtimeClientEventResponseCancel
path: <auto>
- type: object
key: RealtimeClientEventOutputAudioBufferClear
path: <auto>
- id: realtime-server-events
title: Server events
description: >
These are events emitted from the OpenAI Realtime WebSocket server to
the client.
navigationGroup: realtime
share/openapi.yaml view on Meta::CPAN
path: <auto>
- type: object
key: RealtimeServerEventResponseMCPCallFailed
path: <auto>
- type: object
key: RealtimeServerEventMCPListToolsInProgress
path: <auto>
- type: object
key: RealtimeServerEventMCPListToolsCompleted
path: <auto>
- type: object
key: RealtimeServerEventMCPListToolsFailed
path: <auto>
- type: object
key: RealtimeServerEventRateLimitsUpdated
path: <auto>
- id: realtime-translation-client-events
title: Translation client events
description: >
These are events that the OpenAI Realtime Translation WebSocket server
will accept from the client.
navigationGroup: realtime
sections:
- type: object
key: RealtimeTranslationClientEventSessionUpdate
path: <auto>
- type: object
key: RealtimeTranslationClientEventInputAudioBufferAppend
path: <auto>
- type: object
key: RealtimeTranslationClientEventSessionClose
path: <auto>
- id: realtime-translation-server-events
title: Translation server events
description: >
These are events emitted from the OpenAI Realtime Translation WebSocket
server to the client.
navigationGroup: realtime
sections:
- type: object
key: RealtimeServerEventError
path: <auto>
- type: object
key: RealtimeTranslationServerEventSessionCreated
path: <auto>
- type: object
key: RealtimeTranslationServerEventSessionUpdated
path: <auto>
- type: object
key: RealtimeTranslationServerEventSessionClosed
path: <auto>
- type: object
key: RealtimeTranslationServerEventSessionInputTranscriptDelta
path: <auto>
- type: object
key: RealtimeTranslationServerEventSessionOutputTranscriptDelta
path: <auto>
- type: object
key: RealtimeTranslationServerEventSessionOutputAudioDelta
path: <auto>
- id: chat-streaming
title: Streaming
description: |
Stream Chat Completions in real time. Receive chunks of completions
returned from the model using server-sent events.
[Learn more](/docs/guides/streaming-responses?api-mode=chat).
navigationGroup: chat
sections:
- type: object
key: CreateChatCompletionStreamResponse
path: streaming
- id: assistants-streaming
title: Streaming
beta: true
description: >
Stream the result of executing a Run or resuming a Run after submitting
tool outputs.
You can stream events from the [Create Thread and
Run](/docs/api-reference/runs/createThreadAndRun),
[Create Run](/docs/api-reference/runs/createRun), and [Submit Tool
Outputs](/docs/api-reference/runs/submitToolOutputs)
endpoints by passing `"stream": true`. The response will be a
[Server-Sent
events](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events)
stream.
Our Node and Python SDKs provide helpful utilities to make streaming
easy. Reference the
[Assistants API quickstart](/docs/assistants/overview) to learn more.
navigationGroup: assistants
sections:
- type: object
key: AssistantStreamEvent
path: events
- id: realtime-beta-client-events
title: Realtime Beta client events
description: >
These are events that the OpenAI Realtime WebSocket server will accept
from the client.
navigationGroup: legacy
sections:
- type: object
key: RealtimeBetaClientEventSessionUpdate
path: <auto>
- type: object
key: RealtimeBetaClientEventInputAudioBufferAppend
path: <auto>
- type: object
key: RealtimeBetaClientEventInputAudioBufferCommit
path: <auto>
- type: object
key: RealtimeBetaClientEventInputAudioBufferClear
path: <auto>
- type: object
key: RealtimeBetaClientEventConversationItemCreate
path: <auto>
- type: object
key: RealtimeBetaClientEventConversationItemRetrieve
path: <auto>
- type: object
key: RealtimeBetaClientEventConversationItemTruncate
path: <auto>
- type: object
key: RealtimeBetaClientEventConversationItemDelete
path: <auto>
- type: object
key: RealtimeBetaClientEventResponseCreate
path: <auto>
- type: object
key: RealtimeBetaClientEventResponseCancel
path: <auto>
- type: object
key: RealtimeBetaClientEventTranscriptionSessionUpdate
path: <auto>
- type: object
key: RealtimeBetaClientEventOutputAudioBufferClear
path: <auto>
- id: realtime-beta-server-events
title: Realtime Beta server events
description: >
These are events emitted from the OpenAI Realtime WebSocket server to
the client.
navigationGroup: legacy
sections:
- type: object
key: RealtimeBetaServerEventError