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.

Model catalog integration (recommended)

  1. GET /api/models?category=text — choose models[].name (not displayName).
  2. Optionally persist on the agent: PUT /api/agents/{agentId} with { "model": "<name>" }, or POST /api/agents when creating an agent.
  3. Call this endpoint with a saved agent's agentId (model from the agent revision), or include "model": "<name>" to override for a single request. Create the agent first via POST /api/agents if you do not have one yet.

Request examples prefixed with catalog_flow_ all include agentId (except step 1, which lists models).

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

Chat completion request. messages is required. Provide agentId to use a
persisted agent revision, or omit agentId for a phantom agent built from
request overrides and defaults (caller billing). Optional agentRevisionId
selects a specific revision when agentId is set. Set streamingEnabled to
true for SSE instead of JSON. Requires a valid paid account for the caller
(phantom) or agent owner (persisted agent).

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

Optional UUID of a persisted agent. When omitted, a phantom in-memory
agent revision is built from request fields and platform defaults; the
caller's organization is billed. Include model (and optionally
masterPrompt, temperature, etc.) for phantom requests.

integer | null

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

string

Optional per-request override of the agent revision master prompt
(agent owner only). When omitted, the revision's stored masterPrompt is used.

string

Optional override of the agent revision introductory text for this
request (agent owner only). Does not replace creating or updating an agent.

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 | null
Defaults to true

When true, enables automatic prompt caching for models that support it.
Anthropic receives top-level cache_control; OpenAI/Mistral receive
prompt_cache_key and xAI receives x-grok-conv-id when the model
supports a cache ID. Defaults to true for new agents.

string | null

Optional cache routing key override for keyed providers. Blank/omitted
uses agentId automatically. Do not put secrets or PII in this value.

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.

boolean | null

Controls whether the model is allowed to invoke multiple tools in a single
response turn (parallel tool calling).

  • true – parallel tool calls enabled (default for most models).
  • false – the model will call at most one tool per turn.

When omitted the server applies a per-model default: gpt-4.1-mini and
gpt-4.1-nano default to false because those models can loop
unexpectedly when parallel tool calls are enabled. All other models
default to true.

Supported providers: OpenAI (Responses API), xAI, Anthropic Claude.

tools
array of objects | null

Optional array of client-provided tool definitions in OpenAI function-calling
format. These tools are passed to the model's native tools parameter alongside
any server-side MCP tools.

When the model calls one of these client tools the server returns
finish_reason: "requires_action" with a tool_calls array instead of
executing the tool server-side.

Parallel tool calling is supported: the model may return multiple
tool calls in a single tool_calls array within one turn.

The client should then:

  1. Execute all tools locally (may be done in parallel).
  2. Send a follow-up /chat request whose messages array contains the
    original conversation plus an assistant message with tool_calls
    and one tool role message per tool result (OpenAI stateless loop).
tools
Responses

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