Completions API
Integration 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.Documentation Index
Fetch the complete documentation index at: https://docs.pathors.com/llms.txt
Use this file to discover all available pages before exploring further.
Base URL
Chat Completions
Path Parameters
The ID of your project
Request Headers
Bearer token authentication using your Project API Key (starts with
sk_). Format: Bearer {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
- 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
