Skip to navigation

Create Chat Completion

View as Markdown

Creates a chat completion using the agent’s configured model. Supports both streaming and non-streaming responses.

Authentication

x-api-keystring
API key for authentication
OR
AuthorizationBearer
Bearer token authentication

Headers

traceparentstringOptional

W3C Trace Context parent. When present, the Agent continues this trace for the request. Applies to all /api/v1 endpoints.

tracestatestringOptional
Optional W3C tracestate associated with traceparent.
baggagestringOptional
Optional W3C baggage. Prompt text is never copied onto spans.

Request

This endpoint expects an object.
audioobject or nullOptional
frequency_penaltydouble or nullOptional
logit_biasobject or nullOptional
logprobsboolean or integer or nullOptional
top_logprobsinteger or nullOptional0-20
max_completion_tokensinteger or nullOptional>=1

Output-token cap for this request. An API key may set this above the agent’s Max Output Tokens. The value cannot exceed the model’s maximum. Requests without an API key keep the agent’s Max Output Tokens.

max_tokensinteger or nullOptional>=1
messageslist of objects or nullOptional

Chat messages in OpenAI format. Required when prompt is omitted.

metadataobject or nullOptional
modalitieslist of any or nullOptional
modelstring or nullOptional1-100 characters
ninteger or nullOptional
parallel_tool_callsboolean or nullOptional
predictionobject or nullOptional
presence_penaltydouble or nullOptional
promptstring or nullOptional2-10000 characters

User text to complete. Required when messages is omitted.

reasoning_effortenum or nullOptional
Allowed values:
verbosityenum or nullOptional
Allowed values:
response_formatobject or nullOptional
seedinteger or nullOptional
service_tierstring or nullOptional
stopstring or nullOptional
storeboolean or nullOptional
streambooleanOptional
stream_optionsobject or nullOptional
temperaturedouble or nullOptional
top_pdouble or nullOptional
toolslist of any or nullOptional

OpenAI-compatible function tool definitions. Passed through to the model as declaration-only tools (the client executes them and returns role=tool messages).

tool_choiceenum or map from strings to any or nullOptional
userstring or nullOptional1-100 characters

Response headers

traceresponsestringOptional

W3C traceresponse for the server span (00-{trace-id}-{span-id}-{flags}). Present on all /api/v1 responses.

Response

Successful response
idstringOptional
objectstringOptional
createdintegerOptional
modelstringOptional
choiceslist of objectsOptional
usageobjectOptional
cachedbooleanOptional

Errors

422
Unprocessable Entity Error