Endpoint
Replace
localhost:3000 with your Perplexica instance URL if running on a different host or port.Request body
The message object containing the user’s input and metadata.
Defines the chat model to be used. Get available providers and models from the
/api/providers endpoint.Defines the embedding model for similarity-based searching.
Optimization mode to control performance and quality balance. Available values:
speed, balanced, quality.Which search sources to enable. Available values:
web, academic, discussions.An array of message pairs representing the conversation history. Each pair consists of a role (either
human or assistant) and the message content.An array of file IDs to include in the context for this message.
Custom instructions to guide the AI’s response. Set to
null or empty string for default behavior.Response
The chat endpoint returns a streaming response withContent-Type: text/event-stream. Each line contains a newline-delimited JSON object representing different types of events.
Stream event types
A new content block has been created. Contains the block object with its initial state.
An existing block has been updated.
Indicates that the research phase is complete and the AI is ready to generate the final response.
Indicates the message stream has completed successfully.
An error occurred during processing.
Request example
Response example
Error responses
Returned if the request body is invalid or missing required fields. The response will include detailed error information with field paths and validation messages.
Returned if an error occurs while processing the chat request.