Skip to content
GitHub Login

Create a chat completion

POST
/v1/chat/completions
object
messages
required
Array<object>
object
role
required
string
Allowed values: system user assistant developer tool
content
string
name
string
refusal
string
tool_calls
Array<object>
object
id
required
string
type
required
string
function
object
name
required
string
arguments
required
string
tool_call_id
string
model
required
string
reasoning_effort
string
Allowed values: minimal medium high
stream
boolean
stream_options
object
include_usage
boolean
parallel_tool_calls
boolean
user
string
tools
Array<object>
object
type
required
string
Example
function
function
required
object
name
required
string
description
string
parameters
object
type
string
Allowed values: object array string number boolean integer null
description
string
properties
object
key
additional properties
object
type
string
Allowed values: object array string number boolean integer null
description
string
properties
object recursive
required
Array<string>
items
object recursive
enum
Array
additionalProperties
boolean
required
Array<string>
items
object recursive
enum
Array
additionalProperties
boolean
strict
boolean
frequency_penalty
number format: float
logit_bias
object
key
additional properties
integer
logprobs
boolean
top_logprobs
integer
max_completion_tokens
integer
n
integer
presence_penalty
integer
response_format
object
type
required
string
Allowed values: text json_object json_schema
json_schema
object
description
string
name
required
string
schema
required
object
type
string
Allowed values: object array string number boolean integer null
description
string
properties
object
key
additional properties
object
type
string
Allowed values: object array string number boolean integer null
description
string
properties
object recursive
required
Array<string>
items
object recursive
enum
Array
additionalProperties
boolean
required
Array<string>
items
object recursive
enum
Array
additionalProperties
boolean
strict
boolean
stop
Array<string>
temperature
number format: float
top_p
number format: float

Chat completion response

object
id
required
string
created
required
integer format: int64
model
required
string
object
required
string
Example
chat.completion
usage
required
object
completion_tokens
required
integer
prompt_tokens
required
integer
total_tokens
required
integer
total_time
number format: float
choices
required
Array<object>
object
finish_reason
required
string
Allowed values: stop length tool_calls content_filter
index
required
integer
message
required
object
role
required
string
Allowed values: system user assistant developer tool
content
string
name
string
refusal
string
tool_calls
Array<object>
object
id
required
string
type
required
string
function
object
name
required
string
arguments
required
string
tool_call_id
string

Unauthorized

object
error
object
message
string
type
string
code
string

Rate limited

object
error
object
message
string
type
string
code
string