Skip to content

Chat completion (RAG-capable)

POST
/v1/adapters/llm/chat/completion
curl --request POST \
--url https://example.com/v1/adapters/llm/chat/completion \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "model": "example", "messages": [ { "role": "example", "content": "example", "name": "example", "function_call": { "name": "example", "arguments": "example" }, "tool_calls": [ { "id": "example", "type": "example", "function": { "name": "example", "arguments": "example" } } ], "tool_call_id": "example" } ], "max_tokens": 1, "temperature": 1, "top_p": 1, "n": 1, "stream": true, "stop": [ "example" ], "presence_penalty": 1, "frequency_penalty": 1, "logit_bias": { "additionalProperty": 1 }, "logprobs": true, "top_logprobs": 1, "user": "example", "seed": 1, "response_format": {}, "tools": [ { "type": "example", "function": { "name": "example", "description": "example", "parameters": {} } } ], "tool_choice": "example", "functions": [ { "name": "example", "description": "example", "parameters": {} } ], "function_call": "example", "parallel_tool_calls": "example", "stream_options": {}, "engine": "open_ai", "provider": "example", "backend": "example", "gdpr_required": true, "metadata": { "call_sid": "example", "campaign_sid": "example", "scenario_sid": "example", "node_id": "example", "account_sid": "example", "target": "example", "source": "example", "is_test": true }, "fallback_model": "example", "rag": { "document": { "ids": [ "example" ], "number": 1, "threshold": 1 }, "is_limit_with_documents": true } }'
Media typeapplication/json
object
model
required
string
messages
required
Array<object>

A chat message. Content is a string; multimodal content is not supported.

object
role
required
string
content
required
string
name
string
function_call

A model-emitted function call (deprecated single-function form).

object
name
string
arguments

JSON-encoded argument string.

string
tool_calls
Array<object>
object
id
required
string
type
required
string
function
required

The function name and JSON-encoded arguments carried by a tool call.

object
name
string
arguments
string
tool_call_id
string
max_tokens
integer
temperature
number format: float
top_p
number format: float
n
integer
stream
boolean
stop
Array<string>
presence_penalty
number format: float
frequency_penalty
number format: float
logit_bias
object
key
additional properties
integer
logprobs
boolean
top_logprobs
integer
user
string
seed
integer
response_format
object
key
additional properties
any
tools
Array<object>
object
type
required
string
function
object
name
required
string
description
string
parameters
required

JSON-Schema parameter definition, kept deliberately loose.

object
key
additional properties
any
tool_choice

Tool-selection control: “none”/“auto”/“required” or an object.

functions
Array<object>
object
name
required
string
description
string
parameters
required

JSON-Schema parameter definition, kept deliberately loose.

object
key
additional properties
any
function_call

Function-selection control (deprecated): “none”/“auto” or an object.

parallel_tool_calls

Whether tool calls may run in parallel.

stream_options
object
key
additional properties
any
engine
string
Allowed values: open_ai azure
provider
string
backend
string
gdpr_required
boolean
metadata
object
call_sid
string
campaign_sid
string
scenario_sid
string
node_id
string
account_sid
string
target

Entity|intent|fallback|streaming

string
source

Hermes|bff|ss|ids

string
is_test
boolean
fallback_model
string
rag
object
document
object
ids
Array<string>
number
integer
threshold
number format: float
is_limit_with_documents
boolean

OK

Media typeapplication/json
object
id
required
string
object
required
string
created
required
integer format: int64
model
required
string
choices
required
Array<object>
object
index
required
integer
message
required

A chat message. Content is a string; multimodal content is not supported.

object
role
required
string
content
required
string
name
string
function_call

A model-emitted function call (deprecated single-function form).

object
name
string
arguments

JSON-encoded argument string.

string
tool_calls
Array<object>
object
id
required
string
type
required
string
function
required

The function name and JSON-encoded arguments carried by a tool call.

object
name
string
arguments
string
tool_call_id
string
finish_reason
required
string
logprobs

Per-token log-probability detail.

usage
required
object
prompt_tokens
required
integer
completion_tokens
required
integer
total_tokens
required
integer
system_fingerprint
required
string
Examplegenerated
{
"id": "example",
"object": "example",
"created": 1,
"model": "example",
"choices": [
{
"index": 1,
"message": {
"role": "example",
"content": "example",
"name": "example",
"function_call": {
"name": "example",
"arguments": "example"
},
"tool_calls": [
{
"id": "example",
"type": "example",
"function": {
"name": "example",
"arguments": "example"
}
}
],
"tool_call_id": "example"
},
"finish_reason": "example",
"logprobs": "example"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"system_fingerprint": "example"
}

Invalid request body or parameters

Media typeapplication/json

Canonical structured error emitted by the chat completion, chat stream and embeddings handlers (the shared errorResponse helper). code is an application error code (0 when unset); status mirrors the HTTP status.

object
name
required
string
message
required
string
code
required
integer
status
required
integer
Examplegenerated
{
"name": "example",
"message": "example",
"code": 1,
"status": 1
}

Unauthorized

Forbidden

Upstream provider timed out

Media typeapplication/json

Canonical structured error emitted by the chat completion, chat stream and embeddings handlers (the shared errorResponse helper). code is an application error code (0 when unset); status mirrors the HTTP status.

object
name
required
string
message
required
string
code
required
integer
status
required
integer
Examplegenerated
{
"name": "example",
"message": "example",
"code": 1,
"status": 1
}

Internal server error

Media typeapplication/json

Canonical structured error emitted by the chat completion, chat stream and embeddings handlers (the shared errorResponse helper). code is an application error code (0 when unset); status mirrors the HTTP status.

object
name
required
string
message
required
string
code
required
integer
status
required
integer
Examplegenerated
{
"name": "example",
"message": "example",
"code": 1,
"status": 1
}

Bad gateway (upstream adapter error)