Skip to content
  • Auto
  • Light
  • Dark
Log in to API

Chat

Chat

Chat

Completion Message
CompletionMessageobject

A message containing the model's (assistant) response in a chat conversation.

ShowShow
roleenum
"assistant"

Must be "assistant" to identify this as the model's response

Hide ParametersShow Parameters
"assistant"
contentunion
optional
string OR textstringtypeenumMessageTextContentItem

The content of the model's response.

Hide ParametersShow Parameters
UnionMember0string
textstringtypeenumMessageTextContentItem
stop_reasonenum
optional
"stop" OR "tool_calls" OR "length"

The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request.

Hide ParametersShow Parameters
"stop"
"tool_calls"
"length"
tool_callsarray of object
optional

The tool calls generated by the model, such as function calls.

Hide ParametersShow Parameters
idstring

The ID of the tool call.

functionobject

The function that the model called.

Hide ParametersShow Parameters
argumentsstring

The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.

namestring

The name of the function to call.

Create Chat Completion Response
CreateChatCompletionResponseobject

Response from a chat completion request.

ShowShow
completion_messageroleenumcontentunionstop_reasonenumtool_callsarray of objectCompletionMessage

The complete response message

idstring
optional

The unique identifier of the chat completion request.

metricsarray of object
optional
Hide ParametersShow Parameters
metricstring
valuenumber
unitstring
optional
Create Chat Completion Response Stream Chunk
CreateChatCompletionResponseStreamChunkobject

A chunk of a streamed chat completion response.

ShowShow
eventobject

The event containing the new content

Hide ParametersShow Parameters
deltaunion

Content generated since last event. This can be one or more tokens, or a tool call.

One of the following 2 object variants:
Hide ParametersShow Parameters
Textobject
Hide ParametersShow Parameters
textstring
typeenum
"text"
Hide ParametersShow Parameters
"text"
ToolCallobject
Hide ParametersShow Parameters
functionobject
Hide ParametersShow Parameters
argumentsstring
optional

The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.

namestring
optional

The name of the function to call.

typeenum
"tool_call"
Hide ParametersShow Parameters
"tool_call"
idstring
optional

The ID of the tool call.

event_typeenum
"start" OR "complete" OR "progress" OR "metrics"

Type of the event

Hide ParametersShow Parameters
"start"
"complete"
"progress"
"metrics"
metricsarray of object
optional
Hide ParametersShow Parameters
metricstring
valuenumber
unitstring
optional
stop_reasonenum
optional
"stop" OR "tool_calls" OR "length"

The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request.

Hide ParametersShow Parameters
"stop"
"tool_calls"
"length"
idstring
optional

The unique identifier of the chat completion request.

Message
Messageunion

A message from the user in a chat conversation.

ShowShow
contentunionroleenumUserMessage
contentunionroleenumSystemMessage
contentunionroleenumtool_call_idstringToolResponseMessage
roleenumcontentunionstop_reasonenumtool_callsarray of objectCompletionMessage
Message Image Content Item
MessageImageContentItemobject

A image content item

ShowShow
image_urlobject

Contains either an image URL or a data URL for a base64 encoded image.

Hide ParametersShow Parameters
urlstring

Either a URL of the image or the base64 encoded image data.

formaturi
typeenum
"image_url"

Discriminator type of the content item. Always "image"

Hide ParametersShow Parameters
"image_url"
Message Text Content Item
MessageTextContentItemobject

A text content item

ShowShow
textstring

Text content

typeenum
"text"

Discriminator type of the content item. Always "text"

Hide ParametersShow Parameters
"text"
System Message
SystemMessageobject

A system message providing instructions or context to the model.

ShowShow
contentunion
string OR array of textstringtypeenumMessageTextContentItem

The content of the system message.

Hide ParametersShow Parameters
TextContentstring

The text contents of the message.

ArrayOfContentItemsarray of textstringtypeenumMessageTextContentItem

A list of content items, which can include text and other media. Supported content types differ based on model.

roleenum
"system"

Must be "system" to identify this as a system message

Hide ParametersShow Parameters
"system"
Tool Response Message
ToolResponseMessageobject

A message representing the result of a tool invocation.

ShowShow
contentunion
string OR array of textstringtypeenumMessageTextContentItem

The content of the user message, which can include text and other media.

Hide ParametersShow Parameters
TextContentstring

The text contents of the message.

ArrayOfContentItemsarray of textstringtypeenumMessageTextContentItem

A list of content items, which can include text and other media. Supported content types differ based on model.

roleenum
"tool"

Must be "tool" to identify this as a tool response

Hide ParametersShow Parameters
"tool"
tool_call_idstring

Unique identifier for the tool call this response is for

User Message
UserMessageobject

A message from the user in a chat conversation.

ShowShow
contentunion
string OR array of textstringtypeenumMessageTextContentItem OR image_urlobjecttypeenumMessageImageContentItem

The content of the user message, which can include text and other media.

Hide ParametersShow Parameters
TextContentstring

The text contents of the message.

ArrayOfContentItemsarray of union

A list of content items, which can include text and other media. Supported content types differ based on model.

Hide ParametersShow Parameters
textstringtypeenumMessageTextContentItem
image_urlobjecttypeenumMessageImageContentItem
roleenum
"user"

Must be "user" to identify this as a user message.

Hide ParametersShow Parameters
"user"

ChatCompletions

Create
post/chat/completions