Skip to content

Chat

ChatCompletions

ModelsExpand Collapse
ChatCompletion object { id, choices, created, 5 more }
id: string
choices: array of object { finish_reason, index, message, logprobs }
finish_reason: "stop" or "length" or "tool_calls" or 2 more
One of the following:
"stop"
"length"
"tool_calls"
"content_filter"
"function_call"
index: number
message: object { role, annotations, audio, 4 more }

A chat completion message generated by the model.

role: "assistant"
annotations: optional array of object { type, url_citation }
type: "url_citation"
url_citation: object { end_index, start_index, title, url }

A URL citation when using web search.

end_index: number
start_index: number
title: string
url: string
audio: optional object { 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.

id: string
data: string
expires_at: number
transcript: string
content: optional string
function_call: optional object { arguments, name }

Deprecated and replaced by tool_calls.

The name and arguments of a function that should be called, as generated by the model.

arguments: string
name: string
refusal: optional string
tool_calls: optional array of object { id, function, type } or object { id, custom, type }
One of the following:
ChatCompletionMessageFunctionToolCall object { id, function, type }

A call to a function tool created by the model.

id: string
function: object { arguments, name }

The function that the model called.

arguments: string
name: string
type: "function"
ChatCompletionMessageCustomToolCall object { id, custom, type }

A call to a custom tool created by the model.

id: string
custom: object { input, name }

The custom tool that the model called.

input: string
name: string
type: "custom"
logprobs: optional ChoiceLogprobs { content, refusal }

Log probability information for the choice.

content: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
refusal: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
created: number
model: string
object: optional "chat.completion"
service_tier: optional "auto" or "default" or "flex" or 2 more
One of the following:
"auto"
"default"
"flex"
"scale"
"priority"
system_fingerprint: optional string
usage: optional CompletionUsage { completion_tokens, prompt_tokens, total_tokens, 2 more }

Usage statistics for the completion request.

completion_tokens: number
prompt_tokens: number
total_tokens: number
completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, rejected_prediction_tokens }

Breakdown of tokens used in a completion.

accepted_prediction_tokens: optional number
audio_tokens: optional number
reasoning_tokens: optional number
rejected_prediction_tokens: optional number
prompt_tokens_details: optional object { audio_tokens, cached_tokens }

Breakdown of tokens used in the prompt.

audio_tokens: optional number
cached_tokens: optional number
ChatCompletionChunk object { id, choices, created, 5 more }
id: string
choices: array of object { delta, index, finish_reason, logprobs }
delta: object { content, function_call, refusal, 2 more }

A chat completion delta generated by streamed model responses.

content: optional string
function_call: optional object { arguments, name }

Deprecated and replaced by tool_calls.

The name and arguments of a function that should be called, as generated by the model.

arguments: optional string
name: optional string
refusal: optional string
role: optional "developer" or "system" or "user" or 2 more
One of the following:
"developer"
"system"
"user"
"assistant"
"tool"
tool_calls: optional array of object { index, id, function, type }
index: number
id: optional string
function: optional object { arguments, name }
arguments: optional string
name: optional string
type: optional "function"
index: number
finish_reason: optional "stop" or "length" or "tool_calls" or 2 more
One of the following:
"stop"
"length"
"tool_calls"
"content_filter"
"function_call"
logprobs: optional ChoiceLogprobs { content, refusal }

Log probability information for the choice.

content: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
refusal: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
created: number
model: string
object: optional "chat.completion.chunk"
service_tier: optional "auto" or "default" or "flex" or 2 more
One of the following:
"auto"
"default"
"flex"
"scale"
"priority"
system_fingerprint: optional string
usage: optional CompletionUsage { completion_tokens, prompt_tokens, total_tokens, 2 more }

Usage statistics for the completion request.

completion_tokens: number
prompt_tokens: number
total_tokens: number
completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, rejected_prediction_tokens }

Breakdown of tokens used in a completion.

accepted_prediction_tokens: optional number
audio_tokens: optional number
reasoning_tokens: optional number
rejected_prediction_tokens: optional number
prompt_tokens_details: optional object { audio_tokens, cached_tokens }

Breakdown of tokens used in the prompt.

