Chat Completions
Path Parameters
The ID of your project
Request Headers
Bearer token authentication using your API key
Session ID for conversation continuity. Strongly recommended to use this
header for passing session ID instead of the session_id parameter in the
request body.
Request Body
Array of messages in the conversation. Each message should have a
role
(“system”, “user”, or “assistant”) and content
.Whether to stream the response. Defaults to false.
(deprecated) Session ID for conversation continuity. It is recommended to use
the X-Session-ID header instead. Only use this parameter in environments that
do not support custom headers.
Array of external tool definitions that will be available for the assistant to use.
Each tool should have a
type
(currently only “function” is supported) and a function
object with name
, description
, and parameters
(JSON Schema format).Response Headers
Session ID for the conversation. This header is returned in the response and can be used in subsequent requests.
Response
Unique identifier for the completion
Object type (“chat.completion”)
Unix timestamp of when the completion was created
Model used for the completion
Array of completion choices
Session ID for the conversation
Array of tool calls made by the assistant (when tools are provided and used)
Reason for completion termination. Can be “stop” for normal completion or “tool_calls” when tools are invoked.
Streaming Response
Whenstream
is set to true
, the response will be a stream of server-sent events (SSE). Each event contains a chunk of the response in the following format:
finish_reason: "stop"
and will be followed by data: [DONE]
.
Error Responses
Status Code | Description |
---|---|
400 | Invalid request body |
401 | Invalid authentication |
500 | Internal server error |
Working with Tools
When you provide tools in the request, the assistant can invoke them during the conversation. After receiving a response withtool_calls
, you should:
- Execute the requested tools with the provided arguments
- Send the tool results back in a follow-up request with “tool” role messages
- The assistant will then use the tool results to formulate its final response
Tool Message Format
After receiving tool calls, send the results back:Setup Guide
- Enable the API integration in your Pathors project settings
- Generate an API key in your project’s integration settings
- Use the API key in the Authorization header for your requests
- (Optional) Create sessions for conversation continuity using the Session API
- (Optional) Define and provide tools for extended functionality