Chat Completions
OpenAI-compatible chat completions endpoint (v3).
Request
- Base URLhttps://api.edenai.run
- AuthHTTP bearer
Request body
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']
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, and read from the headers coding agents already send (x-claude-code-session-id, x-session-affinity, session-id, session_id, and x-client-request-id from pi and Codex); the body field wins if both are sent. Without one, a conversation is recognised from its opening messages instead.
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 is a bare model name (e.g. 'gpt-5.5' — the winner's provider is then picked like any provider-less request) or a 'provider/model' id (e.g. 'openai/gpt-5-nano' — the winner is served by that exact provider). Entries the router cannot rank are skipped and listed under edenai_metadata.routing.auto.dropped; entries naming a model already in the list collapse into its earliest spelling, which decides how the winner is returned. The request fails only when no entry is left. If not provided, the router chooses from a default pool of eligible catalog models. At most 64 entries of up to 128 characters each.
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'}}]
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': {...}}}]
The name of the LLM model to use.
The number of completions to generate for each prompt. Defaults to 1.
The reasoning effort level for the LLM model.
Object of metadata associated with the chat request. Can be used to provide additional context or tracking information.
Penalty for repeated tokens in the output.
Logit bias to influence token generation.
Whether to include log probabilities of tokens in the output. Defaults to False.
Number of top log probabilities to return with each token. An integer between 0 and 20.
The maximum number of tokens to generate in the chat completion
An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
List of supported input/output modalities for the chat.
field for storing prediction-related information.
dictionary for audio-related parameters or metadata.
Penalty for new tokens based on their presence in the text so far.
Specify the desired response format for the completion.
Seed for random number generation.
'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
Whether to stream the response in real-time. Defaults to False.
Options for streaming responses, such as chunk size or format.
Sampling temperature for controlling randomness in output.
Nucleus sampling parameter for controlling diversity in output. Defaults to 1.0.
List of tools that can be used by the model to assist in generating responses.
Whether to allow parallel tool calls in the completion.
User identifier for tracking or personalization purposes.
List of functions that can be called by the model to assist in generating responses.
Parameters related to the model's reasoning or thinking process.
Options for web search integration. Example: json web_search_options={ "search_context_size": "medium" # Options: "low", "medium", "high" }
Hint the model to be more or less expansive in its replies. Values: "low", "medium", "high". low (gpt5 models)
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 session header is given.
Additional parameters to pass in the request body to the provider API.
Additional HTTP headers to pass to the provider API.
Example request
{
"tags": {
"client": "acme",
"project": "invoices"
}
}Response
Successful Response
Unique identifier for the chat completion.
Object type. Always 'chat.completion' for this endpoint.
Unix timestamp (seconds) when the completion was created.
Model that produced the completion.
Backend configuration fingerprint that produced the response.
Service tier that processed the request.
Changes
No recorded changes to this operation across all 1 revision of this API.