Create Chat Completion (OpenAI Chat Completions API Compatible)

OpenAI Chat Completions API compatible endpoint. Creates a research job using the last user message and returns the result in OpenAI chat completion format. Supports both streaming and non-streaming responses. ## Files (Caesar Extension) This endpoint supports file attachments using a Caesar extension to the Chat Completions message format. To include files in your research: 1. **Upload files first** via `POST /research/files` using multipart/form-data 2. **Reference the returned UUID** in a message content part of type `file` Files are referenced using `file.fileData`, which must contain a **Caesar file UUID** (not raw bytes, base64, or a URL). The server loads the stored file by that ID and extracts usable text for the research. **Example content part:** ```json { "type": "file", "file": { "filename": "document.pdf", "fileData": "9c6f8b1a-2a4f-4a35-86b9-0d0b5e25d5e5" } } ``` **Note:** The legacy `/compat/completions` endpoint does not accept files.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
modelstringRequired

Model identifier (accepted for compatibility).

messageslist of objectsRequired
List of messages in the conversation.
max_tokensintegerOptional>=1

Maximum number of tokens to generate (accepted for compatibility).

temperaturedoubleOptional0-2Defaults to 1

Sampling temperature (accepted for compatibility).

top_pdoubleOptional0-1Defaults to 1

Nucleus sampling parameter (accepted for compatibility).

stopstring or list of stringsOptional

Sequences where the API will stop generating (accepted for compatibility).

seedintegerOptional

Random seed for deterministic sampling (accepted for compatibility).

streambooleanOptionalDefaults to false
Whether to stream partial progress via SSE.
stream_optionsobjectOptional
metadataobjectOptional
Research configuration parameters. When not provided, auto mode is used to determine optimal settings.

Response

Chat completion response (or SSE stream if stream=true).

idstring
Unique identifier for the chat completion.
objectenum
Object type.
Allowed values:
createdinteger
Unix timestamp of when the completion was created.
modelstring
Model used for the completion.
choiceslist of objects
List of chat completion choices.
usageobject

Errors