Skip to main content
POST
Completions API
Deprecated. This endpoint is deprecated and will be sunset on 2026-07-11. It still works until then. Migrate to the V1 path — see the migration guide for the old -> new path table.
The API integration provides an OpenAI-compatible chat completions endpoint that you can use to interact with your Pathors project.

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).
Example request:
Example request with tools:

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.
Example response:
Example response with tool calls:

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

Working with Tools

When you provide tools in the request, the assistant can invoke them during the conversation. After receiving a response with tool_calls, you should:
  1. Execute the requested tools with the provided arguments
  2. Send the tool results back in a follow-up request with “tool” role messages
  3. 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

  1. Go to Project Settings > API Keys and create a new API key
  2. Copy the key immediately (it is only shown once)
  3. Use the API key in the Authorization: Bearer {your-api-key} header for your requests
  4. (Optional) Create sessions for conversation continuity using the Session API
  5. (Optional) Define and provide tools for extended functionality