Skip to main content
POST
/
v3
/
chat
/
completions
Chat Completions
curl --request POST \
  --url https://api.edenai.run/v3/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "messages": [
    {
      "content": "<string>"
    }
  ],
  "fallbacks": [
    "<string>"
  ],
  "router_candidates": [
    "<string>"
  ],
  "pre_hooks": [
    {}
  ],
  "post_hooks": [
    {}
  ],
  "n": 1,
  "metadata": {},
  "frequency_penalty": 0,
  "logit_bias": {},
  "logprobs": false,
  "top_logprobs": 10,
  "max_tokens": 2,
  "max_completion_tokens": 2,
  "modalities": [
    "<string>"
  ],
  "prediction": {},
  "audio": {},
  "presence_penalty": 0,
  "response_format": {},
  "seed": 123,
  "stop": [
    "<string>"
  ],
  "stream": false,
  "stream_options": {},
  "temperature": 1,
  "top_p": 1,
  "tools": [
    {}
  ],
  "tool_choice": "<string>",
  "parallel_tool_calls": true,
  "user": "<string>",
  "function_call": {},
  "functions": [
    {}
  ],
  "thinking": {},
  "web_search_options": {},
  "extra_body": {},
  "image_config": {
    "aspect_ratio": "<string>",
    "image_size": "<string>"
  },
  "extra_headers": {}
}
'
{
  "id": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "<string>",
        "tool_calls": [
          {}
        ],
        "refusal": "<string>",
        "reasoning_content": "<string>"
      },
      "logprobs": {}
    }
  ],
  "object": "chat.completion",
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "prompt_tokens_details": {},
    "completion_tokens_details": {}
  },
  "system_fingerprint": "<string>",
  "service_tier": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://www.edenai.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

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

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

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

field for storing prediction-related information.

audio
Audio · object

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

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

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 like {'type': 'function', 'function': {'name': 'tool_name'}} 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

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

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

web_search_options
Web Search Options · object

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

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

image_config
GeminiImageConfig · object

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

extra_headers
Extra Headers · object

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

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.