audio_tokens: optional number
cached_tokens: optional number
ChatCompletionTokenLogprob object { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
ChoiceLogprobs object { content, refusal }

Log probability information for the choice.

content: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
refusal: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
InferenceModelVendor = "openai" or "cohere" or "vertex_ai" or 9 more
One of the following:
"openai"
"cohere"
"vertex_ai"
"anthropic"
"azure"
"gemini"
"launch"
"llmengine"
"model_zoo"
"bedrock"
"xai"
"fireworks_ai"
ModelDefinition object { model_name, model_type, model_vendor, model_availability }
model_name: string

model name, for example gpt-4o

model_type: InferenceModelType

model type, for example chat_completion

One of the following:
"generic"
"completion"
"chat_completion"
model_vendor: InferenceModelVendor

model vendor, for example openai

One of the following:
"openai"
"cohere"
"vertex_ai"
"anthropic"
"azure"
"gemini"
"launch"
"llmengine"
"model_zoo"
"bedrock"
"xai"
"fireworks_ai"
model_availability: optional InferenceModelAvailability

model availability indicating availability status, for example available

One of the following:
"unknown"
"available"
"unavailable"
SortOrder = "asc" or "desc"
One of the following:
"asc"
"desc"
CompletionModelsResponse object { items, object }
items: array of ModelDefinition { model_name, model_type, model_vendor, model_availability }
model_name: string

model name, for example gpt-4o

model_type: InferenceModelType

model type, for example chat_completion

One of the following:
"generic"
"completion"
"chat_completion"
model_vendor: InferenceModelVendor

model vendor, for example openai

One of the following:
"openai"
"cohere"
"vertex_ai"
"anthropic"
"azure"
"gemini"
"launch"
"llmengine"
"model_zoo"
"bedrock"
"xai"
"fireworks_ai"
model_availability: optional InferenceModelAvailability

model availability indicating availability status, for example available

One of the following:
"unknown"
"available"
"unavailable"
object: optional "list"
CompletionCreateResponse = ChatCompletion { id, choices, created, 5 more } or ChatCompletionChunk { id, choices, created, 5 more }
One of the following:
ChatCompletion object { id, choices, created, 5 more }
id: string
choices: array of object { finish_reason, index, message, logprobs }
finish_reason: "stop" or "length" or "tool_calls" or 2 more
One of the following:
"stop"
"length"
"tool_calls"
"content_filter"
"function_call"
index: number
message: object { role, annotations, audio, 4 more }

A chat completion message generated by the model.

role: "assistant"
annotations: optional array of object { type, url_citation }
type: "url_citation"
url_citation: object { end_index, start_index, title, url }

A URL citation when using web search.

end_index: number
start_index: number
title: string
url: string
audio: optional object { 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.

id: string
data: string
expires_at: number
transcript: string
content: optional string
function_call: optional object { arguments, name }

Deprecated and replaced by tool_calls.

The name and arguments of a function that should be called, as generated by the model.

arguments: string
name: string
refusal: optional string
tool_calls: optional array of object { id, function, type } or object { id, custom, type }
One of the following:
ChatCompletionMessageFunctionToolCall object { id, function, type }

A call to a function tool created by the model.

id: string
function: object { arguments, name }

The function that the model called.

arguments: string
name: string
type: "function"
ChatCompletionMessageCustomToolCall object { id, custom, type }

A call to a custom tool created by the model.

id: string
custom: object { input, name }

The custom tool that the model called.

input: string
name: string
type: "custom"
logprobs: optional ChoiceLogprobs { content, refusal }

Log probability information for the choice.

content: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
refusal: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
created: number
model: string
object: optional "chat.completion"
service_tier: optional "auto" or "default" or "flex" or 2 more
One of the following:
"auto"
"default"
"flex"
"scale"
"priority"
system_fingerprint: optional string
usage: optional CompletionUsage { completion_tokens, prompt_tokens, total_tokens, 2 more }

Usage statistics for the completion request.

completion_tokens: number
prompt_tokens: number
total_tokens: number
completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, rejected_prediction_tokens }

Breakdown of tokens used in a completion.

accepted_prediction_tokens: optional number
audio_tokens: optional number
reasoning_tokens: optional number
rejected_prediction_tokens: optional number
prompt_tokens_details: optional object { audio_tokens, cached_tokens }

Breakdown of tokens used in the prompt.

audio_tokens: optional number
cached_tokens: optional number
ChatCompletionChunk object { id, choices, created, 5 more }
id: string
choices: array of object { delta, index, finish_reason, logprobs }
delta: object { content, function_call, refusal, 2 more }

A chat completion delta generated by streamed model responses.

content: optional string
function_call: optional object { arguments, name }

Deprecated and replaced by tool_calls.

The name and arguments of a function that should be called, as generated by the model.

arguments: optional string
name: optional string
refusal: optional string
role: optional "developer" or "system" or "user" or 2 more
One of the following:
"developer"
"system"
"user"
"assistant"
"tool"
tool_calls: optional array of object { index, id, function, type }
index: number
id: optional string
function: optional object { arguments, name }
arguments: optional string
name: optional string
type: optional "function"
index: number
finish_reason: optional "stop" or "length" or "tool_calls" or 2 more
One of the following:
"stop"
"length"
"tool_calls"
"content_filter"
"function_call"
logprobs: optional ChoiceLogprobs { content, refusal }

Log probability information for the choice.

content: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
refusal: optional array of ChatCompletionTokenLogprob { token, logprob, top_logprobs, bytes }
token: string
logprob: number
top_logprobs: array of object { token, logprob, bytes }
token: string
logprob: number
bytes: optional array of number
bytes: optional array of number
created: number
model: string
object: optional "chat.completion.chunk"
service_tier: optional "auto" or "default" or "flex" or 2 more
One of the following:
"auto"
"default"
"flex"
"scale"
"priority"
system_fingerprint: optional string
usage: optional CompletionUsage { completion_tokens, prompt_tokens, total_tokens, 2 more }

Usage statistics for the completion request.

completion_tokens: number
prompt_tokens: number
total_tokens: number
completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, rejected_prediction_tokens }

Breakdown of tokens used in a completion.

accepted_prediction_tokens: optional number
audio_tokens: optional number
reasoning_tokens: optional number
rejected_prediction_tokens: optional number
prompt_tokens_details: optional object { audio_tokens, cached_tokens }

Breakdown of tokens used in the prompt.

audio_tokens: optional number
cached_tokens: optional number