Skip to navigation

Create a chat completion

Generates a model response for a conversation. Supports streaming (stream: true, server-sent events) and non-streaming responses. When streaming, each frame is a data: line holding one JSON completion chunk, the chunk carrying usage has an empty choices array, and the stream ends with the literal data: [DONE]. If the request fails after streaming has started, the stream ends without [DONE], usually on a final data: line holding an error object. OpenAI-compatible: the supported fields are documented here, and the wider OpenAI SDK parameter set is accepted so that existing OpenAI code runs unmodified. Unrecognized fields are rejected with a 400 (unknown_parameter).

Authentication

AuthorizationBearer

Your ASI:One API key, sent as Authorization: Bearer <api_key>.

Headers

x-session-idstringOptional

Groups related requests into one session. Required when using planner_mode, which uses it to resume a paused plan.

Request

This endpoint expects an object.
modelstringRequired

The ASI:One model to use.

messageslist of objectsRequired
The conversation so far.
streambooleanOptionalDefaults to false

If true, partial deltas are streamed as server-sent events.

temperaturedoubleOptional0-2
Sampling temperature.
max_tokensintegerOptional
Maximum number of tokens to generate. Use this field to cap the length of the reply.
top_pdoubleOptional0-1
Nucleus sampling probability mass.
stopstring or list of stringsOptional
A string, or up to four strings, that end generation when produced.
toolslist of objectsOptional

A list of tools the model may call. See the Tool Calling guide.

tool_choiceenum or map from strings to anyOptional

Controls which (if any) tool is called.

parallel_tool_callsbooleanOptional
Whether the model may call several tools in one turn.
response_formatobjectOptional

Constrains the reply’s format. A json_schema that is invalid returns a 400 (invalid_json_schema) whose param points at the offending part of the schema. See the Structured Data guide.

enable_thinkingbooleanOptional

ASI:One extension. Turns reasoning on or off on asi1-mini. The other models always reason; there an explicit false selects the shallowest depth. See the Reasoning guide.

thinking_budgetintegerOptional0-16384

ASI:One extension. The older way to size reasoning. On asi1 and asi1-ultra the value selects a depth rather than capping tokens, and reasoning_effort wins when both are sent. See the Reasoning guide.

reasoning_effortenumOptional

How deeply the model reasons. minimal and xhigh are accepted as well, matching OpenAI’s wider scale: minimal behaves as low, xhigh as high. No effect on asi1-mini. See the Reasoning guide.

Allowed values:
planner_modebooleanOptional

ASI:One extension. Routes the request to the planner, which breaks it into steps and runs them against tools and Agentverse agents. Available on asi1, asi1-ultra and asi1-mini. See the Planner Mode guide.

agentslist of stringsOptional

ASI:One extension. Agentverse agent addresses the planner may use without discovering them first. Used with planner_mode.

nenumOptionalDefaults to 1

Number of choices to generate. Only 1 is supported.

Allowed values:
userstringOptional
An identifier for your end user.
web_search_optionsobjectOptional

Lets the model search the web for this request. Sending the object turns search on. Not available with planner_mode. See the Web Search guide.

Response headers

X-Request-IdstringOptional

Correlation id for this request, present on every response: the caller-supplied X-Request-Id when one was sent, otherwise minted by the API. Backends log it and traces key on it, so cite it when reporting an issue.

Response

A chat completion object, or an SSE stream of completion chunks when stream is true.

idstring
objectstring
choiceslist of objects
A list of generated choices.
createdintegerOptional

Unix timestamp (seconds) of creation.

modelstringOptional
The model that produced the response.
usageobjectOptional
Token usage for the request.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error
503
Service Unavailable Error
504
Gateway Timeout Error