Skip to main content
POST
Generate OpenAI chat completion from messages

Authorizations

x-api-key
string
header
required

Headers

x-api-key
string | null
x-openai-api-key
string | null
x-selected-account-id
string | null

Body

application/json
model
string
required

model specified as model_vendor/model, for example openai/gpt-4o

messages
Messages · object[]
required

openai standard message format

top_k
integer | null

Only sample from the top K options for each subsequent token

frequency_penalty
number | null

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far.

Required range: -2 <= x <= 2
function_call
Function Call · object | null

Deprecated in favor of tool_choice. Controls which function is called by the model.

functions
Functions · object[] | null

Deprecated in favor of tools. A list of functions the model may generate JSON inputs for.

logit_bias
Logit Bias · object | null

Modify the likelihood of specified tokens appearing in the completion. Maps tokens to bias values from -100 to 100.

logprobs
boolean | null

Whether to return log probabilities of the output tokens or not.

max_completion_tokens
integer | null

An upper bound for the number of tokens that can be generated, including visible output tokens and reasoning tokens.

max_tokens
integer | null

Deprecated in favor of max_completion_tokens. The maximum number of tokens to generate.

metadata
Metadata · object | null

Developer-defined tags and values used for filtering completions in the dashboard.

modalities
string[] | null

Output types that you would like the model to generate for this request.

n
integer | null

How many chat completion choices to generate for each input message.

parallel_tool_calls
boolean | null

Whether to enable parallel function calling during tool use.

prediction
Prediction · object | null

Static predicted output content, such as the content of a text file being regenerated.

presence_penalty
number | null

Number between -2.0 and 2.0. Positive values penalize tokens based on whether they appear in the text so far.

Required range: -2 <= x <= 2
reasoning_effort
string | null

For o1 models only. Constrains effort on reasoning. Values: low, medium, high.

response_format
Response Format · object | null

An object specifying the format that the model must output.

seed
integer | null

If specified, system will attempt to sample deterministically for repeated requests with same seed.

stop

Up to 4 sequences where the API will stop generating further tokens.

store
boolean | null

Whether to store the output for use in model distillation or evals products.

stream
boolean | null

If true, partial message deltas will be sent as server-sent events.

stream_options
Stream Options · object | null

Options for streaming response. Only set this when stream is true.

temperature
number | null

What sampling temperature to use. Higher values make output more random, lower more focused.

Required range: 0 <= x <= 2
tool_choice

Controls which tool is called by the model. Values: none, auto, required, or specific tool.

tools
Tools · object[] | null

A list of tools the model may call. Currently, only functions are supported. Max 128 functions.

top_logprobs
integer | null

Number of most likely tokens to return at each position, with associated log probability.

Required range: 0 <= x <= 20
top_p
number | null

Alternative to temperature. Only tokens comprising top_p probability mass are considered.

Required range: 0 <= x <= 1
audio
Audio · object | null

Parameters for audio output. Required when audio output is requested with modalities: ['audio'].

Response

Successful Response

id
string
required
choices
Choice · object[]
required
created
integer
required
model
string
required
object
string
default:chat.completion
Allowed value: "chat.completion"
service_tier
enum<string> | null
Available options:
auto,
default,
flex,
scale,
priority
system_fingerprint
string | null
usage
CompletionUsage · object | null

Usage statistics for the completion request.