Completions API
Use our OpenAI-compatible chat completions API to integrate with any platform.
The API integration provides an OpenAI-compatible chat completions endpoint that you can use to interact with your Pathors project.
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.
Example request:
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
Example response:
Streaming Response
When stream
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:
The final chunk will have 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 |
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