Chat completion

Processes a chat request to the LLM using the caller's active agent configuration. Returns a non-streaming JSON response by default, or an SSE stream if streamingEnabled is set to true in the request body.

Body Params

Chat completion request. Messages array is required and contains conversation history. Each message has role (system, user, assistant, tool) and content. Optional agentId and agentRevisionId specify which agent to use. Model and temperature are optional and will use agent defaults if not provided. Set streamingEnabled to true to receive an SSE stream instead of a JSON response. Requires agent owner to have a valid paid account (agent_owner_payment_required middleware).

messages
array of objects
required

Ordered list of chat messages forming the conversation. The first message is typically a system prompt injected from the agent, the rest are user/assistant turns.

messages*
string | null

Optional ID of an existing agent to use. When provided, the server loads the agent and its current (or specified) revision.

integer | null

Optional specific agent revision ID to use instead of the agent's current_revision.

string

Name for a virtual (ad‑hoc) agent when agentId is not provided.

string

System/master prompt to steer the agent. If omitted and an agentId is provided, the agent's stored masterPrompt is used.

string

Introductory text shown to users for a virtual agent when agentId is not provided.

string

Image size/format hint for models that can generate images (implementation‑specific, e.g. "1024x1024").

string

Model identifier to use for this request (overrides the agent's configured model when provided).

float

Sampling temperature for the model.

float

Nucleus sampling parameter (top_p).

integer

Maximum number of tokens for the completion. Subject to global model limits.

string | null

Reasoning effort hint for models that support explicit reasoning modes.

boolean | null

Enables extended "thinking" for models that support it (model‑ specific feature).

integer | null

Token budget reserved for thinking when thinkingEnabled is true.

boolean

When true, scrubs PII from messages based on piiThreshold before sending to the model.

float

PII detection confidence threshold used when scrubPii is enabled.

boolean

When true, uses smart document evaluation with embeddings for alignment data placeholders.

integer

Chunk size (in characters) for smart document evaluation.

integer

Overlap (in characters) between chunks for smart document evaluation.

string

Embedding model name used for smart document evaluation.

integer

Number of top relevant chunks to retrieve during smart document evaluation.

boolean

When true, performs full document analysis over alignment data placeholders without streaming.

integer

Chunk size (in characters) for full document analysis.

integer

Overlap (in characters) between chunks for full document analysis.

integer

Maximum total length of text considered during full document analysis.

boolean

Enables MCP (Model Context Protocol) tools for this request if supported by the model.

mcpServerNames
array of strings

List of MCP server names that may be used by this agent/request.

mcpServerNames
boolean

When true, automatically approves MCP tool calls without requiring explicit user confirmation.

boolean | null

Enables structured JSON output for this request. Resolution logic:

  • true with jsonSchema provided: uses the request schema.
  • true without jsonSchema: falls back to the agent's stored schema.
  • true with no schema in request or on agent: returns an error.
  • false: disables JSON output even if enabled on the agent.
  • Not sent: uses the agent's own jsonOutputEnabled setting.
jsonSchema
object | null

JSON Schema object defining the structure of the expected response. Used only when jsonOutputEnabled is true. When omitted, the agent's stored jsonSchema is used as a fallback.

boolean

When true, enables Server-Sent Events (SSE) streaming for this request. When set to true, the endpoint will return an SSE stream instead of a JSON response. Defaults to false.

Responses

Language
Credentials
Bearer
JWT
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json