Chat
ChatCompletions
List available chat completion models
client.chat.completions.models(CompletionModelsParams { ending_before, limit, model_vendor, 3 more } query?, RequestOptionsoptions?): CompletionModelsResponse { items, object }
GET/v5/chat/completions/models
Generate OpenAI chat completion from messages
client.chat.completions.create(CompletionCreateParamsparams, RequestOptionsoptions?): CompletionCreateResponse | Stream<ChatCompletionChunk { id, choices, created, 5 more } >
POST/v5/chat/completions
ModelsExpand Collapse
ChatCompletion { id, choices, created, 5 more }
ChatCompletion { id, choices, created, 5 more }
choices: Array<Choice>
choices: Array<Choice>
message: Message { role, annotations, audio, 4 more } A chat completion message generated by the model.
message: Message { role, annotations, audio, 4 more }
A chat completion message generated by the model.
audio?: Audio { id, data, expires_at, transcript } If the audio output modality is requested, this object contains data
about the audio response from the model. Learn more.
audio?: Audio { id, data, expires_at, transcript }
If the audio output modality is requested, this object contains data about the audio response from the model. Learn more.
function_call?: FunctionCall { arguments, name } Deprecated and replaced by tool_calls.
The name and arguments of a function that should be called, as generated by the model.
function_call?: FunctionCall { arguments, name }
Deprecated and replaced by tool_calls.
The name and arguments of a function that should be called, as generated by the model.
ChatCompletionChunk { id, choices, created, 5 more }
ChatCompletionChunk { id, choices, created, 5 more }
choices: Array<Choice>
choices: Array<Choice>
delta: Delta { content, function_call, refusal, 2 more } A chat completion delta generated by streamed model responses.
delta: Delta { content, function_call, refusal, 2 more }
A chat completion delta generated by streamed model responses.
CompletionCreateResponse = ChatCompletion { id, choices, created, 5 more } | ChatCompletionChunk { id, choices, created, 5 more }
CompletionCreateResponse = ChatCompletion { id, choices, created, 5 more } | ChatCompletionChunk { id, choices, created, 5 more }
One of the following:
ChatCompletion { id, choices, created, 5 more }
ChatCompletion { id, choices, created, 5 more }
choices: Array<Choice>
choices: Array<Choice>
message: Message { role, annotations, audio, 4 more } A chat completion message generated by the model.
message: Message { role, annotations, audio, 4 more }
A chat completion message generated by the model.
audio?: Audio { id, data, expires_at, transcript } If the audio output modality is requested, this object contains data
about the audio response from the model. Learn more.
audio?: Audio { id, data, expires_at, transcript }
If the audio output modality is requested, this object contains data about the audio response from the model. Learn more.
function_call?: FunctionCall { arguments, name } Deprecated and replaced by tool_calls.
The name and arguments of a function that should be called, as generated by the model.
function_call?: FunctionCall { arguments, name }
Deprecated and replaced by tool_calls.
The name and arguments of a function that should be called, as generated by the model.
ChatCompletionChunk { id, choices, created, 5 more }
ChatCompletionChunk { id, choices, created, 5 more }
choices: Array<Choice>
choices: Array<Choice>
delta: Delta { content, function_call, refusal, 2 more } A chat completion delta generated by streamed model responses.
delta: Delta { content, function_call, refusal, 2 more }
A chat completion delta generated by streamed model responses.