Skip to main content
POST
Chat Completions

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required

The name of the LLM model to use.

messages
Message · object[]
required

The messages to send to the LLM model.

fallbacks
string[] | null

List of fallback model IDs to try if the primary model fails. Models are tried in order. Example: ['anthropic/claude-3-opus', 'openai/gpt-4o']

Maximum array length: 3
router_candidates
string[] | null

List of model candidates for dynamic routing when using model='@edenai'. Each entry should be 'provider/model', e.g. ['openai/gpt-4o', 'anthropic/claude-3-5-sonnet-20241022']. If not provided, defaults to all available models.

pre_hooks
Pre Hooks · object[] | null

List of hooks to run before the LLM provider call. Each entry must have an 'action' key and optional 'params'. Example: [{'action': 'pdf_text_extract', 'params': {'method': 'default'}}]

post_hooks
Post Hooks · object[] | null

List of hooks to run after the LLM provider call. Each entry must have an 'action' key and optional 'params'. Example: [{'action': 'json_heal', 'params': {'json_schema': {...}}}]

n
integer | null
default:1

The number of completions to generate for each prompt. Defaults to 1.

Required range: x >= 1
reasoning_effort
enum<string> | null

The reasoning effort level for the LLM model.

Available options:
minimal,
low,
medium,
high,
max,
xhigh,
disable,
none
metadata
Metadata · object | null

Object of metadata associated with the chat request. Can be used to provide additional context or tracking information.

frequency_penalty
number | null

Penalty for repeated tokens in the output.

Required range: -2 <= x <= 2
logit_bias
Logit Bias · object | null

Logit bias to influence token generation.

logprobs
boolean | null
default:false

Whether to include log probabilities of tokens in the output. Defaults to False.

top_logprobs
integer | null

Number of top log probabilities to return with each token.

Required range: 1 <= x <= 20
max_tokens
integer | null

The maximum number of tokens to generate in the chat completion

Required range: x >= 1
max_completion_tokens
integer | null

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

Required range: x >= 1
modalities
string[] | null

List of supported input/output modalities for the chat.

prediction
Prediction · object | null

field for storing prediction-related information.

audio
Audio · object | null

dictionary for audio-related parameters or metadata.

presence_penalty
number | null

Penalty for new tokens based on their presence in the text so far.

Required range: -2 <= x <= 2
response_format
Response Format · object | null

Specify the desired response format for the completion.

seed
integer | null

Seed for random number generation.

service_tier
enum<string> | null

'auto': Automatically select appropriate tier 'default': Use the default service tier 'flex': 50% cheaper processing with increased latency (OpenAI o3/o4-mini)

Available options:
auto,
default,
flex
stop
string[] | null

List of stop sequences to end the generation.

stream
boolean | null
default:false

Whether to stream the response in real-time. Defaults to False.

stream_options
Stream Options · object | null

Options for streaming responses, such as chunk size or format.

temperature
number | null

Sampling temperature for controlling randomness in output.

Required range: 0 <= x <= 2
top_p
number | null
default:1

Nucleus sampling parameter for controlling diversity in output. Defaults to 1.0.

Required range: 0 <= x <= 1
tools
Tools · object[] | null

List of tools that can be used by the model to assist in generating responses.

tool_choice

Specify how tools should be used. Can be 'auto', 'required', 'none', or an object to force a specific tool.

parallel_tool_calls
boolean | null

Whether to allow parallel tool calls in the completion.

user
string | null

User identifier for tracking or personalization purposes.

function_call
Function Call · object | null

Function call parameters for invoking specific functions during the chat.

functions
Functions · object[] | null

List of functions that can be called by the model to assist in generating responses.

thinking
Thinking · object | null

Parameters related to the model's reasoning or thinking process.

web_search_options
Web Search Options · object | null

Options for web search integration. Example: json web_search_options={ "search_context_size": "medium" # Options: "low", "medium", "high" }

verbosity
enum<string> | null

Hint the model to be more or less expansive in its replies. Values: "low", "medium", "high". low (gpt5 models)

Available options:
low,
medium,
high
extra_body
Extra Body · object | null

Additional parameters to pass in the request body to the provider API.

image_config
GeminiImageConfig · object | null

Image generation configuration for Google Gemini image models (e.g. google/gemini-2.5-flash-image).

extra_headers
Extra Headers · object | null

Additional HTTP headers to pass to the provider API.

Response

Successful Response

Response body for POST /chat/completions (non-streaming).

id
string
required

Unique identifier for the chat completion.

created
integer
required

Unix timestamp (seconds) when the completion was created.

model
string
required

Model that produced the completion.

choices
ChatCompletionChoice · object[]
required

List of completion choices generated for the request.

object
string
default:chat.completion

Object type. Always 'chat.completion' for this endpoint.

Allowed value: "chat.completion"
usage
ChatCompletionUsage · object | null

Token usage statistics for the request.

system_fingerprint
string | null

Backend configuration fingerprint that produced the response.

service_tier
string | null

Service tier that processed the request.