view release on metacpan or search on metacpan
0.24Â Â 2025-08-22
- Model Updates: Added support for new `gpt-5` series models, including
`gpt-5`, `gpt-5-mini`, and `gpt-5-nano`, across various API endpoints like
Assistants and Chat Completions.
- Conversations API Introduction: A new top-level `/conversations` endpoint has
been added to create, retrieve, update, and delete conversations and their
items. This provides a new way to manage and persist conversation state. The
previous `/embeddings` endpoint has been removed to accommodate this new
feature.
- Images API Streaming: The Images API now supports streaming for both image
generation (`/images/generations`) and editing (`/images/edits`). New
parameters such as `input_fidelity` and `partial_images` have also been
introduced for more control over image results.
- Documentation and Code Examples: Replaced all Kotlin code examples with Java
examples across the entire API specification. Endpoint summaries have been
standardized for conciseness, with longer explanations moved into the
`description` field. Additionally, internal documentation links have been
updated to absolute URLs.
- File API Enhancements: The organizational file storage limit has been
increased to 1 TB. A new `expires_after` parameter allows setting an expiration
parameter to manage the lifecycle of output files. Many schema definitions have
been updated from `oneOf` to the more flexible `anyOf`.
0.23 2025-07-03
- Version number bump to replace bad PAUSE upload. No functional change.
0.22 2025-07-03
- Added new `git-release` script to automate the release process.
- Audio API Updates: The audio text-to-speech model is updated to
gpt-4o-mini-tts, and the audio transcription model is updated to
gpt-4o-transcribe, with the addition of a streaming option for the
transcription api.
- Chat Completions Enhancements: Introduces new features for the Chat
Completions API, including the ability to list, retrieve, update, and delete
chat completions. Support for metadata filtering is added, and the
documentation clarifies parameter support across different models.
- Realtime API Expansion: Adds a new endpoint for creating realtime
transcription sessions and incorporates C# examples for both audio generation
and transcription.
- Responses API Improvements: Significant updates to the Responses
API, with a focus on enhanced tool usage, including web search and file search,
0.21 2025-04-11
- Added examples to the docs, along with allowed models for each path.
0.20 2025-04-06
- Complete revamped documentation. Much easier to read than the
near-useless Schema.pod that we used to have.
0.16 2025-04-06
- Audio API Updates: The audio text-to-speech model is updated to
gpt-4o-mini-tts, and the audio transcription model is updated to
gpt-4o-transcribe, with the addition of a streaming option for the
transcription api.
- Chat Completions Enhancements: Introduces new features for the Chat
Completions API, including the ability to list, retrieve, update, and delete
chat completions. Support for metadata filtering is added, and the
documentation clarifies parameter support across different models.
- Realtime API Expansion: Adds a new endpoint for creating realtime
transcription sessions and incorporates C# examples for both audio generation
and transcription.
- Responses API Improvements: Significant updates to the Responses
API, with a focus on enhanced tool usage, including web search and file search,
lib/OpenAPI/Client/OpenAI/Path/completions.pod view on Meta::CPAN
"completion_tokens" : 7,
"prompt_tokens" : 5,
"total_tokens" : 12
}
}
=head1 SCHEMAS
=head2 ChatCompletionStreamOptions
Options for streaming response. Only set this when you set C<stream: true> .
=head2 CompletionUsage
Properties:
=over
=item * C<completion_tokens> (integer, required) - Number of tokens in the generated completion.
Default: 0
lib/OpenAPI/Client/OpenAI/Path/images-edits.pod view on Meta::CPAN
Resolutions above C<2560x1440> are experimental, and the maximum supported
resolution is C<3840x2160> . The requested size must also satisfy the model's
current pixel and edge limits. The standard sizes C<1024x1024> , C<1536x1024>
, and C<1024x1536> are supported by the GPT image models; C<auto> is supported
for models that allow automatic sizing. For C<dall-e-2> , use one of
C<256x256> , C<512x512> , or C<1024x1024> . For C<dall-e-3> , use one of
C<1024x1024> , C<1792x1024> , or C<1024x1792> .
Default: 1024x1024
=item * C<stream> (boolean) - Edit the image in streaming mode. Defaults to C<false> . See the
L<Image generation guide|https://platform.openai.com/docs/guides/image-generation>
for more information.
Default:
=item * C<user> (string) - A unique identifier representing your end-user, which can help OpenAI to
monitor and detect abuse.
L<Learn more|https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids>
.
lib/OpenAPI/Client/OpenAI/Path/images-edits.pod view on Meta::CPAN
Allowed values: 1024x1024, 1024x1536, 1536x1024
=item * C<usage> (ImageGenUsage)
See L</ImageGenUsage> below for shape.
=back
=head2 PartialImages
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.
=head1 SEE ALSO
L<OpenAPI::Client::OpenAI::Path>
=head1 COPYRIGHT AND LICENSE
lib/OpenAPI/Client/OpenAI/Path/images-generations.pod view on Meta::CPAN
Resolutions above C<2560x1440> are experimental, and the maximum supported
resolution is C<3840x2160> . The requested size must also satisfy the model's
current pixel and edge limits. The standard sizes C<1024x1024> , C<1536x1024>
, and C<1024x1536> are supported by the GPT image models; C<auto> is supported
for models that allow automatic sizing. For C<dall-e-2> , use one of
C<256x256> , C<512x512> , or C<1024x1024> . For C<dall-e-3> , use one of
C<1024x1024> , C<1792x1024> , or C<1024x1792> .
Default: auto
=item * C<stream> (boolean) - Generate the image in streaming mode. Defaults to C<false> . See the
L<Image generation guide|https://platform.openai.com/docs/guides/image-generation>
for more information. This parameter is only supported for the GPT image
models.
Default:
=item * C<style> (string) - The style of the generated images. This parameter is only supported for
C<dall-e-3> . Must be one of C<vivid> or C<natural> . Vivid causes the model
to lean towards generating hyper-real and dramatic images. Natural causes the
model to produce more natural, less hyper-real looking images.
lib/OpenAPI/Client/OpenAI/Path/images-generations.pod view on Meta::CPAN
Allowed values: 1024x1024, 1024x1536, 1536x1024
=item * C<usage> (ImageGenUsage)
See L</ImageGenUsage> below for shape.
=back
=head2 PartialImages
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.
=head1 SEE ALSO
L<OpenAPI::Client::OpenAI::Path>
=head1 COPYRIGHT AND LICENSE
lib/OpenAPI/Client/OpenAI/Path/responses-response_id.pod view on Meta::CPAN
=item * C<response_id> (in path, required, string) - The ID of the response to retrieve.
=item * C<include> (in query, optional, array) - Additional fields to include in the response. See the C<include> parameter for
Response creation above for more information.
=item * C<stream> (in query, optional, boolean) - If set to true, the model response data will be streamed to the client as it
is generated using
L<server-sent events|https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format>
. See the
L<Streaming section below|https://platform.openai.com/docs/api-reference/responses-streaming>
for more information.
=item * C<starting_after> (in query, optional, integer) - The sequence number of the event after which to start streaming.
=item * C<include_obfuscation> (in query, optional, boolean) - When true, stream obfuscation will be enabled. Stream obfuscation adds random
characters to an C<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 C<include_obfuscation> to false to optimize
for bandwidth if you trust the network links between your application and the
OpenAI API.
=back
=head4 Responses
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
}
],
"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
share/openapi.yaml view on Meta::CPAN
`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
share/openapi.yaml view on Meta::CPAN
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]`
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
}
},
"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
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
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'
share/openapi.yaml view on Meta::CPAN
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:
share/openapi.yaml view on Meta::CPAN
"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
share/openapi.yaml view on Meta::CPAN
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:
share/openapi.yaml view on Meta::CPAN
"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
share/openapi.yaml view on Meta::CPAN
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:
share/openapi.yaml view on Meta::CPAN
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:
share/openapi.yaml view on Meta::CPAN
- $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:
share/openapi.yaml view on Meta::CPAN
$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:
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
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.
share/openapi.yaml view on Meta::CPAN
"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`.
share/openapi.yaml view on Meta::CPAN
"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:
share/openapi.yaml view on Meta::CPAN
}
},
"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
share/openapi.yaml view on Meta::CPAN
"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
share/openapi.yaml view on Meta::CPAN
"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:
share/openapi.yaml view on Meta::CPAN
"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
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
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:
share/openapi.yaml view on Meta::CPAN
"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`.
share/openapi.yaml view on Meta::CPAN
"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:
share/openapi.yaml view on Meta::CPAN
"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
share/openapi.yaml view on Meta::CPAN
"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
share/openapi.yaml view on Meta::CPAN
"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:
share/openapi.yaml view on Meta::CPAN
"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
share/openapi.yaml view on Meta::CPAN
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: |
share/openapi.yaml view on Meta::CPAN
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: |
share/openapi.yaml view on Meta::CPAN
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: |
{
share/openapi.yaml view on Meta::CPAN
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: |
{
share/openapi.yaml view on Meta::CPAN
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: |
{
share/openapi.yaml view on Meta::CPAN
"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:
share/openapi.yaml view on Meta::CPAN
- $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
share/openapi.yaml view on Meta::CPAN
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:
share/openapi.yaml view on Meta::CPAN
$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:
share/openapi.yaml view on Meta::CPAN
- 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
share/openapi.yaml view on Meta::CPAN
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
share/openapi.yaml view on Meta::CPAN
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