From 2aa4906825cbb25593396d440c43fc8b04d9a10b Mon Sep 17 00:00:00 2001 From: Kevin Whinnery Date: Mon, 4 Nov 2024 16:54:03 -0600 Subject: [PATCH 1/7] Update openapi.yaml --- openapi.yaml | 1437 ++++++++++++++++++++++++++------------------------ 1 file changed, 761 insertions(+), 676 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 7752078f..5987cf14 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -88,7 +88,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -1435,7 +1435,9 @@ paths: "completion_tokens": 12, "total_tokens": 21, "completion_tokens_details": { - "reasoning_tokens": 0 + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 } } } @@ -1544,7 +1546,9 @@ paths: "completion_tokens": 12, "total_tokens": 21, "completion_tokens_details": { - "reasoning_tokens": 0 + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 } } } @@ -1782,7 +1786,9 @@ paths: "completion_tokens": 17, "total_tokens": 99, "completion_tokens_details": { - "reasoning_tokens": 0 + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 } } } @@ -2018,7 +2024,9 @@ paths: "completion_tokens": 9, "total_tokens": 18, "completion_tokens_details": { - "reasoning_tokens": 0 + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 } }, "system_fingerprint": null @@ -2252,7 +2260,7 @@ paths: operationId: listFiles tags: - Files - summary: Returns a list of files that belong to the user's organization. + summary: Returns a list of files. parameters: - in: query name: purpose @@ -2260,6 +2268,35 @@ paths: schema: type: string description: Only return files with the given purpose. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 10,000, and the default is 10,000. + required: false + schema: + type: integer + default: 10000 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string responses: "200": description: OK @@ -3919,7 +3956,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -6229,7 +6266,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -6728,7 +6765,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -6900,7 +6937,7 @@ paths: See the [file search tool - documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. schema: type: array @@ -7718,7 +7755,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -7733,7 +7770,7 @@ paths: See the [file search tool - documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. schema: type: array @@ -7856,7 +7893,7 @@ paths: See the [file search tool - documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. schema: type: array @@ -8293,7 +8330,7 @@ paths: Please refer to documentation for the supported MIME types for your use case: - - [Assistants](/docs/assistants/tools/file-search/supported-files) + - [Assistants](/docs/assistants/tools/file-search#supported-files) For guidance on the proper filename extensions for each purpose, please @@ -8554,7 +8591,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -9216,7 +9253,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -9351,7 +9388,7 @@ paths: description: > A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list - request and receive 100 objects, ending with obj_foo, your + request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. schema: @@ -9713,8 +9750,8 @@ components: description: > ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models/overview) - for descriptions of them. + available models, or see our [Model overview](/docs/models) for + descriptions of them. type: string instructions: description: > @@ -9932,7 +9969,7 @@ components: Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool - documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. ranking_options: $ref: "#/components/schemas/FileSearchRankingOptions" @@ -9966,8 +10003,8 @@ components: AssistantsApiResponseFormatOption: description: > Specifies the format that the model must output. Compatible with - [GPT-4o](/docs/models/gpt-4o), [GPT-4 - Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + [GPT-4o](/docs/models#gpt-4o), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. @@ -10982,7 +11019,7 @@ components: detail: type: string description: Specifies the detail level of the image. Learn more in the [Vision - guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). enum: - auto - low @@ -11398,12 +11435,30 @@ components: type: object description: Breakdown of tokens used in a completion. properties: + accepted_prediction_tokens: + type: integer + description: | + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. audio_tokens: type: integer description: Audio input tokens generated by the model. reasoning_tokens: type: integer description: Tokens generated by the model for reasoning. + rejected_prediction_tokens: + type: integer + description: > + When using Predicted Outputs, the number of tokens in the + + prediction that did not appear in the completion. However, like + + reasoning tokens, these tokens are still counted in the total + + completion tokens for purposes of billing, output, and context + window + + limits. prompt_tokens_details: type: object description: Breakdown of tokens used in the prompt. @@ -11426,8 +11481,8 @@ components: description: > ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models/overview) - for descriptions of them. + available models, or see our [Model overview](/docs/models) for + descriptions of them. example: gpt-4o anyOf: - type: string @@ -11760,7 +11815,9 @@ components: "completion_tokens": 17, "total_tokens": 99, "completion_tokens_details": { - "reasoning_tokens": 0 + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 } } } @@ -11792,7 +11849,9 @@ components: "completion_tokens": 12, "total_tokens": 21, "completion_tokens_details": { - "reasoning_tokens": 0 + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 } } } @@ -11816,7 +11875,7 @@ components: $ref: "#/components/schemas/ChatCompletionRequestMessage" model: description: ID of the model to use. See the [model endpoint - compatibility](/docs/models/model-endpoint-compatibility) table for + compatibility](/docs/models#model-endpoint-compatibility) table for details on which models work with the Chat API. example: gpt-4o anyOf: @@ -11888,7 +11947,7 @@ components: [See more information about frequency and presence - penalties.](/docs/guides/text-generation/parameter-details) + penalties.](/docs/guides/text-generation) logit_bias: type: object x-oaiTypeLabel: map @@ -11957,6 +12016,21 @@ components: minimize costs. modalities: $ref: "#/components/schemas/ChatCompletionModalities" + prediction: + nullable: true + x-oaiExpandable: true + description: > + Configuration for a [Predicted + Output](/docs/guides/latency-optimization#use-predicted-outputs), + + which can greatly improve response times when large parts of the + model + + response are known ahead of time. This is most common when you are + + regenerating a file with only minor changes to most of the content. + oneOf: + - $ref: "#/components/schemas/PredictionContent" audio: type: object nullable: true @@ -11974,14 +12048,19 @@ components: type: string enum: - alloy + - ash + - ballad + - coral - echo - - fable - - onyx - - nova + - sage - shimmer - description: | - Specifies the voice type. Supported voices are `alloy`, `echo`, - `fable`, `onyx`, `nova`, and `shimmer`. + - verse + description: > + The voice the model uses to respond. Supported voices are + `alloy`, + + `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and + `verse`. format: type: string enum: @@ -11994,7 +12073,7 @@ components: Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, - `opus`, or `pcm16`. + `opus`, or `pcm16`. presence_penalty: type: number default: 0 @@ -12008,13 +12087,13 @@ components: [See more information about frequency and presence - penalties.](/docs/guides/text-generation/parameter-details) + penalties.](/docs/guides/text-generation) response_format: description: > An object specifying the format that the model must output. - Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o - mini](/docs/models/gpt-4o-mini), [GPT-4 - Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo + Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4o + mini](/docs/models#gpt-4o-mini), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4) and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. @@ -12063,7 +12142,7 @@ components: Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service: - - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. + - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. - When not set, the default behavior is 'auto'. @@ -12148,7 +12227,7 @@ components: 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). + more](/docs/guides/safety-best-practices#end-user-ids). function_call: deprecated: true description: > @@ -12329,7 +12408,9 @@ components: "cached_tokens": 0 }, "completion_tokens_details": { - "reasoning_tokens": 0 + "reasoning_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 } }, "system_fingerprint": "fp_6b68a8204b" @@ -12437,6 +12518,7 @@ components: - chat.completion.chunk usage: type: object + nullable: true description: > An optional field that will only be present when you set `stream_options: {"include_usage": true}` in your request. @@ -12490,8 +12572,8 @@ components: description: > ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models/overview) - for descriptions of them. + available models, or see our [Model overview](/docs/models) for + descriptions of them. anyOf: - type: string - type: string @@ -12572,7 +12654,7 @@ components: [See more information about frequency and presence - penalties.](/docs/guides/text-generation/parameter-details) + penalties.](/docs/guides/text-generation) logit_bias: type: object x-oaiTypeLabel: map @@ -12654,7 +12736,7 @@ components: [See more information about frequency and presence - penalties.](/docs/guides/text-generation/parameter-details) + penalties.](/docs/guides/text-generation) seed: type: integer minimum: -9223372036854776000 @@ -12743,7 +12825,7 @@ components: 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). + more](/docs/guides/safety-best-practices#end-user-ids). required: - model - prompt @@ -12918,8 +13000,8 @@ components: description: > ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models/overview) - for descriptions of them. + available models, or see our [Model overview](/docs/models) for + descriptions of them. example: text-embedding-3-small anyOf: - type: string @@ -12950,7 +13032,7 @@ components: 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). + more](/docs/guides/safety-best-practices#end-user-ids). required: - model - input @@ -13024,7 +13106,7 @@ components: The name of the model to fine-tune. You can select one of the [supported - models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). + models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). example: gpt-4o-mini anyOf: - type: string @@ -13289,7 +13371,7 @@ components: 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). + more](/docs/guides/safety-best-practices#end-user-ids). required: - prompt - image @@ -13376,7 +13458,7 @@ components: 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). + more](/docs/guides/safety-best-practices#end-user-ids). required: - prompt CreateImageVariationRequest: @@ -13436,7 +13518,7 @@ components: 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). + more](/docs/guides/safety-best-practices#end-user-ids). required: - image CreateMessageRequest: @@ -13470,7 +13552,7 @@ components: description: An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible - models](/docs/models/overview). + models](/docs/models). title: Array of content parts items: oneOf: @@ -13579,7 +13661,7 @@ components: description: | The content moderation model you would like to use. Learn more in [the moderation guide](/docs/guides/moderation), and learn about - available models [here](/docs/models/moderation). + available models [here](/docs/models#moderation). nullable: false default: omni-moderation-latest example: omni-moderation-2024-09-26 @@ -14125,7 +14207,7 @@ components: properties: model: description: > - One of the available [TTS models](/docs/models/tts): `tts-1` or + One of the available [TTS models](/docs/models#tts): `tts-1` or `tts-1-hd` anyOf: - type: string @@ -14143,7 +14225,7 @@ components: description: The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the [Text to speech - guide](/docs/guides/text-to-speech/voice-options). + guide](/docs/guides/text-to-speech#voice-options). type: string enum: - alloy @@ -14524,7 +14606,7 @@ components: prompt: description: > An optional text to guide the model's style or continue a previous - audio segment. The [prompt](/docs/guides/speech-to-text/prompting) + audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should match the audio language. type: string response_format: @@ -14655,7 +14737,7 @@ components: prompt: description: > An optional text to guide the model's style or continue a previous - audio segment. The [prompt](/docs/guides/speech-to-text/prompting) + audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should be in English. type: string response_format: @@ -15002,10 +15084,10 @@ components: required: - event - data - description: Occurs when an [error](/docs/guides/error-codes/api-errors) occurs. + description: Occurs when an [error](/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout. x-oaiMeta: - dataDescription: "`data` is an [error](/docs/guides/error-codes/api-errors)" + dataDescription: "`data` is an [error](/docs/guides/error-codes#api-errors)" ErrorResponse: type: object properties: @@ -15022,7 +15104,7 @@ components: See the [file search tool - documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. properties: ranker: @@ -15809,17 +15891,28 @@ components: ListFilesResponse: type: object properties: + object: + type: string + example: list data: type: array items: $ref: "#/components/schemas/OpenAIFile" - object: + first_id: type: string - enum: - - list + example: file-abc123 + last_id: + type: string + example: file-abc456 + has_more: + type: boolean + example: false required: - object - data + - first_id + - last_id + - has_more ListFineTuningJobCheckpointsResponse: type: object properties: @@ -16738,8 +16831,8 @@ components: description: > ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models/overview) - for descriptions of them. + available models, or see our [Model overview](/docs/models) for + descriptions of them. anyOf: - type: string name: @@ -17006,10 +17099,52 @@ components: - type ParallelToolCalls: description: Whether to enable [parallel function - calling](/docs/guides/function-calling/parallel-function-calling) during - tool use. + calling](/docs/guides/function-calling#configuring-parallel-function-calling) + during tool use. type: boolean default: true + 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`. + content: + x-oaiExpandable: true + 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. @@ -17442,65 +17577,32 @@ components: - role RealtimeClientEventConversationItemCreate: type: object - description: Send this event when adding an item to the conversation. + description: >- + Add a new Item to the Conversation's context, including messages, + function calls, and function call responses. This event can be used both + to populate a "history" of the conversation and to add new items + mid-stream, but has the current limitation that it cannot populate + assistant audio messages. + + If successful, the server will respond with a + `conversation.item.created` event, otherwise an `error` event will be + sent. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string - description: The event type, must be "conversation.item.create". + description: The event type, must be `conversation.item.create`. previous_item_id: type: string description: The ID of the preceding item after which the new item will be - inserted. + inserted. If not set, the new item will be appended to the end of + the conversation. If set, it allows an item to be inserted + mid-conversation. If the ID cannot be found, an error will be + returned and the item will not be added. item: - type: object - description: The item to add to the conversation. - properties: - id: - type: string - description: The unique ID of the item. - type: - type: string - description: The type of the item ("message", "function_call", - "function_call_output"). - status: - type: string - description: The status of the item ("completed", "in_progress", "incomplete"). - role: - type: string - description: The role of the message sender ("user", "assistant", "system"). - content: - type: array - description: The content of the message. - items: - type: object - properties: - type: - type: string - description: The content type ("input_text", "input_audio", "text", "audio"). - text: - type: string - description: The text content. - audio: - type: string - description: Base64-encoded audio bytes. - transcript: - type: string - description: The transcript of the audio. - call_id: - type: string - description: The ID of the function call (for "function_call" items). - name: - type: string - description: The name of the function being called (for "function_call" items). - arguments: - type: string - description: The arguments of the function call (for "function_call" items). - output: - type: string - description: The output of the function call (for "function_call_output" items). + $ref: "#/components/schemas/RealtimeConversationItem" required: - type - item @@ -17515,7 +17617,6 @@ components: "item": { "id": "msg_001", "type": "message", - "status": "completed", "role": "user", "content": [ { @@ -17528,7 +17629,10 @@ components: RealtimeClientEventConversationItemDelete: type: object description: Send this event when you want to remove any item from the - conversation history. + conversation history. The server will respond with a + `conversation.item.deleted` event, unless the item does not exist in the + conversation history, in which case the server will respond with an + error. properties: event_id: type: string @@ -17553,8 +17657,18 @@ components: } RealtimeClientEventConversationItemTruncate: type: object - description: Send this event when you want to truncate a previous assistant - message’s audio. + description: >- + Send this event to truncate a previous assistant message’s audio. The + server will produce audio faster than realtime, so this event is useful + when the user interrupts to truncate audio that has already been sent to + the client but not yet played. This will synchronize the server's + understanding of the audio with the client's playback. + + Truncating audio will delete the server-side text transcript to ensure + there is not text in the context that hasn't been heard by the user. + + If successful, the server will respond with a + `conversation.item.truncated` event. properties: event_id: type: string @@ -17564,13 +17678,16 @@ components: description: The event type, must be "conversation.item.truncate". item_id: type: string - description: The ID of the assistant message item to truncate. + 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. + 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 @@ -17589,7 +17706,17 @@ components: } RealtimeClientEventInputAudioBufferAppend: type: object - description: Send this event to append audio bytes to the input audio buffer. + 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 @@ -17599,7 +17726,8 @@ components: description: The event type, must be "input_audio_buffer.append". audio: type: string - description: Base64-encoded audio bytes. + 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 @@ -17614,7 +17742,8 @@ components: } RealtimeClientEventInputAudioBufferClear: type: object - description: Send this event to clear the audio bytes in the buffer. + 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 @@ -17634,7 +17763,17 @@ components: } RealtimeClientEventInputAudioBufferCommit: type: object - description: Send this event to commit audio bytes to a user message. + description: >- + Send this event to commit the user input audio buffer, which will create + a new user message item in the conversation. This event will produce an + error if the input audio buffer is empty. When in Server VAD mode, the + client does not need to send this event, the server will commit the + audio buffer automatically. + + Committing the input audio buffer will trigger input audio transcription + (if enabled in session configuration), but it will not create a response + from the model. The server will respond with an + `input_audio_buffer.committed` event. properties: event_id: type: string @@ -17654,14 +17793,16 @@ components: } RealtimeClientEventResponseCancel: type: object - description: Send this event to cancel an in-progress response. + description: Send this event to cancel an in-progress response. The server will + respond with a `response.cancelled` event or an error if there is no + response to cancel. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string - description: The event type, must be "response.cancel". + description: The event type, must be `response.cancel`. required: - type x-oaiMeta: @@ -17674,67 +17815,31 @@ components: } RealtimeClientEventResponseCreate: type: object - description: Send this event to trigger a response generation. + description: >- + This event instructs the server to create a Response, which means + triggering model inference. When in Server VAD mode, the server will + create Responses automatically. + + A Response will include at least one Item, and may have two, in which + case the second will be a function call. These Items will be appended to + the conversation history. + + The server will respond with a `response.created` event, events for + Items and content created, and finally a `response.done` event to + indicate the Response is complete. + + The `response.create` event includes inference configuration like + `instructions`, and `temperature`. These fields will override the + Session's configuration for this Response only. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string - description: The event type, must be "response.create". + description: The event type, must be `response.create`. response: - type: object - description: Configuration for the response. - properties: - modalities: - type: array - items: - type: string - description: The modalities for the response. - instructions: - type: string - description: Instructions for the model. - voice: - type: string - description: The voice the model uses to respond - one of `alloy`, `echo`, or - `shimmer`. - output_audio_format: - type: string - description: The format of output audio. - tools: - type: array - description: Tools (functions) available to the model. - items: - type: object - properties: - type: - type: string - description: The type of the tool. - name: - type: string - description: The name of the function. - description: - type: string - description: The description of the function. - parameters: - type: object - description: Parameters of the function in JSON Schema. - tool_choice: - type: string - description: How the model chooses tools. - temperature: - type: number - description: Sampling temperature. - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - description: Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 - to limit output tokens, or "inf" for the maximum available - tokens for a given model. Defaults to "inf". + $ref: "#/components/schemas/RealtimeResponse" required: - type - response @@ -17772,7 +17877,13 @@ components: } RealtimeClientEventSessionUpdate: type: object - description: Send this event to update the session’s default configuration. + description: Send this event to update the session’s default configuration. The + client may send this event at any time to update the session + configuration, and any field may be updated at any time, except for + "voice". The server will respond with a `session.updated` event that + shows the full effective configuration. Only fields that are present are + updated, thus the correct way to clear a field like "instructions" is to + pass an empty string. properties: event_id: type: string @@ -17781,90 +17892,7 @@ components: type: string description: The event type, must be "session.update". session: - type: object - description: Session configuration to update. - properties: - modalities: - type: array - items: - type: string - description: The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - instructions: - type: string - description: The default system instructions prepended to model calls. - voice: - type: string - description: The voice the model uses to respond - one of `alloy`, `echo`, - or `shimmer`. Cannot be changed once the model has responded - with audio at least once. - input_audio_format: - type: string - description: The format of input audio. Options are "pcm16", "g711_ulaw", or - "g711_alaw". - output_audio_format: - type: string - description: The format of output audio. Options are "pcm16", "g711_ulaw", or - "g711_alaw". - input_audio_transcription: - type: object - description: Configuration for input audio transcription. Can be set to `null` - to turn off. - properties: - model: - type: string - description: The model to use for transcription (e.g., "whisper-1"). - turn_detection: - type: object - description: Configuration for turn detection. Can be set to `null` to turn off. - properties: - type: - type: string - description: Type of turn detection, only "server_vad" is currently supported. - threshold: - type: number - description: Activation threshold for VAD (0.0 to 1.0). - prefix_padding_ms: - type: integer - description: Amount of audio to include before speech starts (in milliseconds). - silence_duration_ms: - type: integer - description: Duration of silence to detect speech stop (in milliseconds). - tools: - type: array - description: Tools (functions) available to the model. - items: - type: object - properties: - type: - type: string - description: The type of the tool, e.g., "function". - name: - type: string - description: The name of the function. - description: - type: string - description: The description of the function. - parameters: - type: object - description: Parameters of the function in JSON Schema. - tool_choice: - type: string - description: How the model chooses tools. Options are "auto", "none", - "required", or specify a function. - temperature: - type: number - description: Sampling temperature for the model. - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - description: Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 - to limit output tokens, or "inf" for the maximum available - tokens for a given model. Defaults to "inf". + $ref: "#/components/schemas/RealtimeSession" required: - type - session @@ -17888,13 +17916,13 @@ components: "type": "server_vad", "threshold": 0.5, "prefix_padding_ms": 300, - "silence_duration_ms": 200 + "silence_duration_ms": 500 }, "tools": [ { "type": "function", "name": "get_weather", - "description": "Get the current weather for a location.", + "description": "Get the current weather for a location, tell the user you are fetching the weather.", "parameters": { "type": "object", "properties": { @@ -17906,9 +17934,157 @@ components: ], "tool_choice": "auto", "temperature": 0.8, - "max_output_tokens": null + "max_response_output_tokens": "inf" } } + RealtimeConversationItem: + type: object + description: The item to add to the conversation. + properties: + id: + type: string + description: The unique ID of the item, this can be generated by the client to + help manage server-side context, but is not required because the + server will generate one if not provided. + type: + type: string + description: The type of the item (`message`, `function_call`, + `function_call_output`). + status: + type: string + description: The status of the item (`completed`, `incomplete`). These have no + effect on the conversation, but are accepted for consistency with + the `conversation.item.created` event. + role: + type: string + description: The role of the message sender (`user`, `assistant`, `system`), + only applicable for `message` items. + content: + type: array + description: The content of the message, applicable for `message` items. Message + items with a role of `system` support only `input_text` content, + message items of role `user` support `input_text` and `input_audio` + content, and message items of role `assistant` support `text` + content. + items: + type: object + properties: + type: + type: string + description: The content type (`input_text`, `input_audio`, `text`). + text: + type: string + description: The text content, used for `input_text` and `text` content types. + audio: + type: string + description: Base64-encoded audio bytes, used for `input_audio` content type. + transcript: + type: string + description: The transcript of the audio, used for `input_audio` content type. + call_id: + type: string + description: The ID of the function call (for `function_call` and + `function_call_output` items). If passed on a `function_call_output` + item, the server will check that a `function_call` item with the + same ID exists in the conversation history. + name: + type: string + description: The name of the function being called (for `function_call` items). + arguments: + type: string + description: The arguments of the function call (for `function_call` items). + output: + type: string + description: The output of the function call (for `function_call_output` items). + RealtimeResponse: + type: object + description: The response resource. + properties: + id: + type: string + description: The unique ID of the response. + object: + type: string + description: The object type, must be `realtime.response`. + status: + type: string + description: The final status of the response (`completed`, `cancelled`, + `failed`, `incomplete`). + status_details: + type: object + description: Additional details about the status. + properties: + type: + type: string + description: The type of error that caused the response to fail, corresponding + with the `status` field (`cancelled`, `incomplete`, `failed`). + reason: + type: string + description: The reason the Response did not complete. For a `cancelled` + Response, one of `turn_detected` (the server VAD detected a new + start of speech) or `client_cancelled` (the client sent a cancel + event). For an `incomplete` Response, one of `max_output_tokens` + or `content_filter` (the server-side safety filter activated and + cut off the response). + error: + type: object + description: A description of the error that caused the response to fail, + populated when the `status` is `failed`. + properties: + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + output: + type: array + description: The list of output items generated by the response. + items: + type: object + description: An item in the response output. + usage: + type: object + description: Usage statistics for the Response, this will correspond to billing. + A Realtime API session will maintain a conversation context and + append new Items to the Conversation, thus output from previous + turns (text and audio tokens) will become the input for later turns. + properties: + total_tokens: + type: integer + description: The total number of tokens in the Response including input and + output text and audio tokens. + input_tokens: + type: integer + description: The number of input tokens used in the Response, including text and + audio tokens. + output_tokens: + type: integer + description: The number of output tokens sent in the Response, including text + and audio tokens. + input_token_details: + type: object + description: Details about the input tokens used in the Response. + properties: + cached_tokens: + type: integer + description: The number of cached tokens used in the Response. + text_tokens: + type: integer + description: The number of text tokens used in the Response. + audio_tokens: + type: integer + description: The number of audio tokens used in the Response. + output_token_details: + type: object + description: Details about the output tokens used in the Response. + properties: + text_tokens: + type: integer + description: The number of text tokens used in the Response. + audio_tokens: + type: integer + description: The number of audio tokens used in the Response. RealtimeServerEventConversationCreated: type: object description: Returned when a conversation is created. Emitted right after @@ -17948,67 +18124,25 @@ components: } RealtimeServerEventConversationItemCreated: type: object - description: Returned when a conversation item is created. + description: >- + Returned when a conversation item is created. There are several + scenarios that produce this event: + - The server is generating a Response, which if successful will produce either one or two Items, which will be of type `message` (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the server (in `server_vad` mode). The server will take the content of the input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item to the Conversation. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "conversation.item.created". + description: The event type, must be `conversation.item.created`. previous_item_id: type: string - description: The ID of the preceding item. + description: The ID of the preceding item in the Conversation context, allows + the client to understand the order of the conversation. item: - type: object - description: The item that was created. - properties: - id: - type: string - description: The unique ID of the item. - object: - type: string - description: The object type, must be "realtime.item". - type: - type: string - description: The type of the item ("message", "function_call", - "function_call_output"). - status: - type: string - description: The status of the item ("completed", "in_progress", "incomplete"). - role: - type: string - description: The role associated with the item ("user", "assistant", "system"). - content: - type: array - description: The content of the item. - items: - type: object - properties: - type: - type: string - description: The content type ("text", "audio", "input_text", "input_audio"). - text: - type: string - description: The text content. - audio: - type: string - description: Base64-encoded audio data. - transcript: - type: string - description: The transcript of the audio. - call_id: - type: string - description: The ID of the function call (for "function_call" items). - name: - type: string - description: The name of the function being called. - arguments: - type: string - description: The arguments of the function call. - output: - type: string - description: The output of the function call (for "function_call_output" items). + $ref: "#/components/schemas/RealtimeConversationItem" required: - event_id - type @@ -18031,21 +18165,25 @@ components: "content": [ { "type": "input_audio", - "transcript": null + "transcript": "hello how are you", + "audio": "base64encodedaudio==" } ] } } RealtimeServerEventConversationItemDeleted: type: object - description: Returned when an item in the conversation is deleted. + description: Returned when an item in the conversation is deleted by the client + with a `conversation.item.delete` event. This event is used to + synchronize the server's understanding of the conversation history with + the client's view. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "conversation.item.deleted". + description: The event type, must be `conversation.item.deleted`. item_id: type: string description: The ID of the item that was deleted. @@ -18064,8 +18202,18 @@ components: } RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: type: object - description: Returned when input audio transcription is enabled and a - transcription succeeds. + description: >- + This event is the output of audio transcription for user audio written + to the user audio buffer. Transcription begins when the input audio + buffer is committed by the client or server (in `server_vad` mode). + Transcription runs asynchronously with Response creation, so this event + may come before or after the Response events. + + Realtime API models accept audio natively, and thus input transcription + is a separate process run on a separate ASR (Automatic Speech + Recognition) model, currently always `whisper-1`. Thus the transcript + may diverge somewhat from the model's interpretation, and should be + treated as a rough guide. properties: event_id: type: string @@ -18073,10 +18221,10 @@ components: type: type: string description: The event type, must be - "conversation.item.input_audio_transcription.completed". + `conversation.item.input_audio_transcription.completed`. item_id: type: string - description: The ID of the user message item. + description: The ID of the user message item containing the audio. content_index: type: integer description: The index of the content part containing the audio. @@ -18103,7 +18251,9 @@ components: RealtimeServerEventConversationItemInputAudioTranscriptionFailed: type: object description: Returned when input audio transcription is configured, and a - transcription request for a user message failed. + transcription request for a user message failed. These events are + separate from other `error` events so that the client can identify the + related Item. properties: event_id: type: string @@ -18111,7 +18261,7 @@ components: type: type: string description: The event type, must be - "conversation.item.input_audio_transcription.failed". + `conversation.item.input_audio_transcription.failed`. item_id: type: string description: The ID of the user message item. @@ -18158,15 +18308,22 @@ components: } RealtimeServerEventConversationItemTruncated: type: object - description: Returned when an earlier assistant audio message item is truncated - by the client. + description: >- + Returned when an earlier assistant audio message item is truncated by + the client with a `conversation.item.truncate` event. This event is used + to synchronize the server's understanding of the audio with the client's + playback. + + This action will truncate the audio and remove the server-side text + transcript to ensure there is no text in the context that hasn't been + heard by the user. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "conversation.item.truncated". + description: The event type, must be `conversation.item.truncated`. item_id: type: string description: The ID of the assistant message item that was truncated. @@ -18195,7 +18352,10 @@ components: } RealtimeServerEventError: type: object - description: Returned when an error occurs. + description: Returned when an error occurs, which could be a client problem or a + server problem. Most errors are recoverable and the session will stay + open, we recommend to implementors to monitor and log error messages by + default. properties: event_id: type: string @@ -18244,14 +18404,15 @@ components: } RealtimeServerEventInputAudioBufferCleared: type: object - description: Returned when the input audio buffer is cleared by the client. + description: Returned when the input audio buffer is cleared by the client with + a `input_audio_buffer.clear` event. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "input_audio_buffer.cleared". + description: The event type, must be `input_audio_buffer.cleared`. required: - event_id - type @@ -18266,14 +18427,16 @@ components: RealtimeServerEventInputAudioBufferCommitted: type: object description: Returned when an input audio buffer is committed, either by the - client or automatically in server VAD mode. + client or automatically in server VAD mode. The `item_id` property is + the ID of the user message item that will be created, thus a + `conversation.item.created` event will also be sent to the client. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "input_audio_buffer.committed". + description: The event type, must be `input_audio_buffer.committed`. previous_item_id: type: string description: The ID of the preceding item after which the new item will be @@ -18298,17 +18461,29 @@ components: } RealtimeServerEventInputAudioBufferSpeechStarted: type: object - description: Returned in server turn detection mode when speech is detected. + description: Sent by the server when in `server_vad` mode to indicate that + speech has been detected in the audio buffer. This can happen any time + audio is added to the buffer (unless speech is already detected). The + client may want to use this event to interrupt audio playback or provide + visual feedback to the user. The client should expect to receive a + `input_audio_buffer.speech_stopped` event when speech stops. The + `item_id` property is the ID of the user message item that will be + created when speech stops and will also be included in the + `input_audio_buffer.speech_stopped` event (unless the client manually + commits the audio buffer during VAD activation). properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "input_audio_buffer.speech_started". + description: The event type, must be `input_audio_buffer.speech_started`. audio_start_ms: type: integer - description: Milliseconds since the session started when speech was detected. + description: Milliseconds from the start of all audio written to the buffer + during the session when speech was first detected. This will + correspond to the beginning of audio sent to the model, and thus + includes the `prefix_padding_ms` configured in the Session. item_id: type: string description: The ID of the user message item that will be created when speech @@ -18330,17 +18505,22 @@ components: } RealtimeServerEventInputAudioBufferSpeechStopped: type: object - description: Returned in server turn detection mode when speech stops. + description: Returned in `server_vad` mode when the server detects the end of + speech in the audio buffer. The server will also send an + `conversation.item.created` event with the user message item that is + created from the audio buffer. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "input_audio_buffer.speech_stopped". + description: The event type, must be `input_audio_buffer.speech_stopped`. audio_end_ms: type: integer - description: Milliseconds since the session started when speech stopped. + description: Milliseconds since the session started when speech stopped. This + will correspond to the end of audio sent to the model, and thus + includes the `min_silence_duration_ms` configured in the Session. item_id: type: string description: The ID of the user message item that will be created. @@ -18361,15 +18541,17 @@ components: } RealtimeServerEventRateLimitsUpdated: type: object - description: Emitted after every "response.done" event to indicate the updated - rate limits. + description: Emitted at the beginning of a Response to indicate the updated rate + limits. When a Response is created some tokens will be "reserved" for + the output tokens, the rate limits shown here reflect that reservation, + which is then adjusted accordingly once the Response is completed. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "rate_limits.updated". + description: The event type, must be `rate_limits.updated`. rate_limits: type: array description: List of rate limit information. @@ -18378,8 +18560,7 @@ components: properties: name: type: string - description: The name of the rate limit ("requests", "tokens", "input_tokens", - "output_tokens"). + description: The name of the rate limit (`requests`, `tokens`). limit: type: integer description: The maximum allowed value for the rate limit. @@ -18729,39 +18910,16 @@ components: 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". + `in_progress`. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "response.created". + description: The event type, must be `response.created`. response: - type: object - description: The response resource. - properties: - id: - type: string - description: The unique ID of the response. - object: - type: string - description: The object type, must be "realtime.response". - status: - type: string - description: The status of the response ("in_progress"). - status_details: - type: object - description: Additional details about the status. - output: - type: array - description: The list of output items generated by the response. - items: - type: object - description: An item in the response output. - usage: - type: object - description: Usage statistics for the response. + $ref: "#/components/schemas/RealtimeResponse" required: - event_id - type @@ -18785,7 +18943,9 @@ components: RealtimeServerEventResponseDone: type: object description: Returned when a Response is done streaming. Always emitted, no - matter the final state. + 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 @@ -18794,31 +18954,7 @@ components: type: string description: The event type, must be "response.done". response: - type: object - description: The response resource. - properties: - id: - type: string - description: The unique ID of the response. - object: - type: string - description: The object type, must be "realtime.response". - status: - type: string - description: The final status of the response ("completed", "cancelled", - "failed", "incomplete"). - status_details: - type: object - description: Additional details about the status. - output: - type: array - description: The list of output items generated by the response. - items: - type: object - description: An item in the response output. - usage: - type: object - description: Usage statistics for the response. + $ref: "#/components/schemas/RealtimeResponse" required: - event_id - type @@ -18851,9 +18987,18 @@ components: } ], "usage": { - "total_tokens": 50, - "input_tokens": 20, - "output_tokens": 30 + "total_tokens":275, + "input_tokens":127, + "output_tokens":148, + "input_token_details": { + "cached_tokens":0, + "text_tokens":119, + "audio_tokens":8 + }, + "output_token_details": { + "text_tokens":36, + "audio_tokens":112 + } } } } @@ -18953,58 +19098,22 @@ components: } RealtimeServerEventResponseOutputItemAdded: type: object - description: Returned when a new Item is created during response generation. + 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 - description: The event type, must be "response.output_item.added". + description: The event type, must be `response.output_item.added`. response_id: type: string - description: The ID of the response to which the item belongs. + 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. + description: The index of the output item in the Response. item: - type: object - description: The item that was added. - properties: - id: - type: string - description: The unique ID of the item. - object: - type: string - description: The object type, must be "realtime.item". - type: - type: string - description: The type of the item ("message", "function_call", - "function_call_output"). - status: - type: string - description: The status of the item ("in_progress", "completed"). - role: - type: string - description: The role associated with the item ("assistant"). - content: - type: array - description: The content of the item. - items: - type: object - properties: - type: - type: string - description: The content type ("text", "audio"). - text: - type: string - description: The text content. - audio: - type: string - description: Base64-encoded audio data. - transcript: - type: string - description: The transcript of the audio. + $ref: "#/components/schemas/RealtimeConversationItem" required: - event_id - type @@ -19039,51 +19148,15 @@ components: description: The unique ID of the server event. type: type: string - description: The event type, must be "response.output_item.done". + description: The event type, must be `response.output_item.done`. response_id: type: string - description: The ID of the response to which the item belongs. + 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. + description: The index of the output item in the Response. item: - type: object - description: The completed item. - properties: - id: - type: string - description: The unique ID of the item. - object: - type: string - description: The object type, must be "realtime.item". - type: - type: string - description: The type of the item ("message", "function_call", - "function_call_output"). - status: - type: string - description: The final status of the item ("completed", "incomplete"). - role: - type: string - description: The role associated with the item ("assistant"). - content: - type: array - description: The content of the item. - items: - type: object - properties: - type: - type: string - description: The content type ("text", "audio"). - text: - type: string - description: The text content. - audio: - type: string - description: Base64-encoded audio data. - transcript: - type: string - description: The transcript of the audio. + $ref: "#/components/schemas/RealtimeConversationItem" required: - event_id - type @@ -19209,103 +19282,18 @@ components: } RealtimeServerEventSessionCreated: type: object - description: Returned when a session is created. Emitted automatically when a - new connection is established. + 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 description: The unique ID of the server event. type: type: string - description: The event type, must be "session.created". + description: The event type, must be `session.created`. session: - type: object - description: The session resource. - properties: - id: - type: string - description: The unique ID of the session. - object: - type: string - description: The object type, must be "realtime.session". - model: - type: string - description: The default model used for this session. - modalities: - type: array - items: - type: string - description: The set of modalities the model can respond with. - instructions: - type: string - description: The default system instructions. - voice: - type: string - description: The voice the model uses to respond - one of `alloy`, `echo`, or - `shimmer`. - input_audio_format: - type: string - description: The format of input audio. - output_audio_format: - type: string - description: The format of output audio. - input_audio_transcription: - type: object - description: Configuration for input audio transcription. - properties: - enabled: - type: boolean - description: Whether input audio transcription is enabled. - model: - type: string - description: The model used for transcription. - turn_detection: - type: object - description: Configuration for turn detection. - properties: - type: - type: string - description: The type of turn detection ("server_vad" or "none"). - threshold: - type: number - description: Activation threshold for VAD. - prefix_padding_ms: - type: integer - description: Audio included before speech starts (in milliseconds). - silence_duration_ms: - type: integer - description: Duration of silence to detect speech stop (in milliseconds). - tools: - type: array - description: Tools (functions) available to the model. - items: - type: object - properties: - type: - type: string - description: The type of the tool. - name: - type: string - description: The name of the function. - description: - type: string - description: The description of the function. - parameters: - type: object - description: Parameters of the function in JSON Schema. - tool_choice: - type: string - description: How the model chooses tools. - temperature: - type: number - description: Sampling temperature. - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - description: Maximum number of output tokens. + $ref: "#/components/schemas/RealtimeSession" required: - event_id - type @@ -19336,12 +19324,13 @@ components: "tools": [], "tool_choice": "auto", "temperature": 0.8, - "max_output_tokens": null + "max_response_output_tokens": null } } RealtimeServerEventSessionUpdated: type: object - description: Returned when a session is updated. + description: Returned when a session is updated with a `session.update` event, + unless there is an error. properties: event_id: type: string @@ -19350,93 +19339,7 @@ components: type: string description: The event type, must be "session.updated". session: - type: object - description: The updated session resource. - properties: - id: - type: string - description: The unique ID of the session. - object: - type: string - description: The object type, must be "realtime.session". - model: - type: string - description: The default model used for this session. - modalities: - type: array - items: - type: string - description: The set of modalities the model can respond with. - instructions: - type: string - description: The default system instructions. - voice: - type: string - description: The voice the model uses to respond - one of `alloy`, `echo`, or - `shimmer`. - input_audio_format: - type: string - description: The format of input audio. - output_audio_format: - type: string - description: The format of output audio. - input_audio_transcription: - type: object - description: Configuration for input audio transcription. - properties: - enabled: - type: boolean - description: Whether input audio transcription is enabled. - model: - type: string - description: The model used for transcription. - turn_detection: - type: object - description: Configuration for turn detection. - properties: - type: - type: string - description: The type of turn detection ("server_vad" or "none"). - threshold: - type: number - description: Activation threshold for VAD. - prefix_padding_ms: - type: integer - description: Audio included before speech starts (in milliseconds). - silence_duration_ms: - type: integer - description: Duration of silence to detect speech stop (in milliseconds). - tools: - type: array - description: Tools (functions) available to the model. - items: - type: object - properties: - type: - type: string - description: The type of the tool. - name: - type: string - description: The name of the function. - description: - type: string - description: The description of the function. - parameters: - type: object - description: Parameters of the function in JSON Schema. - tool_choice: - type: string - description: How the model chooses tools. - temperature: - type: number - description: Sampling temperature. - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - description: Maximum number of output tokens. + $ref: "#/components/schemas/RealtimeSession" required: - event_id - type @@ -19458,18 +19361,200 @@ components: "input_audio_format": "pcm16", "output_audio_format": "pcm16", "input_audio_transcription": { - "enabled": true, "model": "whisper-1" }, - "turn_detection": { - "type": "none" - }, + "turn_detection": null, "tools": [], "tool_choice": "none", "temperature": 0.7, - "max_output_tokens": 200 + "max_response_output_tokens": 200 } } + RealtimeSession: + type: object + description: Realtime session object configuration. + properties: + modalities: + type: array + items: + type: string + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + instructions: + type: string + description: > + The default system instructions (i.e. system message) prepended to + model + + calls. This field allows the client to guide the model on desired + + responses. The model can be instructed on response content and + format, + + (e.g. "be extremely succinct", "act friendly", "here are examples of + good + + responses") and on audio behavior (e.g. "talk quickly", "inject + emotion + + into your voice", "laugh frequently"). The instructions are not + guaranteed + + to be followed by the model, but they provide guidance to the model + on the + + desired behavior. + + + Note that the server sets default instructions which will be used if + this + + field is not set and are visible in the `session.created` event at + the + + start of the session. + voice: + type: string + enum: + - alloy + - ash + - ballad + - coral + - echo + - sage + - shimmer + - verse + description: > + The voice the model uses to respond. Supported voices are `alloy`, + `ash`, + + `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. Cannot + be + + changed once the model has responded with audio at least once. + input_audio_format: + type: string + description: > + The format of input audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + output_audio_format: + type: string + description: > + The format of output audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + input_audio_transcription: + type: object + description: > + Configuration for input audio transcription, defaults to off and can + be + + set to `null` to turn off once on. Input audio transcription is not + native + + to the model, since the model consumes audio directly. Transcription + runs + + asynchronously through Whisper and should be treated as rough + guidance + + rather than the representation understood by the model. + properties: + model: + type: string + description: > + The model to use for transcription, `whisper-1` is the only + currently + + supported model. + turn_detection: + type: object + description: > + Configuration for turn detection. Can be set to `null` to turn off. + Server + + VAD means that the model will detect the start and end of speech + based on + + audio volume and respond at the end of user speech. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A + + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults + + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + description: The type of the tool, i.e. `function`. + name: + type: string + description: The name of the function. + description: + type: string + description: > + The description of the function, including guidance on when + and how + + to call it, and guidance about what to tell the user when + calling + + (if anything). + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: + type: string + description: > + How the model chooses tools. Options are `auto`, `none`, `required`, + or + + specify a function. + temperature: + type: number + description: > + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults + to 0.8. + max_response_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. ResponseFormatJsonObject: type: object properties: @@ -22030,7 +22115,7 @@ x-oaiMeta: API keys cannot be used for non-administration endpoints. For best practices on setting up your organization, please refer to this - [guide](/docs/guides/production-best-practices/setting-up-your-organization) + [guide](/docs/guides/production-best-practices#setting-up-your-organization) navigationGroup: administration - id: invite title: Invites @@ -22342,7 +22427,7 @@ x-oaiMeta: Given a prompt, the model will return one or more predicted completions along with the probabilities of alternative tokens at each position. Most developer should use our [Chat Completions - API](/docs/guides/text-generation/text-generation-models) to leverage + API](/docs/guides/text-generation#text-generation-models) to leverage our best and newest models. sections: - type: endpoint From dc7b3801af28fd9e840c5d824cd0f39afbb9ab56 Mon Sep 17 00:00:00 2001 From: Karen Wong Date: Tue, 12 Nov 2024 13:27:33 -0800 Subject: [PATCH 2/7] [Rate Limits API] API Documentation --- openapi.yaml | 323 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 318 insertions(+), 5 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5987cf14..813a8a83 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -965,7 +965,7 @@ paths: Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up - to 50,000 requests, and can be up to 100 MB in size. + to 50,000 requests, and can be up to 200 MB in size. endpoint: type: string enum: @@ -2375,7 +2375,7 @@ paths: [completions](/docs/api-reference/fine-tuning/completions-input) models. - The Batch API only supports `.jsonl` files up to 100 MB in size. The + The Batch API only supports `.jsonl` files up to 200 MB in size. The input also has a specific required [format](/docs/api-reference/batch/request-input). @@ -4664,6 +4664,161 @@ paths: "archived_at": 1711471533, "status": "archived" } + /organization/projects/{project_id}/rate_limits: + get: + summary: Returns the rate limits per model for a project. + operationId: list-project-rate-limits + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: | + A limit on the number of objects to be returned. The default is 100. + required: false + schema: + type: integer + default: 100 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, beginning with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + required: false + schema: + type: string + responses: + "200": + description: Project rate limits listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectRateLimitListResponse" + x-oaiMeta: + name: List project rate limits + group: administration + returns: A list of + [ProjectRateLimit](/docs/api-reference/project-rate-limits/object) + objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: | + { + "object": "list", + "data": [ + { + "object": "project.rate_limit", + "id": "rl-ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + ], + "first_id": "rl-ada", + "last_id": "rl-ada", + "has_more": false + } + error_response: | + { + "code": 404, + "message": "The project {project_id} was not found" + } + /organization/projects/{project_id}/rate_limits/{rate_limit_id}: + post: + summary: Updates a project rate limit. + operationId: update-project-rate-limits + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: rate_limit_id + in: path + description: The ID of the rate limit. + required: true + schema: + type: string + requestBody: + description: The project rate limit update request payload. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectRateLimitUpdateRequest" + responses: + "200": + description: Project rate limit updated successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectRateLimit" + "400": + description: Error response for various conditions. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: Modify project rate limit + group: administration + returns: The updated + [ProjectRateLimit](/docs/api-reference/project-rate-limits/object) + object. + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "max_requests_per_1_minute": 500 + }' + response: | + { + "object": "project.rate_limit", + "id": "rl-ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + error_response: | + { + "code": 404, + "message": "The project {project_id} was not found" + } /organization/projects/{project_id}/service_accounts: get: summary: Returns a list of service accounts in the project. @@ -10288,6 +10443,44 @@ components: id: type: string description: The project ID. + rate_limit.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The rate limit ID + changes_requested: + type: object + description: The payload used to update the rate limits. + properties: + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only relevant for certain models. + max_audio_megabytes_per_1_minute: + type: integer + description: The maximum audio megabytes per minute. Only relevant for certain + models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only relevant for certain models. + batch_1_day_max_input_tokens: + type: integer + description: The maximum batch input tokens per day. Only relevant for certain + models. + rate_limit.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The rate limit ID service_account.created: type: object description: The details for events with this `type`. @@ -10469,6 +10662,8 @@ components: - service_account.created - service_account.updated - service_account.deleted + - rate_limit.updated + - rate_limit.deleted - user.added - user.updated - user.deleted @@ -12021,7 +12216,7 @@ components: x-oaiExpandable: true description: > Configuration for a [Predicted - Output](/docs/guides/latency-optimization#use-predicted-outputs), + Output](/docs/guides/predicted-outputs), which can greatly improve response times when large parts of the model @@ -17322,6 +17517,104 @@ components: - first_id - last_id - has_more + ProjectRateLimit: + type: object + description: Represents a project rate limit config. + properties: + object: + type: string + enum: + - project.rate_limit + description: The object type, which is always `project.rate_limit` + id: + type: string + description: The identifier, which can be referenced in API endpoints. + model: + type: string + description: The model this rate limit applies to. + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only present for relevant models. + max_audio_megabytes_per_1_minute: + type: integer + description: The maximum audio megabytes per minute. Only present for relevant + models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only present for relevant models. + batch_1_day_max_input_tokens: + type: integer + description: The maximum batch input tokens per day. Only present for relevant + models. + required: + - object + - id + - model + - max_requests_per_1_minute + - max_tokens_per_1_minute + x-oaiMeta: + name: The project rate limit object + example: | + { + "object": "project.rate_limit", + "id": "rl_ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + ProjectRateLimitListResponse: + type: object + properties: + object: + type: string + enum: + - list + data: + type: array + items: + $ref: "#/components/schemas/ProjectRateLimit" + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + ProjectRateLimitUpdateRequest: + type: object + properties: + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only relevant for certain models. + max_audio_megabytes_per_1_minute: + type: integer + description: The maximum audio megabytes per minute. Only relevant for certain + models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only relevant for certain models. + batch_1_day_max_input_tokens: + type: integer + description: The maximum batch input tokens per day. Only relevant for certain + models. ProjectServiceAccount: type: object description: Represents an individual service account in a project. @@ -18991,9 +19284,13 @@ components: "input_tokens":127, "output_tokens":148, "input_token_details": { - "cached_tokens":0, + "cached_tokens":384, "text_tokens":119, - "audio_tokens":8 + "audio_tokens":8, + "cached_tokens_details": { + "text_tokens": 128, + "audio_tokens": 256 + } }, "output_token_details": { "text_tokens":36, @@ -22265,6 +22562,22 @@ x-oaiMeta: - type: object key: ProjectApiKey path: object + - id: project-rate-limits + title: Project rate limits + description: > + Manage rate limits per model for projects. Rate limits may be configured + to be equal to or lower than the organization's rate limits. + navigationGroup: administration + sections: + - type: endpoint + key: list-project-rate-limits + path: list + - type: endpoint + key: update-project-rate-limits + path: update + - type: object + key: ProjectRateLimit + path: object - id: audit-logs title: Audit logs description: > From 7d205ffcb1ca09336f5e16f549f33d7730f72b92 Mon Sep 17 00:00:00 2001 From: jzhou-openai Date: Wed, 4 Dec 2024 10:46:12 -0800 Subject: [PATCH 3/7] Usage API and other updates --- openapi.yaml | 3557 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 2635 insertions(+), 922 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 813a8a83..0c01d0ea 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1368,7 +1368,7 @@ paths: -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ - "model": "VAR_model_id", + "model": "VAR_chat_model_id", "messages": [ { "role": "system", @@ -1387,7 +1387,7 @@ paths: completion = client.chat.completions.create( - model="VAR_model_id", + model="VAR_chat_model_id", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"} @@ -1406,7 +1406,7 @@ paths: async function main() { const completion = await openai.chat.completions.create({ messages: [{ role: "system", content: "You are a helpful assistant." }], - model: "VAR_model_id", + model: "VAR_chat_model_id", }); console.log(completion.choices[0]); @@ -1559,7 +1559,7 @@ paths: -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ - "model": "VAR_model_id", + "model": "VAR_chat_model_id", "messages": [ { "role": "system", @@ -1579,7 +1579,7 @@ paths: completion = client.chat.completions.create( - model="VAR_model_id", + model="VAR_chat_model_id", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"} @@ -1599,7 +1599,7 @@ paths: async function main() { const completion = await openai.chat.completions.create({ - model: "VAR_model_id", + model: "VAR_chat_model_id", messages: [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"} @@ -1614,23 +1614,14 @@ paths: main(); - response: > - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} - - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + response: | + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} .... - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} - title: Functions request: curl: > @@ -1704,7 +1695,7 @@ paths: in Boston today?"}] completion = client.chat.completions.create( - model="VAR_model_id", + model="VAR_chat_model_id", messages=messages, tools=tools, tool_choice="auto" @@ -1799,7 +1790,7 @@ paths: -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ - "model": "VAR_model_id", + "model": "VAR_chat_model_id", "messages": [ { "role": "user", @@ -1814,7 +1805,7 @@ paths: client = OpenAI() completion = client.chat.completions.create( - model="VAR_model_id", + model="VAR_chat_model_id", messages=[ {"role": "user", "content": "Hello!"} ], @@ -1832,7 +1823,7 @@ paths: async function main() { const completion = await openai.chat.completions.create({ messages: [{ role: "user", content: "Hello!" }], - model: "VAR_model_id", + model: "VAR_chat_model_id", logprobs: true, top_logprobs: 2, }); @@ -2065,7 +2056,7 @@ paths: -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ - "model": "VAR_model_id", + "model": "VAR_completion_model_id", "prompt": "Say this is a test", "max_tokens": 7, "temperature": 0 @@ -2075,7 +2066,7 @@ paths: client = OpenAI() client.completions.create( - model="VAR_model_id", + model="VAR_completion_model_id", prompt="Say this is a test", max_tokens=7, temperature=0 @@ -2087,7 +2078,7 @@ paths: async function main() { const completion = await openai.completions.create({ - model: "VAR_model_id", + model: "VAR_completion_model_id", prompt: "Say this is a test.", max_tokens: 7, temperature: 0, @@ -2101,7 +2092,7 @@ paths: "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", "object": "text_completion", "created": 1589478378, - "model": "VAR_model_id", + "model": "VAR_completion_model_id", "system_fingerprint": "fp_44709d6fcb", "choices": [ { @@ -2124,7 +2115,7 @@ paths: -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ - "model": "VAR_model_id", + "model": "VAR_completion_model_id", "prompt": "Say this is a test", "max_tokens": 7, "temperature": 0, @@ -2135,7 +2126,7 @@ paths: client = OpenAI() for chunk in client.completions.create( - model="VAR_model_id", + model="VAR_completion_model_id", prompt="Say this is a test", max_tokens=7, temperature=0, @@ -2149,7 +2140,7 @@ paths: async function main() { const stream = await openai.completions.create({ - model: "VAR_model_id", + model: "VAR_completion_model_id", prompt: "Say this is a test.", stream: true, }); @@ -2924,10 +2915,8 @@ paths: the given ID. examples: request: - curl: > - curl - https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F - \ + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \ -H "Authorization: Bearer $OPENAI_API_KEY" python: | from openai import OpenAI @@ -3088,10 +3077,8 @@ paths: fine-tuning job. examples: request: - curl: > - curl - https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints - \ + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints \ -H "Authorization: Bearer $OPENAI_API_KEY" response: > { @@ -3527,20 +3514,20 @@ paths: examples: request: curl: | - curl https://api.openai.com/v1/models/VAR_model_id \ + curl https://api.openai.com/v1/models/VAR_chat_model_id \ -H "Authorization: Bearer $OPENAI_API_KEY" python: | from openai import OpenAI client = OpenAI() - client.models.retrieve("VAR_model_id") + client.models.retrieve("VAR_chat_model_id") node.js: |- import OpenAI from "openai"; const openai = new OpenAI(); async function main() { - const model = await openai.models.retrieve("VAR_model_id"); + const model = await openai.models.retrieve("VAR_chat_model_id"); console.log(model); } @@ -3548,7 +3535,7 @@ paths: main(); response: | { - "id": "VAR_model_id", + "id": "VAR_chat_model_id", "object": "model", "created": 1686935002, "owned_by": "openai" @@ -3580,10 +3567,8 @@ paths: returns: Deletion status. examples: request: - curl: > - curl - https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 - \ + curl: | + curl https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 \ -X DELETE \ -H "Authorization: Bearer $OPENAI_API_KEY" python: | @@ -3978,7 +3963,7 @@ paths: curl: | curl https://api.openai.com/v1/organization/audit_logs \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" \ + -H "Content-Type: application/json" response: > { "object": "list", @@ -4028,6 +4013,112 @@ paths: "last_id": "audit_log_yyy__20240101", "has_more": true } + /organization/costs: + get: + summary: Get costs details for the organization. + operationId: usage-costs + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently only `1d` is + supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1d + default: 1d + - name: project_ids + in: query + description: Return only costs for these projects. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the costs by the specified fields. Support fields include + `project_id`, `line_item` and any combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - line_item + - name: limit + in: query + description: > + A limit on the number of buckets to be returned. Limit can range + between 1 and 180, and the default is 7. + required: false + schema: + type: integer + default: 7 + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Costs data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Costs + group: usage-costs + returns: A list of paginated, time bucketed + [Costs](/docs/api-reference/usage/costs_object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": null, + "project_id": null + } + ] + } + ], + "has_more": false, + "next_page": null + } /organization/invites: get: summary: Returns a list of invites in the organization. @@ -4067,10 +4158,8 @@ paths: returns: A list of [Invite](/docs/api-reference/invite/object) objects. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 - \ + curl: | + curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4265,10 +4354,8 @@ paths: returns: A list of [Project](/docs/api-reference/projects/object) objects. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false - \ + curl: | + curl https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4466,10 +4553,8 @@ paths: objects. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 - \ + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4539,10 +4624,8 @@ paths: matching the specified ID. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc - \ + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4603,10 +4686,8 @@ paths: service account examples: request: - curl: > - curl -X DELETE - https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc - \ + curl: | + curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4721,10 +4802,8 @@ paths: objects. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 - \ + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: | @@ -4796,10 +4875,8 @@ paths: object. examples: request: - curl: > - curl -X POST - https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx - \ + curl: | + curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ @@ -4872,10 +4949,8 @@ paths: objects. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 - \ + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4936,10 +5011,8 @@ paths: object. examples: request: - curl: > - curl -X POST - https://api.openai.com/v1/organization/projects/proj_abc/service_accounts - \ + curl: | + curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ @@ -4995,10 +5068,8 @@ paths: object matching the specified ID. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc - \ + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5042,10 +5113,8 @@ paths: an archived project, which has no service accounts examples: request: - curl: > - curl -X DELETE - https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc - \ + curl: | + curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5107,10 +5176,8 @@ paths: objects. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 - \ + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5234,10 +5301,8 @@ paths: matching the specified ID. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc - \ + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5295,10 +5360,8 @@ paths: object. examples: request: - curl: > - curl -X POST - https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc - \ + curl: | + curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ @@ -5352,10 +5415,8 @@ paths: archived project, which has no users examples: request: - curl: > - curl -X DELETE - https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc - \ + curl: | + curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5365,86 +5426,1155 @@ paths: "id": "user_abc", "deleted": true } - /organization/users: + /organization/usage/audio_speeches: get: - summary: Lists all of the users in the organization. - operationId: list-users + summary: Get audio speeches usage details for the organization. + operationId: usage-audio-speeches tags: - - Users + - Usage parameters: - - name: limit + - name: start_time in: query - description: > - A limit on the number of objects to be returned. Limit can range - between 1 and 100, and the default is 20. + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - default: 20 - - name: after + - name: bucket_width in: query - description: > - A cursor for use in pagination. `after` is an object ID that defines - your place in the list. For instance, if you make a list request and - receive 100 objects, ending with obj_foo, your subsequent call can - include after=obj_foo in order to fetch the next page of the list. + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`, `user_id`, `api_key_id`, `model` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. schema: type: string responses: "200": - description: Users listed successfully. + description: Usage data retrieved successfully. content: application/json: schema: - $ref: "#/components/schemas/UserListResponse" + $ref: "#/components/schemas/UsageResponse" x-oaiMeta: - name: List users - group: administration - returns: A list of [User](/docs/api-reference/users/object) objects. + name: Audio speeches + group: usage-audio-speeches + returns: A list of paginated, time bucketed [Audio speeches + usage](/docs/api-reference/usage/audio_speeches_object) objects. examples: request: - curl: > - curl - https://api.openai.com/v1/organization/users?after=user_abc&limit=20 - \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" - response: - content: | - { - "object": "list", - "data": [ - { - "object": "organization.user", - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "added_at": 1711471533 - } - ], - "first_id": "user-abc", - "last_id": "user-xyz", - "has_more": false - } - /organization/users/{user_id}: + curl: | + curl "https://api.openai.com/v1/organization/usage/audio_speeches?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: > + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.audio_speeches.result", + "characters": 45, + "num_model_requests": 1, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/audio_transcriptions: get: - summary: Retrieves a user by their identifier. - operationId: retrieve-user + summary: Get audio transcriptions usage details for the organization. + operationId: usage-audio-transcriptions tags: - - Users + - Usage parameters: - - name: user_id - in: path - description: The ID of the user. + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false schema: type: string - responses: - "200": - description: User retrieved successfully. - content: + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`, `user_id`, `api_key_id`, `model` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Audio transcriptions + group: usage-audio-transcriptions + returns: A list of paginated, time bucketed [Audio transcriptions + usage](/docs/api-reference/usage/audio_transcriptions_object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/usage/audio_transcriptions?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: > + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.audio_transcriptions.result", + "seconds": 20, + "num_model_requests": 1, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/code_interpreter_sessions: + get: + summary: Get code interpreter sessions usage details for the organization. + operationId: usage-code-interpreter-sessions + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Code interpreter sessions + group: usage-code-interpreter-sessions + returns: A list of paginated, time bucketed [Code interpreter sessions + usage](/docs/api-reference/usage/code_interpreter_sessions_object) + objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: > + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.code_interpreter_sessions.result", + "sessions": 1, + "project_id": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/completions: + get: + summary: Get completions usage details for the organization. + operationId: usage-completions + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - name: batch + in: query + description: > + If `true`, return batch jobs only. If `false`, return non-batch jobs + only. By default, return both. + required: false + schema: + type: boolean + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`, `user_id`, `api_key_id`, `model`, `batch` or + any combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - batch + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Completions + group: usage-completions + returns: A list of paginated, time bucketed [Completions + usage](/docs/api-reference/usage/completions_object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: > + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.completions.result", + "input_tokens": 1000, + "output_tokens": 500, + "input_cached_tokens": 800, + "num_model_requests": 5, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null, + "batch": null + } + ] + } + ], + "has_more": true, + "next_page": "AAAAAGdGxdEiJdKOAAAAAGcqsYA=" + } + /organization/usage/embeddings: + get: + summary: Get embeddings usage details for the organization. + operationId: usage-embeddings + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`, `user_id`, `api_key_id`, `model` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Embeddings + group: usage-embeddings + returns: A list of paginated, time bucketed [Embeddings + usage](/docs/api-reference/usage/embeddings_object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/usage/embeddings?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: > + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.embeddings.result", + "input_tokens": 16, + "num_model_requests": 2, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/images: + get: + summary: Get images usage details for the organization. + operationId: usage-images + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: sources + in: query + description: Return only usages for these sources. Possible values are + `image.generation`, `image.edit`, `image.variation` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - image.generation + - image.edit + - image.variation + - name: sizes + in: query + description: Return only usages for these image sizes. Possible values are + `256x256`, `512x512`, `1024x1024`, `1792x1792`, `1024x1792` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + - 1792x1792 + - 1024x1792 + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`, `user_id`, `api_key_id`, `model`, `size`, + `source` or any combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - size + - source + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Images + group: usage-images + returns: A list of paginated, time bucketed [Images + usage](/docs/api-reference/usage/images_object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: | + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.images.result", + "images": 2, + "num_model_requests": 2, + "size": null, + "source": null, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/moderations: + get: + summary: Get moderations usage details for the organization. + operationId: usage-moderations + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: user_ids + in: query + description: Return only usage for these users. + required: false + schema: + type: array + items: + type: string + - name: api_key_ids + in: query + description: Return only usage for these API keys. + required: false + schema: + type: array + items: + type: string + - name: models + in: query + description: Return only usage for these models. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`, `user_id`, `api_key_id`, `model` or any + combination of them. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Moderations + group: usage-moderations + returns: A list of paginated, time bucketed [Moderations + usage](/docs/api-reference/usage/moderations_object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: > + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.moderations.result", + "input_tokens": 16, + "num_model_requests": 2, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/usage/vector_stores: + get: + summary: Get vector stores usage details for the organization. + operationId: usage-vector-stores + tags: + - Usage + parameters: + - name: start_time + in: query + description: Start time (Unix seconds) of the query time range, inclusive. + required: true + schema: + type: integer + - name: end_time + in: query + description: End time (Unix seconds) of the query time range, exclusive. + required: false + schema: + type: integer + - name: bucket_width + in: query + description: Width of each time bucket in response. Currently `1m`, `1h` and + `1d` are supported, default to `1d`. + required: false + schema: + type: string + enum: + - 1m + - 1h + - 1d + default: 1d + - name: project_ids + in: query + description: Return only usage for these projects. + required: false + schema: + type: array + items: + type: string + - name: group_by + in: query + description: Group the usage data by the specified fields. Support fields + include `project_id`. + required: false + schema: + type: array + items: + type: string + enum: + - project_id + - name: limit + in: query + description: | + Specifies the number of buckets to return. + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + required: false + schema: + type: integer + - name: page + in: query + description: A cursor for use in pagination. Corresponding to the `next_page` + field from the previous response. + schema: + type: string + responses: + "200": + description: Usage data retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + x-oaiMeta: + name: Vector stores + group: usage-vector-stores + returns: A list of paginated, time bucketed [Vector stores + usage](/docs/api-reference/usage/vector_stores_object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730419200&limit=1" \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: > + { + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "orgainzation.usage.vector_stores.result", + "usage_bytes": 1024, + "project_id": null + } + ] + } + ], + "has_more": false, + "next_page": null + } + /organization/users: + get: + summary: Lists all of the users in the organization. + operationId: list-users + tags: + - Users + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + "200": + description: Users listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UserListResponse" + x-oaiMeta: + name: List users + group: administration + returns: A list of [User](/docs/api-reference/users/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/users?after=user_abc&limit=20 \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "list", + "data": [ + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + ], + "first_id": "user-abc", + "last_id": "user-xyz", + "has_more": false + } + /organization/users/{user_id}: + get: + summary: Retrieves a user by their identifier. + operationId: retrieve-user + tags: + - Users + parameters: + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + "200": + description: User retrieved successfully. + content: application/json: schema: $ref: "#/components/schemas/User" @@ -5849,99 +6979,52 @@ paths: } main(); - response: > + response: | event: thread.created - - data: - {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} - + data: {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} event: thread.run.created - - data: - {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} - + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} event: thread.run.queued - - data: - {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} - + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} event: thread.run.in_progress - - data: - {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} - + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} event: thread.run.step.created - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} event: thread.run.step.in_progress - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} event: thread.message.created - - data: - {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], - "metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{}} event: thread.message.in_progress - - data: - {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], - "metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{}} event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} ... - event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" - today"}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} event: thread.message.completed - - data: - {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! - How can I assist you today?","annotations":[]}}], "metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}], "metadata":{}} event: thread.run.step.completed - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} event: thread.run.completed - {"id":"run_123","object":"thread.run","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1713226836,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1713226837,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} - event: done - data: [DONE] - title: Streaming with Functions request: @@ -6072,102 +7155,46 @@ paths: main(); - response: > + response: | event: thread.created - - data: - {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} - + data: {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} event: thread.run.created - - data: - {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get - the current weather in a given - location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The - city and state, e.g. San Francisco, - CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.queued - - data: - {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get - the current weather in a given - location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The - city and state, e.g. San Francisco, - CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - - data: - {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get - the current weather in a given - location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The - city and state, e.g. San Francisco, - CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} event: thread.run.step.in_progress - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} event: thread.run.step.delta - - data: - {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"","output":null}}]}}} - + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"","output":null}}]}}} event: thread.run.step.delta - - data: - {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} - + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} event: thread.run.step.delta - - data: - {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} - + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} ... - event: thread.run.step.delta - - data: - {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} - + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} event: thread.run.step.delta - - data: - {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} - + data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} event: thread.run.requires_action - - data: - {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San - Francisco, - CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get - the current weather in a given - location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The - city and state, e.g. San Francisco, - CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done - data: [DONE] /threads/{thread_id}: get: @@ -6650,10 +7677,8 @@ paths: specified ID. examples: request: - curl: > - curl - https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 - \ + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" @@ -6740,10 +7765,8 @@ paths: returns: The modified [message](/docs/api-reference/messages/object) object. examples: request: - curl: > - curl - https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 - \ + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" \ @@ -6838,10 +7861,8 @@ paths: returns: Deletion status examples: request: - curl: > - curl -X DELETE - https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 - \ + curl: | + curl -X DELETE https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" @@ -7084,16 +8105,10 @@ paths: description: The ID of the thread to run. - name: include[] in: query - description: > - A list of additional fields to include in the response. Currently - the only supported value is - `step_details.tool_calls[*].file_search.results[*].content` to fetch - the file search result content. - + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. - See the [file search tool - documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) - for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. schema: type: array items: @@ -7230,92 +8245,49 @@ paths: } main(); - response: > + response: | event: thread.run.created - - data: - {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.queued - - data: - {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - - data: - {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} event: thread.run.step.in_progress - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} event: thread.message.created - - data: - {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} event: thread.message.in_progress - - data: - {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} ... - event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" - today"}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} event: thread.message.completed - - data: - {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710330642,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! - How can I assist you today?","annotations":[]}}],"metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710330642,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}],"metadata":{}} event: thread.run.step.completed - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710330642,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710330642,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} event: thread.run.completed - - data: - {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done - data: [DONE] - title: Streaming with Functions request: @@ -7435,92 +8407,49 @@ paths: main(); - response: > + response: | event: thread.run.created - - data: - {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.queued - - data: - {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - - data: - {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} event: thread.run.step.in_progress - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} event: thread.message.created - - data: - {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} event: thread.message.in_progress - - data: - {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} ... - event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" - today"}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} event: thread.message.delta - - data: - {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} - + data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} event: thread.message.completed - - data: - {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! - How can I assist you today?","annotations":[]}}],"metadata":{}} - + data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}],"metadata":{}} event: thread.run.step.completed - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} event: thread.run.completed - - data: - {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done - data: [DONE] /threads/{thread_id}/runs/{run_id}: get: @@ -7791,10 +8720,8 @@ paths: specified ID. examples: request: - curl: > - curl - https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel - \ + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" \ -X POST @@ -7917,16 +8844,10 @@ paths: type: string - name: include[] in: query - description: > - A list of additional fields to include in the response. Currently - the only supported value is - `step_details.tool_calls[*].file_search.results[*].content` to fetch - the file search result content. - + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. - See the [file search tool - documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) - for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. schema: type: array items: @@ -7948,10 +8869,8 @@ paths: objects. examples: request: - curl: > - curl - https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps - \ + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -8040,16 +8959,10 @@ paths: description: The ID of the run step to retrieve. - name: include[] in: query - description: > - A list of additional fields to include in the response. Currently - the only supported value is - `step_details.tool_calls[*].file_search.results[*].content` to fetch - the file search result content. - + description: | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. - See the [file search tool - documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) - for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. schema: type: array items: @@ -8071,10 +8984,8 @@ paths: matching the specified ID. examples: request: - curl: > - curl - https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 - \ + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -8176,10 +9087,8 @@ paths: examples: - title: Default request: - curl: > - curl - https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs - \ + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -8285,10 +9194,8 @@ paths: } - title: Streaming request: - curl: > - curl - https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs - \ + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -8347,121 +9254,55 @@ paths: main(); - response: > + response: | event: thread.run.step.completed - - data: - {"id":"step_001","object":"thread.run.step","created_at":1710352449,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"completed","cancelled_at":null,"completed_at":1710352475,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[{"id":"call_iWr0kQ2EaYMaxNdl0v3KYkx7","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San - Francisco, CA\",\"unit\":\"fahrenheit\"}","output":"70 degrees and - sunny."}}]},"usage":{"prompt_tokens":291,"completion_tokens":24,"total_tokens":315}} - + data: {"id":"step_001","object":"thread.run.step","created_at":1710352449,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"completed","cancelled_at":null,"completed_at":1710352475,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[{"id":"call_iWr0kQ2EaYMaxNdl0v3KYkx7","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}","output":"70 degrees and sunny."}}]},"usage":{"prompt_tokens":291,"completion_tokens":24,"total_tokens":315}} event: thread.run.queued - - data: - {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get - the current weather in a given - location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The - city and state, e.g. San Francisco, - CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - - data: - {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get - the current weather in a given - location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The - city and state, e.g. San Francisco, - CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created - - data: - {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} - + data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} event: thread.run.step.in_progress - - data: - {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} - + data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} event: thread.message.created - - data: - {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} - + data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} event: thread.message.in_progress - - data: - {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} - + data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} event: thread.message.delta - - data: - {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} - + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} event: thread.message.delta - - data: - {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" - current"}}]}} - + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" current"}}]}} event: thread.message.delta - - data: - {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" - weather"}}]}} - + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" weather"}}]}} ... - event: thread.message.delta - - data: - {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" - sunny"}}]}} - + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" sunny"}}]}} event: thread.message.delta - - data: - {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} - + data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} event: thread.message.completed - - data: - {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710352477,"role":"assistant","content":[{"type":"text","text":{"value":"The - current weather in San Francisco, CA is 70 degrees Fahrenheit and - sunny.","annotations":[]}}],"metadata":{}} - + data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710352477,"role":"assistant","content":[{"type":"text","text":{"value":"The current weather in San Francisco, CA is 70 degrees Fahrenheit and sunny.","annotations":[]}}],"metadata":{}} event: thread.run.step.completed - - data: - {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710352477,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":{"prompt_tokens":329,"completion_tokens":18,"total_tokens":347}} - + data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710352477,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":{"prompt_tokens":329,"completion_tokens":18,"total_tokens":347}} event: thread.run.completed - - data: - {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get - the current weather in a given - location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The - city and state, e.g. San Francisco, - CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} - + data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done - data: [DONE] /uploads: post: @@ -9218,10 +10059,8 @@ paths: object. examples: request: - curl: > - curl - https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123 - \ + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123 \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -9303,10 +10142,8 @@ paths: returns: The modified vector store file batch object. examples: request: - curl: > - curl - https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel - \ + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -9439,10 +10276,8 @@ paths: file](/docs/api-reference/vector-stores-files/file-object) objects. examples: request: - curl: > - curl - https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files - \ + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -9741,10 +10576,8 @@ paths: file](/docs/api-reference/vector-stores-files/file-object) object. examples: request: - curl: > - curl - https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 - \ + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -9816,10 +10649,8 @@ paths: returns: Deletion status examples: request: - curl: > - curl - https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 - \ + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -10115,17 +10946,10 @@ components: type: integer minimum: 1 maximum: 50 - description: > - The maximum number of results the file search tool should - output. The default is 20 for `gpt-4*` models and 5 for - `gpt-3.5-turbo`. This number should be between 1 and 50 - inclusive. - + description: | + The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - Note that the file search tool may output fewer than - `max_num_results` results. See the [file search tool - documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) - for more information. + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. ranking_options: $ref: "#/components/schemas/FileSearchRankingOptions" required: @@ -11668,6 +12492,47 @@ components: - prompt_tokens - completion_tokens - total_tokens + CostsResult: + type: object + description: The aggregated costs details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.costs.result + amount: + type: object + description: null + properties: + value: + type: float + description: The numeric value of the cost. + currency: + type: string + description: Lowercase ISO-4217 currency e.g. "usd" + line_item: + type: string + description: When `group_by=line_item`, this field provides the line item of the + grouped costs result. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped costs result. + required: + - object + - sessions + x-oaiMeta: + name: Costs object + example: | + { + "object": "orgainzation.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": "Image models", + "project_id": "proj_abc" + } CreateAssistantRequest: type: object additionalProperties: false @@ -11684,9 +12549,9 @@ components: - type: string enum: - gpt-4o + - gpt-4o-2024-11-20 - gpt-4o-2024-08-06 - gpt-4o-2024-05-13 - - gpt-4o-2024-08-06 - gpt-4o-mini - gpt-4o-mini-2024-07-18 - gpt-4-turbo @@ -12082,9 +12947,9 @@ components: - o1-mini - o1-mini-2024-09-12 - gpt-4o + - gpt-4o-2024-11-20 - gpt-4o-2024-08-06 - gpt-4o-2024-05-13 - - gpt-4o-2024-08-06 - gpt-4o-realtime-preview - gpt-4o-realtime-preview-2024-10-01 - gpt-4o-audio-preview @@ -12251,11 +13116,10 @@ components: - shimmer - verse description: > - The voice the model uses to respond. Supported voices are - `alloy`, - - `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and - `verse`. + The voice the model uses to respond. Supported voices are `ash`, + `ballad`, `coral`, `sage`, and `verse` (also supported but not + recommended are `alloy`, `echo`, and `shimmer`; these voices are + less expressive). format: type: string enum: @@ -12362,13 +13226,8 @@ components: items: type: string stream: - description: > - If set, partial message deltas will be sent, like in ChatGPT. Tokens - will be sent as data-only [server-sent - events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - as they become available, with the stream terminated by a `data: - [DONE]` message. [Example Python - code](https://cookbook.openai.com/examples/how_to_stream_completions). + description: | + If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). type: boolean nullable: true default: false @@ -12743,23 +13602,14 @@ components: x-oaiMeta: name: The chat completion chunk object group: chat - example: > - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} - - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + example: | + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} .... - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} CreateCompletionRequest: type: object properties: @@ -12895,15 +13745,10 @@ components: default: 16 example: 16 nullable: true - description: > - The maximum number of [tokens](/tokenizer) that can be generated in - the completion. - + description: | + The maximum number of [tokens](/tokenizer) that can be generated in the completion. - The token count of your prompt plus `max_tokens` cannot exceed the - model's context length. [Example Python - code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - for counting tokens. + The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. n: type: integer minimum: 1 @@ -12964,13 +13809,8 @@ components: type: string example: '["\n"]' stream: - description: > - Whether to stream back partial progress. If set, tokens will be sent - as data-only [server-sent - events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - as they become available, with the stream terminated by a `data: - [DONE]` message. [Example Python - code](https://cookbook.openai.com/examples/how_to_stream_completions). + description: | + Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). type: boolean nullable: true default: false @@ -13145,15 +13985,8 @@ components: additionalProperties: false properties: input: - description: > - Input text to embed, encoded as a string or array of tokens. To - embed multiple inputs in a single request, pass an array of strings - or array of token arrays. The input must not exceed the max input - tokens for the model (8192 tokens for `text-embedding-ada-002`), - cannot be an empty string, and any array must be 2048 dimensions or - less. [Example Python - code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - for counting tokens. + description: | + Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. example: The quick brown fox jumped over the lazy dog oneOf: - type: string @@ -14264,9 +15097,9 @@ components: - type: string enum: - gpt-4o + - gpt-4o-2024-11-20 - gpt-4o-2024-08-06 - gpt-4o-2024-05-13 - - gpt-4o-2024-08-06 - gpt-4o-mini - gpt-4o-mini-2024-07-18 - gpt-4-turbo @@ -14474,9 +15307,9 @@ components: - type: string enum: - gpt-4o + - gpt-4o-2024-11-20 - gpt-4o-2024-08-06 - gpt-4o-2024-05-13 - - gpt-4o-2024-08-06 - gpt-4o-mini - gpt-4o-mini-2024-07-18 - gpt-4-turbo @@ -15293,14 +16126,10 @@ components: FileSearchRankingOptions: title: File search tool call ranking options type: object - description: > - The ranking options for the file search. If not specified, the file - search tool will use the `auto` ranker and a score_threshold of 0. - + description: | + The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - See the [file search tool - documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) - for more information. + See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. properties: ranker: type: string @@ -17013,7 +17842,7 @@ components: name: The model object example: | { - "id": "VAR_model_id", + "id": "VAR_chat_model_id", "object": "model", "created": 1686935002, "owned_by": "openai" @@ -17870,30 +18699,46 @@ components: - role RealtimeClientEventConversationItemCreate: type: object - description: >- + description: > Add a new Item to the Conversation's context, including messages, - function calls, and function call responses. This event can be used both - to populate a "history" of the conversation and to add new items - mid-stream, but has the current limitation that it cannot populate - assistant audio messages. + function + + calls, and function call responses. This event can be used both to + populate a + + "history" of the conversation and to add new items mid-stream, but has + the + + current limitation that it cannot populate assistant audio messages. + If successful, the server will respond with a - `conversation.item.created` event, otherwise an `error` event will be - sent. + `conversation.item.created` + + event, otherwise an `error` event will be sent. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string + enum: + - conversation.item.create description: The event type, must be `conversation.item.create`. previous_item_id: type: string - description: The ID of the preceding item after which the new item will be - inserted. If not set, the new item will be appended to the end of - the conversation. If set, it allows an item to be inserted - mid-conversation. If the ID cannot be found, an error will be - returned and the item will not be added. + description: > + The ID of the preceding item after which the new item will be + inserted. + + If not set, the new item will be appended to the end of the + conversation. + + If set, it allows an item to be inserted mid-conversation. If the + ID + + cannot be found, an error will be returned and the item will not be + added. item: $ref: "#/components/schemas/RealtimeConversationItem" required: @@ -17921,18 +18766,25 @@ components: } RealtimeClientEventConversationItemDelete: type: object - description: Send this event when you want to remove any item from the - conversation history. The server will respond with a - `conversation.item.deleted` event, unless the item does not exist in the - conversation history, in which case the server will respond with an - error. + description: > + Send this event when you want to remove any item from the conversation + + history. The server will respond with a `conversation.item.deleted` + event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string - description: The event type, must be "conversation.item.delete". + enum: + - conversation.item.delete + description: The event type, must be `conversation.item.delete`. item_id: type: string description: The ID of the item to delete. @@ -17950,37 +18802,61 @@ components: } RealtimeClientEventConversationItemTruncate: type: object - description: >- + description: > Send this event to truncate a previous assistant message’s audio. The - server will produce audio faster than realtime, so this event is useful - when the user interrupts to truncate audio that has already been sent to - the client but not yet played. This will synchronize the server's - understanding of the audio with the client's playback. + server + + will produce audio faster than realtime, so this event is useful when + the user + + interrupts to truncate audio that has already been sent to the client + but not + + yet played. This will synchronize the server's understanding of the + audio with + + the client's playback. + Truncating audio will delete the server-side text transcript to ensure - there is not text in the context that hasn't been heard by the user. + there + + is not text in the context that hasn't been heard by the user. + If successful, the server will respond with a - `conversation.item.truncated` event. + `conversation.item.truncated` + + event. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string - description: The event type, must be "conversation.item.truncate". + enum: + - conversation.item.truncate + description: The event type, must be `conversation.item.truncate`. item_id: type: string - description: The ID of the assistant message item to truncate. Only assistant - message items can be truncated. + 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. + 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 @@ -17999,28 +18875,48 @@ components: } RealtimeClientEventInputAudioBufferAppend: type: object - description: >- + 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. + 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. + 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 - description: The event type, must be "input_audio_buffer.append". + enum: + - input_audio_buffer.append + description: The event type, must be `input_audio_buffer.append`. 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. + 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 @@ -18035,15 +18931,18 @@ components: } 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. + 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 - description: The event type, must be "input_audio_buffer.clear". + enum: + - input_audio_buffer.clear + description: The event type, must be `input_audio_buffer.clear`. required: - type x-oaiMeta: @@ -18056,24 +18955,40 @@ components: } RealtimeClientEventInputAudioBufferCommit: type: object - description: >- + description: > Send this event to commit the user input audio buffer, which will create - a new user message item in the conversation. This event will produce an - error if the input audio buffer is empty. When in Server VAD mode, the - client does not need to send this event, the server will commit the - audio buffer automatically. + a + + new user message item in the conversation. This event will produce an + error + + if the input audio buffer is empty. When in Server VAD mode, the client + does + + not need to send this event, the server will commit the audio buffer + + automatically. + + + Committing the input audio buffer will trigger input audio + transcription + + (if enabled in session configuration), but it will not create a + response - Committing the input audio buffer will trigger input audio transcription - (if enabled in session configuration), but it will not create a response from the model. The server will respond with an - `input_audio_buffer.committed` event. + `input_audio_buffer.committed` + + event. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string - description: The event type, must be "input_audio_buffer.commit". + enum: + - input_audio_buffer.commit + description: The event type, must be `input_audio_buffer.commit`. required: - type x-oaiMeta: @@ -18086,15 +19001,22 @@ components: } RealtimeClientEventResponseCancel: type: object - description: Send this event to cancel an in-progress response. The server will - respond with a `response.cancelled` event or an error if there is no - response to cancel. + description: > + Send this event to cancel an in-progress response. The server will + respond + + with a `response.cancelled` event or an error if there is no response + to + + cancel. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string + enum: + - response.cancel description: The event type, must be `response.cancel`. required: - type @@ -18108,31 +19030,50 @@ components: } RealtimeClientEventResponseCreate: type: object - description: >- + description: > This event instructs the server to create a Response, which means - triggering model inference. When in Server VAD mode, the server will - create Responses automatically. + triggering + + model inference. When in Server VAD mode, the server will create + Responses + + automatically. + A Response will include at least one Item, and may have two, in which - case the second will be a function call. These Items will be appended to - the conversation history. + case + + the second will be a function call. These Items will be appended to the + + conversation history. + The server will respond with a `response.created` event, events for - Items and content created, and finally a `response.done` event to - indicate the Response is complete. + Items + + and content created, and finally a `response.done` event to indicate + the + + Response is complete. + + + The `response.create` event includes inference configuration like - The `response.create` event includes inference configuration like `instructions`, and `temperature`. These fields will override the - Session's configuration for this Response only. + Session's + + configuration for this Response only. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string + enum: + - response.create description: The event type, must be `response.create`. response: - $ref: "#/components/schemas/RealtimeResponse" + $ref: "#/components/schemas/RealtimeSession" required: - type - response @@ -18146,7 +19087,7 @@ components: "response": { "modalities": ["text", "audio"], "instructions": "Please assist the user.", - "voice": "alloy", + "voice": "sage", "output_audio_format": "pcm16", "tools": [ { @@ -18170,20 +19111,32 @@ components: } RealtimeClientEventSessionUpdate: type: object - description: Send this event to update the session’s default configuration. The - client may send this event at any time to update the session - configuration, and any field may be updated at any time, except for - "voice". The server will respond with a `session.updated` event that - shows the full effective configuration. Only fields that are present are - updated, thus the correct way to clear a field like "instructions" is to - pass an empty string. + description: > + Send this event to update the session’s default configuration. The + client may + + send this event at any time to update the session configuration, and + any + + field may be updated at any time, except for "voice". The server will + respond + + with a `session.updated` event that shows the full effective + configuration. + + Only fields that are present are updated, thus the correct way to clear + a + + field like "instructions" is to pass an empty string. properties: event_id: type: string description: Optional client-generated ID used to identify this event. type: type: string - description: The event type, must be "session.update". + enum: + - session.update + description: The event type, must be `session.update`. session: $ref: "#/components/schemas/RealtimeSession" required: @@ -18192,14 +19145,14 @@ components: x-oaiMeta: name: session.update group: realtime - example: > + example: | { "event_id": "event_123", "type": "session.update", "session": { "modalities": ["text", "audio"], - "instructions": "Your knowledge cutoff is 2023-10. You are a helpful assistant.", - "voice": "alloy", + "instructions": "You are a helpful assistant.", + "voice": "sage", "input_audio_format": "pcm16", "output_audio_format": "pcm16", "input_audio_transcription": { @@ -18215,7 +19168,7 @@ components: { "type": "function", "name": "get_weather", - "description": "Get the current weather for a location, tell the user you are fetching the weather.", + "description": "Get the current weather...", "parameters": { "type": "object", "properties": { @@ -18232,63 +19185,120 @@ components: } RealtimeConversationItem: type: object + x-oaiExpandable: true description: The item to add to the conversation. properties: id: type: string - description: The unique ID of the item, this can be generated by the client to - help manage server-side context, but is not required because the - server will generate one if not provided. + description: > + The unique ID of the item, this can be generated by the client to + help + + manage server-side context, but is not required because the server + will + + generate one if not provided. type: type: string - description: The type of the item (`message`, `function_call`, + enum: + - message + - function_call + - function_call_output + description: > + The type of the item (`message`, `function_call`, `function_call_output`). + object: + type: string + enum: + - realtime.item + description: > + Identifier for the API object being returned - always + `realtime.item`. status: type: string - description: The status of the item (`completed`, `incomplete`). These have no - effect on the conversation, but are accepted for consistency with - the `conversation.item.created` event. + enum: + - completed + - incomplete + description: > + The status of the item (`completed`, `incomplete`). These have no + effect + + on the conversation, but are accepted for consistency with the + + `conversation.item.created` event. role: type: string - description: The role of the message sender (`user`, `assistant`, `system`), - only applicable for `message` items. + enum: + - user + - assistant + - systems + description: > + The role of the message sender (`user`, `assistant`, `system`), + only + + applicable for `message` items. content: type: array - description: The content of the message, applicable for `message` items. Message - items with a role of `system` support only `input_text` content, - message items of role `user` support `input_text` and `input_audio` - content, and message items of role `assistant` support `text` - content. + x-oaiExpandable: true + description: > + The content of the message, applicable for `message` items. + + - Message items of role `system` support only `input_text` content + + - Message items of role `user` support `input_text` and + `input_audio` + content + - Message items of role `assistant` support `text` content. items: type: object + x-oaiExpandable: true properties: type: type: string + enum: + - input_audio + - input_text + - text description: The content type (`input_text`, `input_audio`, `text`). text: type: string - description: The text content, used for `input_text` and `text` content types. + description: > + The text content, used for `input_text` and `text` content + types. audio: type: string - description: Base64-encoded audio bytes, used for `input_audio` content type. + description: > + Base64-encoded audio bytes, used for `input_audio` content + type. transcript: type: string - description: The transcript of the audio, used for `input_audio` content type. + description: > + The transcript of the audio, used for `input_audio` content + type. call_id: type: string - description: The ID of the function call (for `function_call` and - `function_call_output` items). If passed on a `function_call_output` + description: > + The ID of the function call (for `function_call` and + + `function_call_output` items). If passed on a + `function_call_output` + item, the server will check that a `function_call` item with the - same ID exists in the conversation history. + same + + ID exists in the conversation history. name: type: string - description: The name of the function being called (for `function_call` items). + description: | + The name of the function being called (for `function_call` items). arguments: type: string - description: The arguments of the function call (for `function_call` items). + description: | + The arguments of the function call (for `function_call` items). output: type: string - description: The output of the function call (for `function_call_output` items). + description: | + The output of the function call (for `function_call_output` items). RealtimeResponse: type: object description: The response resource. @@ -18298,30 +19308,62 @@ components: description: The unique ID of the response. object: type: string + enum: + - realtime.response description: The object type, must be `realtime.response`. status: type: string - description: The final status of the response (`completed`, `cancelled`, - `failed`, `incomplete`). + enum: + - completed + - cancelled + - failed + - incomplete + description: > + The final status of the response (`completed`, `cancelled`, + `failed`, or + + `incomplete`). status_details: type: object description: Additional details about the status. properties: type: type: string - description: The type of error that caused the response to fail, corresponding + enum: + - completed + - cancelled + - failed + - incomplete + description: > + The type of error that caused the response to fail, + corresponding + with the `status` field (`cancelled`, `incomplete`, `failed`). reason: type: string - description: The reason the Response did not complete. For a `cancelled` - Response, one of `turn_detected` (the server VAD detected a new - start of speech) or `client_cancelled` (the client sent a cancel - event). For an `incomplete` Response, one of `max_output_tokens` - or `content_filter` (the server-side safety filter activated and - cut off the response). + enum: + - turn_detected + - client_cancelled + - max_output_tokens + - content_filter + description: > + The reason the Response did not complete. For a `cancelled` + Response, + + one of `turn_detected` (the server VAD detected a new start of + speech) + + or `client_cancelled` (the client sent a cancel event). For an + + `incomplete` Response, one of `max_output_tokens` or + `content_filter` + + (the server-side safety filter activated and cut off the + response). error: type: object - description: A description of the error that caused the response to fail, + description: | + A description of the error that caused the response to fail, populated when the `status` is `failed`. properties: type: @@ -18334,27 +19376,42 @@ components: type: array description: The list of output items generated by the response. items: - type: object - description: An item in the response output. + $ref: "#/components/schemas/RealtimeConversationItem" usage: type: object - description: Usage statistics for the Response, this will correspond to billing. - A Realtime API session will maintain a conversation context and - append new Items to the Conversation, thus output from previous - turns (text and audio tokens) will become the input for later turns. + description: > + Usage statistics for the Response, this will correspond to billing. + A + + Realtime API session will maintain a conversation context and append + new + + Items to the Conversation, thus output from previous turns (text + and + + audio tokens) will become the input for later turns. properties: total_tokens: type: integer - description: The total number of tokens in the Response including input and - output text and audio tokens. + description: > + The total number of tokens in the Response including input and + output + + text and audio tokens. input_tokens: type: integer - description: The number of input tokens used in the Response, including text and + description: > + The number of input tokens used in the Response, including text + and + audio tokens. output_tokens: type: integer - description: The number of output tokens sent in the Response, including text - and audio tokens. + description: > + The number of output tokens sent in the Response, including text + and + + audio tokens. input_token_details: type: object description: Details about the input tokens used in the Response. @@ -18380,15 +19437,18 @@ components: description: The number of audio tokens used in the Response. RealtimeServerEventConversationCreated: type: object - description: Returned when a conversation is created. Emitted right after - session creation. + description: > + Returned when a conversation is created. Emitted right after session + creation. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "conversation.created". + enum: + - conversation.created + description: The event type, must be `conversation.created`. conversation: type: object description: The conversation resource. @@ -18398,7 +19458,7 @@ components: description: The unique ID of the conversation. object: type: string - description: The object type, must be "realtime.conversation". + description: The object type, must be `realtime.conversation`. required: - event_id - type @@ -18417,23 +19477,35 @@ components: } RealtimeServerEventConversationItemCreated: type: object - description: >- + description: > Returned when a conversation item is created. There are several - scenarios that produce this event: - - The server is generating a Response, which if successful will produce either one or two Items, which will be of type `message` (role `assistant`) or type `function_call`. - - The input audio buffer has been committed, either by the client or the server (in `server_vad` mode). The server will take the content of the input audio buffer and add it to a new user message Item. - - The client has sent a `conversation.item.create` event to add a new Item to the Conversation. + scenarios that + + produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - conversation.item.created description: The event type, must be `conversation.item.created`. previous_item_id: type: string - description: The ID of the preceding item in the Conversation context, allows - the client to understand the order of the conversation. + description: > + The ID of the preceding item in the Conversation context, allows + the + + client to understand the order of the conversation. item: $ref: "#/components/schemas/RealtimeConversationItem" required: @@ -18466,16 +19538,22 @@ components: } RealtimeServerEventConversationItemDeleted: type: object - description: Returned when an item in the conversation is deleted by the client - with a `conversation.item.delete` event. This event is used to - synchronize the server's understanding of the conversation history with - the client's view. + description: > + Returned when an item in the conversation is deleted by the client with + a + + `conversation.item.delete` event. This event is used to synchronize the + + server's understanding of the conversation history with the client's + view. properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - conversation.item.deleted description: The event type, must be `conversation.item.deleted`. item_id: type: string @@ -18495,25 +19573,41 @@ components: } RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: type: object - description: >- + description: > This event is the output of audio transcription for user audio written - to the user audio buffer. Transcription begins when the input audio - buffer is committed by the client or server (in `server_vad` mode). - Transcription runs asynchronously with Response creation, so this event - may come before or after the Response events. + to the + + user audio buffer. Transcription begins when the input audio buffer is + + committed by the client or server (in `server_vad` mode). Transcription + runs + + asynchronously with Response creation, so this event may come before or + after + + the Response events. + Realtime API models accept audio natively, and thus input transcription - is a separate process run on a separate ASR (Automatic Speech - Recognition) model, currently always `whisper-1`. Thus the transcript - may diverge somewhat from the model's interpretation, and should be - treated as a rough guide. + is a + + separate process run on a separate ASR (Automatic Speech Recognition) + model, + + currently always `whisper-1`. Thus the transcript may diverge somewhat + from + + the model's interpretation, and should be treated as a rough guide. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be + enum: + - conversation.item.input_audio_transcription.completed + description: | + The event type, must be `conversation.item.input_audio_transcription.completed`. item_id: type: string @@ -18543,17 +19637,23 @@ components: } RealtimeServerEventConversationItemInputAudioTranscriptionFailed: type: object - description: Returned when input audio transcription is configured, and a - transcription request for a user message failed. These events are - separate from other `error` events so that the client can identify the - related Item. + description: > + Returned when input audio transcription is configured, and a + transcription + + request for a user message failed. These events are separate from other + + `error` events so that the client can identify the related Item. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be + enum: + - conversation.item.input_audio_transcription.failed + description: | + The event type, must be `conversation.item.input_audio_transcription.failed`. item_id: type: string @@ -18601,21 +19701,29 @@ components: } RealtimeServerEventConversationItemTruncated: type: object - description: >- + description: > Returned when an earlier assistant audio message item is truncated by - the client with a `conversation.item.truncate` event. This event is used - to synchronize the server's understanding of the audio with the client's + the + + client with a `conversation.item.truncate` event. This event is used to + + synchronize the server's understanding of the audio with the client's playback. + This action will truncate the audio and remove the server-side text - transcript to ensure there is no text in the context that hasn't been - heard by the user. + transcript + + to ensure there is no text in the context that hasn't been heard by the + user. properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - conversation.item.truncated description: The event type, must be `conversation.item.truncated`. item_id: type: string @@ -18625,7 +19733,8 @@ components: description: The index of the content part that was truncated. audio_end_ms: type: integer - description: The duration up to which the audio was truncated, in milliseconds. + description: | + The duration up to which the audio was truncated, in milliseconds. required: - event_id - type @@ -18645,24 +19754,31 @@ components: } RealtimeServerEventError: type: object - description: Returned when an error occurs, which could be a client problem or a - server problem. Most errors are recoverable and the session will stay - open, we recommend to implementors to monitor and log error messages by - default. + description: > + Returned when an error occurs, which could be a client problem or a + server + + problem. Most errors are recoverable and the session will stay open, we + + recommend to implementors to monitor and log error messages by default. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "error". + enum: + - error + description: The event type, must be `error`. error: type: object description: Details of the error. properties: type: type: string - description: The type of error (e.g., "invalid_request_error", "server_error"). + description: > + The type of error (e.g., "invalid_request_error", + "server_error"). code: type: string description: Error code, if any. @@ -18674,7 +19790,8 @@ components: description: Parameter related to the error, if any. event_id: type: string - description: The event_id of the client event that caused the error, if + description: > + The event_id of the client event that caused the error, if applicable. required: - event_id @@ -18697,14 +19814,17 @@ components: } RealtimeServerEventInputAudioBufferCleared: type: object - description: Returned when the input audio buffer is cleared by the client with - a `input_audio_buffer.clear` event. + description: | + Returned when the input audio buffer is cleared by the client with a + `input_audio_buffer.clear` event. properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - input_audio_buffer.cleared description: The event type, must be `input_audio_buffer.cleared`. required: - event_id @@ -18719,20 +19839,30 @@ components: } RealtimeServerEventInputAudioBufferCommitted: type: object - description: Returned when an input audio buffer is committed, either by the - client or automatically in server VAD mode. The `item_id` property is - the ID of the user message item that will be created, thus a - `conversation.item.created` event will also be sent to the client. + description: > + Returned when an input audio buffer is committed, either by the client + or + + automatically in server VAD mode. The `item_id` property is the ID of + the user + + message item that will be created, thus a `conversation.item.created` + event + + will also be sent to the client. properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - input_audio_buffer.committed description: The event type, must be `input_audio_buffer.committed`. previous_item_id: type: string - description: The ID of the preceding item after which the new item will be + description: > + The ID of the preceding item after which the new item will be inserted. item_id: type: string @@ -18754,32 +19884,56 @@ components: } RealtimeServerEventInputAudioBufferSpeechStarted: type: object - description: Sent by the server when in `server_vad` mode to indicate that - speech has been detected in the audio buffer. This can happen any time - audio is added to the buffer (unless speech is already detected). The - client may want to use this event to interrupt audio playback or provide - visual feedback to the user. The client should expect to receive a - `input_audio_buffer.speech_stopped` event when speech stops. The - `item_id` property is the ID of the user message item that will be - created when speech stops and will also be included in the + description: > + Sent by the server when in `server_vad` mode to indicate that speech has + been + + detected in the audio buffer. This can happen any time audio is added to + the + + buffer (unless speech is already detected). The client may want to use + this + + event to interrupt audio playback or provide visual feedback to the + user. + + + The client should expect to receive a + `input_audio_buffer.speech_stopped` event + + when speech stops. The `item_id` property is the ID of the user message + item + + that will be created when speech stops and will also be included in the + `input_audio_buffer.speech_stopped` event (unless the client manually - commits the audio buffer during VAD activation). + commits + + the audio buffer during VAD activation). properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - input_audio_buffer.speech_started description: The event type, must be `input_audio_buffer.speech_started`. audio_start_ms: type: integer - description: Milliseconds from the start of all audio written to the buffer - during the session when speech was first detected. This will - correspond to the beginning of audio sent to the model, and thus - includes the `prefix_padding_ms` configured in the Session. + description: > + Milliseconds from the start of all audio written to the buffer + during the + + session when speech was first detected. This will correspond to the + + beginning of audio sent to the model, and thus includes the + + `prefix_padding_ms` configured in the Session. item_id: type: string - description: The ID of the user message item that will be created when speech + description: > + The ID of the user message item that will be created when speech stops. required: - event_id @@ -18798,22 +19952,33 @@ components: } RealtimeServerEventInputAudioBufferSpeechStopped: type: object - description: Returned in `server_vad` mode when the server detects the end of - speech in the audio buffer. The server will also send an - `conversation.item.created` event with the user message item that is - created from the audio buffer. + description: > + Returned in `server_vad` mode when the server detects the end of speech + in + + the audio buffer. The server will also send an + `conversation.item.created` + + event with the user message item that is created from the audio buffer. properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - input_audio_buffer.speech_stopped description: The event type, must be `input_audio_buffer.speech_stopped`. audio_end_ms: type: integer - description: Milliseconds since the session started when speech stopped. This - will correspond to the end of audio sent to the model, and thus - includes the `min_silence_duration_ms` configured in the Session. + description: > + Milliseconds since the session started when speech stopped. This + will + + correspond to the end of audio sent to the model, and thus includes + the + + `min_silence_duration_ms` configured in the Session. item_id: type: string description: The ID of the user message item that will be created. @@ -18834,16 +19999,25 @@ components: } RealtimeServerEventRateLimitsUpdated: type: object - description: Emitted at the beginning of a Response to indicate the updated rate - limits. When a Response is created some tokens will be "reserved" for - the output tokens, the rate limits shown here reflect that reservation, - which is then adjusted accordingly once the Response is completed. + description: > + Emitted at the beginning of a Response to indicate the updated rate + limits. + + When a Response is created some tokens will be "reserved" for the + output + + tokens, the rate limits shown here reflect that reservation, which is + then + + adjusted accordingly once the Response is completed. properties: event_id: type: string description: The unique ID of the server event. type: type: string + enum: + - rate_limits.updated description: The event type, must be `rate_limits.updated`. rate_limits: type: array @@ -18898,7 +20072,9 @@ components: description: The unique ID of the server event. type: type: string - description: The event type, must be "response.audio.delta". + enum: + - response.audio.delta + description: The event type, must be `response.audio.delta`. response_id: type: string description: The ID of the response. @@ -18937,15 +20113,20 @@ components: } RealtimeServerEventResponseAudioDone: type: object - description: Returned when the model-generated audio is done. Also emitted when - a Response is interrupted, incomplete, or cancelled. + description: > + Returned when the model-generated audio is done. 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 - description: The event type, must be "response.audio.done". + enum: + - response.audio.done + description: The event type, must be `response.audio.done`. response_id: type: string description: The ID of the response. @@ -18979,7 +20160,8 @@ components: } RealtimeServerEventResponseAudioTranscriptDelta: type: object - description: Returned when the model-generated transcription of audio output is + description: > + Returned when the model-generated transcription of audio output is updated. properties: event_id: @@ -18987,7 +20169,9 @@ components: description: The unique ID of the server event. type: type: string - description: The event type, must be "response.audio_transcript.delta". + enum: + - response.audio_transcript.delta + description: The event type, must be `response.audio_transcript.delta`. response_id: type: string description: The ID of the response. @@ -19026,16 +20210,19 @@ components: } 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. + 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 - description: The event type, must be "response.audio_transcript.done". + enum: + - response.audio_transcript.done + description: The event type, must be `response.audio_transcript.done`. response_id: type: string description: The ID of the response. @@ -19074,15 +20261,20 @@ components: } RealtimeServerEventResponseContentPartAdded: type: object - description: Returned when a new content part is added to an assistant message - item during response generation. + 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 - description: The event type, must be "response.content_part.added". + enum: + - response.content_part.added + description: The event type, must be `response.content_part.added`. response_id: type: string description: The ID of the response. @@ -19101,6 +20293,9 @@ components: properties: type: type: string + enum: + - audio + - text description: The content type ("text", "audio"). text: type: string @@ -19137,16 +20332,20 @@ components: } 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. + 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 - description: The event type, must be "response.content_part.done". + enum: + - response.content_part.done + description: The event type, must be `response.content_part.done`. response_id: type: string description: The ID of the response. @@ -19201,15 +20400,19 @@ components: } 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`. + 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`. response: $ref: "#/components/schemas/RealtimeResponse" @@ -19235,17 +20438,24 @@ components: } 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. + 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 - description: The event type, must be "response.done". + enum: + - response.done + description: The event type, must be `response.done`. response: $ref: "#/components/schemas/RealtimeResponse" required: @@ -19301,14 +20511,18 @@ components: } RealtimeServerEventResponseFunctionCallArgumentsDelta: type: object - description: Returned when the model-generated function call arguments are updated. + 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 - description: The event type, must be "response.function_call_arguments.delta". + enum: + - response.function_call_arguments.delta + description: | + The event type, must be `response.function_call_arguments.delta`. response_id: type: string description: The ID of the response. @@ -19347,16 +20561,21 @@ components: } 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. + 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 - description: The event type, must be "response.function_call_arguments.done". + enum: + - response.function_call_arguments.done + description: | + The event type, must be `response.function_call_arguments.done`. response_id: type: string description: The ID of the response. @@ -19402,6 +20621,8 @@ components: 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`. response_id: type: string @@ -19437,14 +20658,19 @@ components: } RealtimeServerEventResponseOutputItemDone: type: object - description: Returned when an Item is done streaming. Also emitted when a - Response is interrupted, incomplete, or cancelled. + 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`. response_id: type: string @@ -19492,7 +20718,9 @@ components: description: The unique ID of the server event. type: type: string - description: The event type, must be "response.text.delta". + enum: + - response.text.delta + description: The event type, must be `response.text.delta`. response_id: type: string description: The ID of the response. @@ -19531,16 +20759,20 @@ components: } RealtimeServerEventResponseTextDone: type: object - description: Returned when the text value of a "text" content part is done - streaming. Also emitted when a Response is interrupted, incomplete, or - cancelled. + description: > + Returned when the text value of a "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 - description: The event type, must be "response.text.done". + enum: + - response.text.done + description: The event type, must be `response.text.done`. response_id: type: string description: The ID of the response. @@ -19579,15 +20811,21 @@ components: } 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. + 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 description: The unique ID of the server event. type: type: string + enum: + - session.created description: The event type, must be `session.created`. session: $ref: "#/components/schemas/RealtimeSession" @@ -19607,8 +20845,8 @@ components: "object": "realtime.session", "model": "gpt-4o-realtime-preview-2024-10-01", "modalities": ["text", "audio"], - "instructions": "", - "voice": "alloy", + "instructions": "...model instructions here...", + "voice": "sage", "input_audio_format": "pcm16", "output_audio_format": "pcm16", "input_audio_transcription": null, @@ -19621,20 +20859,25 @@ components: "tools": [], "tool_choice": "auto", "temperature": 0.8, - "max_response_output_tokens": null + "max_response_output_tokens": "inf" } } RealtimeServerEventSessionUpdated: type: object - description: Returned when a session is updated with a `session.update` event, - unless there is an error. + description: > + Returned when a session is updated with a `session.update` event, + unless + + there is an error. properties: event_id: type: string description: The unique ID of the server event. type: type: string - description: The event type, must be "session.updated". + enum: + - session.updated + description: The event type, must be `session.updated`. session: $ref: "#/components/schemas/RealtimeSession" required: @@ -19654,7 +20897,7 @@ components: "model": "gpt-4o-realtime-preview-2024-10-01", "modalities": ["text"], "instructions": "New instructions", - "voice": "alloy", + "voice": "sage", "input_audio_format": "pcm16", "output_audio_format": "pcm16", "input_audio_transcription": { @@ -19672,12 +20915,14 @@ components: description: Realtime session object configuration. properties: modalities: - type: array - items: - type: string description: | The set of modalities the model can respond with. To disable audio, set this to ["text"]. + items: + type: string + enum: + - text + - audio instructions: type: string description: > @@ -19723,13 +20968,21 @@ components: - shimmer - verse description: > - The voice the model uses to respond. Supported voices are `alloy`, - `ash`, + The voice the model uses to respond. Current voice options are + `ash`, - `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. Cannot - be + `ballad`, `coral`, `sage`, and `verse`. - changed once the model has responded with audio at least once. + + Also supported but not recommended are `alloy`, `echo`, and + `shimmer`. + + These older voices are less expressive. + + + Voice cannot be changed during the session once the model has + + responded with audio at least once. input_audio_format: type: string description: > @@ -19812,6 +21065,8 @@ components: properties: type: type: string + enum: + - function description: The type of the tool, i.e. `function`. name: type: string @@ -21511,6 +22766,411 @@ components: "created_at": 1719186911, "upload_id": "upload_abc123" } + UsageAudioSpeechesResult: + type: object + description: The aggregated audio speeches usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.audio_speeches.result + characters: + type: integer + description: The number of characters processed. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + user_id: + type: string + description: When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + api_key_id: + type: string + description: When `group_by=api_key_id`, this field provides the API key ID of + the grouped usage result. + model: + type: string + description: When `group_by=model`, this field provides the model name of the + grouped usage result. + required: + - object + - characters + - num_model_requests + x-oaiMeta: + name: Audio speeches usage object + example: | + { + "object": "orgainzation.usage.audio_speeches.result", + "characters": 45, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" + } + UsageAudioTranscriptionsResult: + type: object + description: The aggregated audio transcriptions usage details of the specific + time bucket. + properties: + object: + type: string + enum: + - organization.usage.audio_transcriptions.result + seconds: + type: integer + description: The number of seconds processed. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + user_id: + type: string + description: When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + api_key_id: + type: string + description: When `group_by=api_key_id`, this field provides the API key ID of + the grouped usage result. + model: + type: string + description: When `group_by=model`, this field provides the model name of the + grouped usage result. + required: + - object + - seconds + - num_model_requests + x-oaiMeta: + name: Audio transcriptions usage object + example: | + { + "object": "orgainzation.usage.audio_transcriptions.result", + "seconds": 10, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" + } + UsageCodeInterpreterSessionsResult: + type: object + description: The aggregated code interpreter sessions usage details of the + specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.code_interpreter_sessions.result + sessions: + type: integer + description: The number of code interpreter sessions. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + required: + - object + - sessions + x-oaiMeta: + name: Code interpreter sessions usage object + example: | + { + "object": "orgainzation.usage.code_interpreter_sessions.result", + "sessions": 1, + "project_id": "proj_abc" + } + UsageCompletionsResult: + type: object + description: The aggregated completions usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.completions.result + input_tokens: + type: integer + description: The number of input tokens used. + input_cached_tokens: + type: integer + description: The number of input tokens that has been cached from previous + requests. + output_tokens: + type: integer + description: The number of output tokens used. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + user_id: + type: string + description: When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + api_key_id: + type: string + description: When `group_by=api_key_id`, this field provides the API key ID of + the grouped usage result. + model: + type: string + description: When `group_by=model`, this field provides the model name of the + grouped usage result. + batch: + type: boolean + description: When `group_by=batch`, this field tells whether the grouped usage + result is batch or not. + required: + - object + - input_tokens + - output_tokens + - num_model_requests + x-oaiMeta: + name: Completions usage object + example: | + { + "object": "orgainzation.usage.completions.result", + "input_tokens": 5000, + "output_tokens": 1000, + "input_cached_tokens": 4000, + "num_model_requests": 5, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "gpt-4o-mini-2024-07-18", + "batch": false + } + UsageEmbeddingsResult: + type: object + description: The aggregated embeddings usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.embeddings.result + input_tokens: + type: integer + description: The number of input tokens used. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + user_id: + type: string + description: When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + api_key_id: + type: string + description: When `group_by=api_key_id`, this field provides the API key ID of + the grouped usage result. + model: + type: string + description: When `group_by=model`, this field provides the model name of the + grouped usage result. + required: + - object + - input_tokens + - num_model_requests + x-oaiMeta: + name: Embeddings usage object + example: | + { + "object": "orgainzation.usage.embeddings.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-embedding-ada-002-v2" + } + UsageImagesResult: + type: object + description: The aggregated images usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.images.result + images: + type: integer + description: The number of images processed. + num_model_requests: + type: integer + description: The count of requests made to the model. + source: + type: string + description: When `group_by=source`, this field provides the source of the + grouped usage result, possible values are `image.generation`, + `image.edit`, `image.variation`. + size: + type: string + description: When `group_by=size`, this field provides the image size of the + grouped usage result. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + user_id: + type: string + description: When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + api_key_id: + type: string + description: When `group_by=api_key_id`, this field provides the API key ID of + the grouped usage result. + model: + type: string + description: When `group_by=model`, this field provides the model name of the + grouped usage result. + required: + - object + - images + - num_model_requests + x-oaiMeta: + name: Images usage object + example: | + { + "object": "orgainzation.usage.images.result", + "images": 2, + "num_model_requests": 2, + "size": "1024x1024", + "source": "image.generation", + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "dall-e-3" + } + UsageModerationsResult: + type: object + description: The aggregated moderations usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.moderations.result + input_tokens: + type: integer + description: The number of input tokens used. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + user_id: + type: string + description: When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + api_key_id: + type: string + description: When `group_by=api_key_id`, this field provides the API key ID of + the grouped usage result. + model: + type: string + description: When `group_by=model`, this field provides the model name of the + grouped usage result. + required: + - object + - input_tokens + - num_model_requests + x-oaiMeta: + name: Moderations usage object + example: | + { + "object": "orgainzation.usage.moderations.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-moderation" + } + UsageResponse: + type: object + properties: + object: + type: string + enum: + - page + data: + type: array + items: + $ref: "#/components/schemas/UsageTimeBucket" + has_more: + type: boolean + next_page: + type: string + required: + - object + - data + - has_more + - next_page + UsageTimeBucket: + type: object + properties: + object: + type: string + enum: + - bucket + start_time: + type: integer + end_time: + type: integer + result: + type: array + items: + oneOf: + - $ref: "#/components/schemas/UsageCompletionsResult" + - $ref: "#/components/schemas/UsageEmbeddingsResult" + - $ref: "#/components/schemas/UsageModerationsResult" + - $ref: "#/components/schemas/UsageImagesResult" + - $ref: "#/components/schemas/UsageAudioSpeechesResult" + - $ref: "#/components/schemas/UsageAudioTranscriptionsResult" + - $ref: "#/components/schemas/UsageVectorStoresResult" + - $ref: "#/components/schemas/UsageCodeInterpreterSessionsResult" + - $ref: "#/components/schemas/CostsResult" + required: + - object + - start_time + - end_time + - result + UsageVectorStoresResult: + type: object + description: The aggregated vector stores usage details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.usage.vector_stores.result + usage_bytes: + type: integer + description: The vector stores usage in bytes. + project_id: + type: string + description: When `group_by=project_id`, this field provides the project ID of + the grouped usage result. + required: + - object + - usage_bytes + x-oaiMeta: + name: Vector stores usage object + example: | + { + "object": "orgainzation.usage.vector_stores.result", + "usage_bytes": 1024, + "project_id": "proj_abc" + } User: type: object description: Represents an individual `user` within an organization. @@ -22369,24 +24029,12 @@ x-oaiMeta: - 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 - + 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: @@ -22401,18 +24049,11 @@ x-oaiMeta: path: events - id: administration title: Administration - description: > + description: | Programmatically manage your organization. - - The Audit Logs endpoint provides a log of all actions taken in - the organization for security and monitoring purposes. - - To access these endpoints please generate an Admin API Key through the - [API Platform Organization overview](/organization/admin-keys). Admin - API keys cannot be used for non-administration endpoints. - - For best practices on setting up your organization, please refer to this - [guide](/docs/guides/production-best-practices#setting-up-your-organization) + The Audit Logs endpoint provides a log of all actions taken in the organization for security and monitoring purposes. + To access these endpoints please generate an Admin API Key through the [API Platform Organization overview](/organization/admin-keys). Admin API keys cannot be used for non-administration endpoints. + For best practices on setting up your organization, please refer to this [guide](/docs/guides/production-best-practices#setting-up-your-organization) navigationGroup: administration - id: invite title: Invites @@ -22596,6 +24237,78 @@ x-oaiMeta: - type: object key: AuditLog path: object + - id: usage + title: Usage + description: > + The **Usage API** provides detailed insights into your activity across + the OpenAI API. It also includes a separate [Costs + endpoint](/docs/api-reference/usage/costs), which offers visibility into + your spend, breaking down consumption by invoice line items and project + IDs. + + + While the Usage API delivers granular usage data, it may not always + reconcile perfectly with the Costs due to minor differences in how usage + and spend are recorded. For financial purposes, we recommend using the + [Costs endpoint](/docs/api-reference/usage/costs) or the [Costs + tab](/settings/organization/usage) in the Usage Dashboard, which will + reconcile back to your billing invoice. + navigationGroup: administration + sections: + - type: endpoint + key: usage-completions + path: completions + - type: object + key: UsageCompletionsResult + path: completions_object + - type: endpoint + key: usage-embeddings + path: embeddings + - type: object + key: UsageEmbeddingsResult + path: embeddings_object + - type: endpoint + key: usage-moderations + path: moderations + - type: object + key: UsageModerationsResult + path: moderations_object + - type: endpoint + key: usage-images + path: images + - type: object + key: UsageImagesResult + path: images_object + - type: endpoint + key: usage-audio-speeches + path: audio_speeches + - type: object + key: UsageAudioSpeechesResult + path: audio_speeches_object + - type: endpoint + key: usage-audio-transcriptions + path: audio_transcriptions + - type: object + key: UsageAudioTranscriptionsResult + path: audio_transcriptions_object + - type: endpoint + key: usage-vector-stores + path: vector_stores + - type: object + key: UsageVectorStoresResult + path: vector_stores_object + - type: endpoint + key: usage-code-interpreter-sessions + path: code_interpreter_sessions + - type: object + key: UsageCodeInterpreterSessionsResult + path: code_interpreter_sessions_object + - type: endpoint + key: usage-costs + path: costs + - type: object + key: CostsResult + path: costs_object - id: realtime title: Realtime beta: true From c2ff29b035ecbc41b9b6b6afde28ce66ee67c436 Mon Sep 17 00:00:00 2001 From: jzhou-openai Date: Wed, 4 Dec 2024 11:26:16 -0800 Subject: [PATCH 4/7] Update amount doc --- openapi.yaml | 837 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 640 insertions(+), 197 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 0c01d0ea..5f09487b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1614,14 +1614,23 @@ paths: main(); - response: | - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + response: > + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} .... - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} - title: Functions request: curl: > @@ -2915,8 +2924,10 @@ paths: the given ID. examples: request: - curl: | - curl https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \ + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F + \ -H "Authorization: Bearer $OPENAI_API_KEY" python: | from openai import OpenAI @@ -3077,8 +3088,10 @@ paths: fine-tuning job. examples: request: - curl: | - curl https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints \ + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints + \ -H "Authorization: Bearer $OPENAI_API_KEY" response: > { @@ -3567,8 +3580,10 @@ paths: returns: Deletion status. examples: request: - curl: | - curl https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 \ + curl: > + curl + https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 + \ -X DELETE \ -H "Authorization: Bearer $OPENAI_API_KEY" python: | @@ -4091,9 +4106,13 @@ paths: [Costs](/docs/api-reference/usage/costs_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: | { @@ -4158,8 +4177,10 @@ paths: returns: A list of [Invite](/docs/api-reference/invite/object) objects. examples: request: - curl: | - curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \ + curl: > + curl + https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4354,8 +4375,10 @@ paths: returns: A list of [Project](/docs/api-reference/projects/object) objects. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false \ + curl: > + curl + https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4553,8 +4576,10 @@ paths: objects. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \ + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4624,8 +4649,10 @@ paths: matching the specified ID. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4686,8 +4713,10 @@ paths: service account examples: request: - curl: | - curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -4802,8 +4831,10 @@ paths: objects. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 \ + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: | @@ -4875,8 +4906,10 @@ paths: object. examples: request: - curl: | - curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx \ + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ @@ -4949,8 +4982,10 @@ paths: objects. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \ + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5011,8 +5046,10 @@ paths: object. examples: request: - curl: | - curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \ + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ @@ -5068,8 +5105,10 @@ paths: object matching the specified ID. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5113,8 +5152,10 @@ paths: an archived project, which has no service accounts examples: request: - curl: | - curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5176,8 +5217,10 @@ paths: objects. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 \ + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5301,8 +5344,10 @@ paths: matching the specified ID. examples: request: - curl: | - curl https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \ + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5360,8 +5405,10 @@ paths: object. examples: request: - curl: | - curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \ + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ @@ -5415,8 +5462,10 @@ paths: archived project, which has no users examples: request: - curl: | - curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc \ + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -5534,9 +5583,13 @@ paths: usage](/docs/api-reference/usage/audio_speeches_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/audio_speeches?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/audio_speeches?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: > { @@ -5670,9 +5723,13 @@ paths: usage](/docs/api-reference/usage/audio_transcriptions_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/audio_transcriptions?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/audio_transcriptions?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: > { @@ -5779,9 +5836,13 @@ paths: objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: > { @@ -5920,9 +5981,13 @@ paths: usage](/docs/api-reference/usage/completions_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: > { @@ -6059,9 +6124,13 @@ paths: usage](/docs/api-reference/usage/embeddings_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/embeddings?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/embeddings?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: > { @@ -6227,9 +6296,13 @@ paths: usage](/docs/api-reference/usage/images_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: | { @@ -6365,9 +6438,13 @@ paths: usage](/docs/api-reference/usage/moderations_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: > { @@ -6473,9 +6550,13 @@ paths: usage](/docs/api-reference/usage/vector_stores_object) objects. examples: request: - curl: | - curl "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730419200&limit=1" \ + curl: > + curl + "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730419200&limit=1" + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" response: > { @@ -6536,8 +6617,10 @@ paths: returns: A list of [User](/docs/api-reference/users/object) objects. examples: request: - curl: | - curl https://api.openai.com/v1/organization/users?after=user_abc&limit=20 \ + curl: > + curl + https://api.openai.com/v1/organization/users?after=user_abc&limit=20 + \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" response: @@ -6979,52 +7062,99 @@ paths: } main(); - response: | + response: > event: thread.created - data: {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} + + data: + {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} + event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + event: thread.run.step.created - data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + event: thread.run.step.in_progress - data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + event: thread.message.created - data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], + "metadata":{}} + event: thread.message.in_progress - data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], + "metadata":{}} + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + ... + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + event: thread.message.completed - data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}], "metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! + How can I assist you today?","annotations":[]}}], "metadata":{}} + event: thread.run.step.completed - data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + event: thread.run.completed + {"id":"run_123","object":"thread.run","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1713226836,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1713226837,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + event: done + data: [DONE] - title: Streaming with Functions request: @@ -7155,46 +7285,102 @@ paths: main(); - response: | + response: > event: thread.created - data: {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} + + data: + {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} + event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.step.created - data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} + event: thread.run.step.in_progress - data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} + event: thread.run.step.delta - data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"","output":null}}]}}} + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"","output":null}}]}}} + event: thread.run.step.delta - data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} + event: thread.run.step.delta - data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} + ... + event: thread.run.step.delta - data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} + event: thread.run.step.delta - data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} + event: thread.run.requires_action - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San + Francisco, + CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: done + data: [DONE] /threads/{thread_id}: get: @@ -7677,8 +7863,10 @@ paths: specified ID. examples: request: - curl: | - curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" @@ -7765,8 +7953,10 @@ paths: returns: The modified [message](/docs/api-reference/messages/object) object. examples: request: - curl: | - curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" \ @@ -7861,8 +8051,10 @@ paths: returns: Deletion status examples: request: - curl: | - curl -X DELETE https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \ + curl: > + curl -X DELETE + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" @@ -8105,10 +8297,16 @@ paths: description: The ID of the thread to run. - name: include[] in: query - description: | - A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + - See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. schema: type: array items: @@ -8245,49 +8443,92 @@ paths: } main(); - response: | + response: > event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.step.created - data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + event: thread.run.step.in_progress - data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + event: thread.message.created - data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + event: thread.message.in_progress - data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + ... + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + event: thread.message.completed - data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710330642,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}],"metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710330642,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! + How can I assist you today?","annotations":[]}}],"metadata":{}} + event: thread.run.step.completed - data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710330642,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710330642,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + event: thread.run.completed - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: done + data: [DONE] - title: Streaming with Functions request: @@ -8407,49 +8648,92 @@ paths: main(); - response: | + response: > event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.step.created - data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + event: thread.run.step.in_progress - data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + event: thread.message.created - data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + event: thread.message.in_progress - data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + ... + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + event: thread.message.delta - data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + event: thread.message.completed - data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}],"metadata":{}} + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! + How can I assist you today?","annotations":[]}}],"metadata":{}} + event: thread.run.step.completed - data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + event: thread.run.completed - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: done + data: [DONE] /threads/{thread_id}/runs/{run_id}: get: @@ -8720,8 +9004,10 @@ paths: specified ID. examples: request: - curl: | - curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel \ + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "OpenAI-Beta: assistants=v2" \ -X POST @@ -8844,10 +9130,16 @@ paths: type: string - name: include[] in: query - description: | - A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + - See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. schema: type: array items: @@ -8869,8 +9161,10 @@ paths: objects. examples: request: - curl: | - curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \ + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -8959,10 +9253,16 @@ paths: description: The ID of the run step to retrieve. - name: include[] in: query - description: | - A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. - See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. schema: type: array items: @@ -8984,8 +9284,10 @@ paths: matching the specified ID. examples: request: - curl: | - curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \ + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -9087,8 +9389,10 @@ paths: examples: - title: Default request: - curl: | - curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -9194,8 +9498,10 @@ paths: } - title: Streaming request: - curl: | - curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \ + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -9254,55 +9560,121 @@ paths: main(); - response: | + response: > event: thread.run.step.completed - data: {"id":"step_001","object":"thread.run.step","created_at":1710352449,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"completed","cancelled_at":null,"completed_at":1710352475,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[{"id":"call_iWr0kQ2EaYMaxNdl0v3KYkx7","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}","output":"70 degrees and sunny."}}]},"usage":{"prompt_tokens":291,"completion_tokens":24,"total_tokens":315}} + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710352449,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"completed","cancelled_at":null,"completed_at":1710352475,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[{"id":"call_iWr0kQ2EaYMaxNdl0v3KYkx7","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San + Francisco, CA\",\"unit\":\"fahrenheit\"}","output":"70 degrees and + sunny."}}]},"usage":{"prompt_tokens":291,"completion_tokens":24,"total_tokens":315}} + event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: thread.run.step.created - data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} + + data: + {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} + event: thread.run.step.in_progress - data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} + + data: + {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} + event: thread.message.created - data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + data: + {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + event: thread.message.in_progress - data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + data: + {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + event: thread.message.delta - data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} + event: thread.message.delta - data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" current"}}]}} + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + current"}}]}} + event: thread.message.delta - data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" weather"}}]}} + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + weather"}}]}} + ... + event: thread.message.delta - data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" sunny"}}]}} + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + sunny"}}]}} + event: thread.message.delta - data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + event: thread.message.completed - data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710352477,"role":"assistant","content":[{"type":"text","text":{"value":"The current weather in San Francisco, CA is 70 degrees Fahrenheit and sunny.","annotations":[]}}],"metadata":{}} + + data: + {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710352477,"role":"assistant","content":[{"type":"text","text":{"value":"The + current weather in San Francisco, CA is 70 degrees Fahrenheit and + sunny.","annotations":[]}}],"metadata":{}} + event: thread.run.step.completed - data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710352477,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":{"prompt_tokens":329,"completion_tokens":18,"total_tokens":347}} + + data: + {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710352477,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":{"prompt_tokens":329,"completion_tokens":18,"total_tokens":347}} + event: thread.run.completed - data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + data: + {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + event: done + data: [DONE] /uploads: post: @@ -10059,8 +10431,10 @@ paths: object. examples: request: - curl: | - curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123 \ + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123 + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -10142,8 +10516,10 @@ paths: returns: The modified vector store file batch object. examples: request: - curl: | - curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \ + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -10276,8 +10652,10 @@ paths: file](/docs/api-reference/vector-stores-files/file-object) objects. examples: request: - curl: | - curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \ + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -10576,8 +10954,10 @@ paths: file](/docs/api-reference/vector-stores-files/file-object) object. examples: request: - curl: | - curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" @@ -10649,8 +11029,10 @@ paths: returns: Deletion status examples: request: - curl: | - curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \ + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -H "OpenAI-Beta: assistants=v2" \ @@ -10946,10 +11328,17 @@ components: type: integer minimum: 1 maximum: 50 - description: | - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. + description: > + The maximum number of results the file search tool should + output. The default is 20 for `gpt-4*` models and 5 for + `gpt-3.5-turbo`. This number should be between 1 and 50 + inclusive. - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + + Note that the file search tool may output fewer than + `max_num_results` results. See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. ranking_options: $ref: "#/components/schemas/FileSearchRankingOptions" required: @@ -12502,10 +12891,10 @@ components: - organization.costs.result amount: type: object - description: null + description: The monetary value in its associated currency. properties: value: - type: float + type: number description: The numeric value of the cost. currency: type: string @@ -13226,8 +13615,13 @@ components: items: type: string stream: - description: | - If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + description: > + If set, partial message deltas will be sent, like in ChatGPT. Tokens + will be sent as data-only [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: + [DONE]` message. [Example Python + code](https://cookbook.openai.com/examples/how_to_stream_completions). type: boolean nullable: true default: false @@ -13602,14 +13996,23 @@ components: x-oaiMeta: name: The chat completion chunk object group: chat - example: | - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + example: > + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} .... - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} CreateCompletionRequest: type: object properties: @@ -13745,10 +14148,15 @@ components: default: 16 example: 16 nullable: true - description: | - The maximum number of [tokens](/tokenizer) that can be generated in the completion. + description: > + The maximum number of [tokens](/tokenizer) that can be generated in + the completion. - The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + + The token count of your prompt plus `max_tokens` cannot exceed the + model's context length. [Example Python + code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + for counting tokens. n: type: integer minimum: 1 @@ -13809,8 +14217,13 @@ components: type: string example: '["\n"]' stream: - description: | - Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + description: > + Whether to stream back partial progress. If set, tokens will be sent + as data-only [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: + [DONE]` message. [Example Python + code](https://cookbook.openai.com/examples/how_to_stream_completions). type: boolean nullable: true default: false @@ -13985,8 +14398,15 @@ components: additionalProperties: false properties: input: - description: | - Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + description: > + Input text to embed, encoded as a string or array of tokens. To + embed multiple inputs in a single request, pass an array of strings + or array of token arrays. The input must not exceed the max input + tokens for the model (8192 tokens for `text-embedding-ada-002`), + cannot be an empty string, and any array must be 2048 dimensions or + less. [Example Python + code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + for counting tokens. example: The quick brown fox jumped over the lazy dog oneOf: - type: string @@ -16126,10 +16546,14 @@ components: FileSearchRankingOptions: title: File search tool call ranking options type: object - description: | - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. + description: > + The ranking options for the file search. If not specified, the file + search tool will use the `auto` ranker and a score_threshold of 0. + - See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. properties: ranker: type: string @@ -24029,12 +24453,24 @@ x-oaiMeta: - 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 + 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: @@ -24049,11 +24485,18 @@ x-oaiMeta: path: events - id: administration title: Administration - description: | + description: > Programmatically manage your organization. - The Audit Logs endpoint provides a log of all actions taken in the organization for security and monitoring purposes. - To access these endpoints please generate an Admin API Key through the [API Platform Organization overview](/organization/admin-keys). Admin API keys cannot be used for non-administration endpoints. - For best practices on setting up your organization, please refer to this [guide](/docs/guides/production-best-practices#setting-up-your-organization) + + The Audit Logs endpoint provides a log of all actions taken in + the organization for security and monitoring purposes. + + To access these endpoints please generate an Admin API Key through the + [API Platform Organization overview](/organization/admin-keys). Admin + API keys cannot be used for non-administration endpoints. + + For best practices on setting up your organization, please refer to this + [guide](/docs/guides/production-best-practices#setting-up-your-organization) navigationGroup: administration - id: invite title: Invites From d7a9f7e24cc0f270945318eed378cb49ba709bb4 Mon Sep 17 00:00:00 2001 From: jzhou-openai Date: Wed, 4 Dec 2024 22:52:45 -0800 Subject: [PATCH 5/7] Fix typo --- openapi.yaml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5f09487b..622d3491 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -4124,7 +4124,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.costs.result", + "object": "organization.costs.result", "amount": { "value": 0.06, "currency": "usd" @@ -5741,7 +5741,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.audio_transcriptions.result", + "object": "organization.usage.audio_transcriptions.result", "seconds": 20, "num_model_requests": 1, "project_id": null, @@ -5854,7 +5854,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.code_interpreter_sessions.result", + "object": "organization.usage.code_interpreter_sessions.result", "sessions": 1, "project_id": null } @@ -5999,7 +5999,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.completions.result", + "object": "organization.usage.completions.result", "input_tokens": 1000, "output_tokens": 500, "input_cached_tokens": 800, @@ -6142,7 +6142,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.embeddings.result", + "object": "organization.usage.embeddings.result", "input_tokens": 16, "num_model_requests": 2, "project_id": null, @@ -6314,7 +6314,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.images.result", + "object": "organization.usage.images.result", "images": 2, "num_model_requests": 2, "size": null, @@ -6456,7 +6456,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.moderations.result", + "object": "organization.usage.moderations.result", "input_tokens": 16, "num_model_requests": 2, "project_id": null, @@ -6568,7 +6568,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.vector_stores.result", + "object": "organization.usage.vector_stores.result", "usage_bytes": 1024, "project_id": null } @@ -12914,7 +12914,7 @@ components: name: Costs object example: | { - "object": "orgainzation.costs.result", + "object": "organization.costs.result", "amount": { "value": 0.06, "currency": "usd" @@ -23228,7 +23228,7 @@ components: name: Audio speeches usage object example: | { - "object": "orgainzation.usage.audio_speeches.result", + "object": "organization.usage.audio_speeches.result", "characters": 45, "num_model_requests": 1, "project_id": "proj_abc", @@ -23275,7 +23275,7 @@ components: name: Audio transcriptions usage object example: | { - "object": "orgainzation.usage.audio_transcriptions.result", + "object": "organization.usage.audio_transcriptions.result", "seconds": 10, "num_model_requests": 1, "project_id": "proj_abc", @@ -23306,7 +23306,7 @@ components: name: Code interpreter sessions usage object example: | { - "object": "orgainzation.usage.code_interpreter_sessions.result", + "object": "organization.usage.code_interpreter_sessions.result", "sessions": 1, "project_id": "proj_abc" } @@ -23360,7 +23360,7 @@ components: name: Completions usage object example: | { - "object": "orgainzation.usage.completions.result", + "object": "organization.usage.completions.result", "input_tokens": 5000, "output_tokens": 1000, "input_cached_tokens": 4000, @@ -23409,7 +23409,7 @@ components: name: Embeddings usage object example: | { - "object": "orgainzation.usage.embeddings.result", + "object": "organization.usage.embeddings.result", "input_tokens": 20, "num_model_requests": 2, "project_id": "proj_abc", @@ -23464,7 +23464,7 @@ components: name: Images usage object example: | { - "object": "orgainzation.usage.images.result", + "object": "organization.usage.images.result", "images": 2, "num_model_requests": 2, "size": "1024x1024", @@ -23512,7 +23512,7 @@ components: name: Moderations usage object example: | { - "object": "orgainzation.usage.moderations.result", + "object": "organization.usage.moderations.result", "input_tokens": 20, "num_model_requests": 2, "project_id": "proj_abc", @@ -23591,7 +23591,7 @@ components: name: Vector stores usage object example: | { - "object": "orgainzation.usage.vector_stores.result", + "object": "organization.usage.vector_stores.result", "usage_bytes": 1024, "project_id": "proj_abc" } From 152a060d4b07a49fef9f666a9ab0b8dc4cb9c2db Mon Sep 17 00:00:00 2001 From: jzhou-openai Date: Thu, 5 Dec 2024 16:35:13 -0800 Subject: [PATCH 6/7] Minor update for Usage API --- openapi.yaml | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 622d3491..daec15aa 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -5601,7 +5601,7 @@ paths: "end_time": 1730505600, "results": [ { - "object": "orgainzation.usage.audio_speeches.result", + "object": "organization.usage.audio_speeches.result", "characters": 45, "num_model_requests": 1, "project_id": null, @@ -12901,10 +12901,12 @@ components: description: Lowercase ISO-4217 currency e.g. "usd" line_item: type: string + nullable: true description: When `group_by=line_item`, this field provides the line item of the grouped costs result. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped costs result. required: @@ -23206,18 +23208,22 @@ components: description: The count of requests made to the model. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. user_id: type: string + nullable: true description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. api_key_id: type: string + nullable: true description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. model: type: string + nullable: true description: When `group_by=model`, this field provides the model name of the grouped usage result. required: @@ -23253,18 +23259,22 @@ components: description: The count of requests made to the model. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. user_id: type: string + nullable: true description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. api_key_id: type: string + nullable: true description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. model: type: string + nullable: true description: When `group_by=model`, this field provides the model name of the grouped usage result. required: @@ -23297,6 +23307,7 @@ components: description: The number of code interpreter sessions. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. required: @@ -23320,35 +23331,43 @@ components: - organization.usage.completions.result input_tokens: type: integer - description: The number of input tokens used. + description: The aggregated number of input tokens used. For customers subscribe + to scale tier, this includes scale tier tokens. input_cached_tokens: type: integer - description: The number of input tokens that has been cached from previous - requests. + description: The aggregated number of input tokens that has been cached from + previous requests. For customers subscribe to scale tier, this + includes scale tier tokens. output_tokens: type: integer - description: The number of output tokens used. + description: The aggregated number of output tokens used. For customers + subscribe to scale tier, this includes scale tier tokens. num_model_requests: type: integer description: The count of requests made to the model. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. user_id: type: string + nullable: true description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. api_key_id: type: string + nullable: true description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. model: type: string + nullable: true description: When `group_by=model`, this field provides the model name of the grouped usage result. batch: type: boolean + nullable: true description: When `group_by=batch`, this field tells whether the grouped usage result is batch or not. required: @@ -23381,24 +23400,28 @@ components: - organization.usage.embeddings.result input_tokens: type: integer - description: The number of input tokens used. + description: The aggregated number of input tokens used. num_model_requests: type: integer description: The count of requests made to the model. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. user_id: type: string + nullable: true description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. api_key_id: type: string + nullable: true description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. model: type: string + nullable: true description: When `group_by=model`, this field provides the model name of the grouped usage result. required: @@ -23433,27 +23456,33 @@ components: description: The count of requests made to the model. source: type: string + nullable: true description: When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. size: type: string + nullable: true description: When `group_by=size`, this field provides the image size of the grouped usage result. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. user_id: type: string + nullable: true description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. api_key_id: type: string + nullable: true description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. model: type: string + nullable: true description: When `group_by=model`, this field provides the model name of the grouped usage result. required: @@ -23484,24 +23513,28 @@ components: - organization.usage.moderations.result input_tokens: type: integer - description: The number of input tokens used. + description: The aggregated number of input tokens used. num_model_requests: type: integer description: The count of requests made to the model. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. user_id: type: string + nullable: true description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. api_key_id: type: string + nullable: true description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. model: type: string + nullable: true description: When `group_by=model`, this field provides the model name of the grouped usage result. required: @@ -23582,6 +23615,7 @@ components: description: The vector stores usage in bytes. project_id: type: string + nullable: true description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. required: From 950492bcce083b0953397ff2e2667bf9e99267ec Mon Sep 17 00:00:00 2001 From: jzhou-openai Date: Mon, 16 Dec 2024 14:52:23 -0800 Subject: [PATCH 7/7] Add audio tokens to Usage API --- openapi.yaml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index daec15aa..e83d5966 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -6003,6 +6003,8 @@ paths: "input_tokens": 1000, "output_tokens": 500, "input_cached_tokens": 800, + "input_audio_tokens": 0, + "output_audio_tokens": 0, "num_model_requests": 5, "project_id": null, "user_id": null, @@ -6014,7 +6016,7 @@ paths: } ], "has_more": true, - "next_page": "AAAAAGdGxdEiJdKOAAAAAGcqsYA=" + "next_page": "page_AAAAAGdGxdEiJdKOAAAAAGcqsYA=" } /organization/usage/embeddings: get: @@ -23331,17 +23333,25 @@ components: - organization.usage.completions.result input_tokens: type: integer - description: The aggregated number of input tokens used. For customers subscribe - to scale tier, this includes scale tier tokens. + description: The aggregated number of text input tokens used, including cached + tokens. For customers subscribe to scale tier, this includes scale + tier tokens. input_cached_tokens: type: integer - description: The aggregated number of input tokens that has been cached from - previous requests. For customers subscribe to scale tier, this + description: The aggregated number of text input tokens that has been cached + from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. output_tokens: type: integer - description: The aggregated number of output tokens used. For customers + description: The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + input_audio_tokens: + type: integer + description: The aggregated number of audio input tokens used, including cached + tokens. + output_audio_tokens: + type: integer + description: The aggregated number of audio output tokens used. num_model_requests: type: integer description: The count of requests made to the model. @@ -23383,6 +23393,8 @@ components: "input_tokens": 5000, "output_tokens": 1000, "input_cached_tokens": 4000, + "input_audio_tokens": 300, + "output_audio_tokens": 200, "num_model_requests": 5, "project_id": "proj_abc", "user_id": "user-abc",