Description | : Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data. The method makes a REST API call to the `/chat/completions` route on the given endpoint. |
Reference | : Link ¶ |
⚼ Request
POST:
/chat/completions
{
api-version:
string
,
extra-parameters:
string
,
body:
}
{
,
messages:
[
]
,
{
,
role:
enum
,
}
frequency_penalty:
number
,
stream:
boolean
,
presence_penalty:
number
,
temperature:
number
,
top_p:
number
,
max_tokens:
integer
,
response_format:
{
,
type:
string
,
}
stop:
[
,
string
,
]
tools:
[
]
,
{
,
type:
enum
,
function:
}
{
,
name:
string
,
description:
string
,
parameters:
object
,
}
tool_choice:
string
,
seed:
integer
,
model:
string
,
modalities:
}
[
,
string
,
]
⚐ Response (200)
{
id:
string
,
object:
enum
,
created:
integer
,
model:
string
,
choices:
[
]
,
{
,
index:
integer
,
finish_reason:
enum
,
message:
}
{
,
role:
enum
,
content:
string
,
tool_calls:
[
]
,
{
,
id:
string
,
type:
enum
,
function:
}
{
,
name:
string
,
arguments:
string
,
}
audio:
}
{
,
id:
string
,
expires_at:
integer
,
data:
string
,
format:
enum
,
transcript:
string
,
}
usage:
}
{
,
completion_tokens:
integer
,
prompt_tokens:
integer
,
total_tokens:
integer
,
completion_tokens_details:
{
,
audio_tokens:
integer
,
total_tokens:
integer
,
}
prompt_tokens_details:
}
{
,
audio_tokens:
integer
,
cached_tokens:
integer
,
}
⚐ Response (default)
{
$headers:
{
,
x-ms-error-code:
string
,
}
$schema:
}
{
,
error:
}
{
,
code:
string
,
message:
string
,
target:
string
,
details:
[
,
string
,
]
innererror:
}
{
,
code:
string
,
innererror:
string
,
}