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.

routing
ProviderRoutingPreferences · object | null

How to pick between the providers that serve the requested model. Applies only when model is a model name with no provider prefix (e.g. 'gpt-5.5'); ignored for a concrete 'provider/model' id, which already names its provider. This does not choose the model — for that see router_candidates with model='@edenai'.

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
session_id
string | null

Identifies a conversation, so its requests keep reaching the provider that holds its prompt cache. Any stable string you choose — a thread id, a ticket number, an agent run. Also accepted as the x-session-id header, for clients that cannot add body fields; the body field wins if both are sent. Without one, a conversation is recognised from its opening messages instead.

Maximum string length: 256
router_candidates
string[] | null

Models the '@edenai' router may choose BETWEEN — it picks the model, whereas routing picks the provider for a model you already named. Used only when 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. An integer between 0 and 20.

Required range: 0 <= 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) 'scale' / 'priority': OpenAI scale and priority processing tiers

Available options:
auto,
default,
flex,
scale,
priority
stop

Stop sequence(s) that end generation: a single string or a list of up to 4 strings.

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

Controls function calling (legacy). The string 'none' or 'auto', or an object forcing a specific function, e.g. {'name': 'my_function'}.

Available options:
none,
auto
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
prompt_cache_key
string | null

Prompt-cache routing hint (OpenAI): requests sharing a key and a common prompt prefix are routed to the same cache shard, improving hit rates for high-volume shared prefixes. Forwarded to providers that support it, dropped elsewhere. Also read for provider stickiness when no session_id or x-session-id is given.

prompt_cache_retention

How long the provider retains the prompt cache — OpenAI currently accepts "in_memory" (provider default, typically 5-10 minutes) and "24h" (extended retention, supported on gpt-5.x and gpt-4.1). The known values are advertised in the schema but not enforced: the value is passed through verbatim for the provider to validate, so new provider values work without an Eden AI release. Dropped for providers that don't support it.

Available options:
in_memory,
24h
prompt_cache_options
PromptCacheOptions · object | null

Request-level prompt-cache settings (mode and ttl) for OpenAI GPT-5.6 and newer models. Ignored by models that don't support prompt caching.

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.