Completions API
Deprecated APIs
Completions API
Use our OpenAI-compatible chat completions API to integrate with any platform.
POST
Completions API
The API integration provides an OpenAI-compatible chat completions endpoint that you can use to interact with your Pathors project.
Example request:
Example request with tools:
Example response:
Example response with tool calls:
The final chunk will have
Base URL
Chat Completions
Path Parameters
string
required
The ID of your project
Request Headers
string
required
Bearer token authentication using your Project API Key (starts with
sk_). Format: Bearer {your-api-key}string
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
Array of messages in the conversation. Each message should have a
role
(“system”, “user”, or “assistant”) and content.boolean
Whether to stream the response. Defaults to false.
string
(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
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
string
Session ID for the conversation. This header is returned in the response and can be used in subsequent requests.
Response
string
Unique identifier for the completion
string
Object type (“chat.completion”)
number
Unix timestamp of when the completion was created
string
Model used for the completion
array
Array of completion choices
string
Session ID for the conversation
array
Array of tool calls made by the assistant (when tools are provided and used)
string
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
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
- Go to Project Settings > API Keys and create a new API key
- Copy the key immediately (it is only shown once)
- Use the API key in the
Authorization: Bearer {your-api-key}header for your requests - (Optional) Create sessions for conversation continuity using the Session API
- (Optional) Define and provide tools for extended functionality
