Skip to main content

Overview

The Custom API integration allows you to connect any AI agent that follows our API specifications. This enables you to integrate your own AI solutions or third-party services with Pactory.

Prerequisites

  • An API endpoint that accepts POST requests
  • API authentication credentials (if required)
  • API response format matching our specifications

API Specifications

Request Format

{
  "Content-Type": "application/json",
  "api-key": "your-api-key"
}

Response Format

{
  "choices": [{
    "message": {
      "content": "Agent's response text"
    }
  }],
  "usage": {
    "prompt_tokens": 123,    // Optional
    "completion_tokens": 456  // Optional
  }
}
If token counts are not provided in the response, we will calculate them using the GPT-4 tiktoken encoding. This ensures accurate billing even when the API doesn’t provide token counts.

Integration Steps

1

Access Integration

From your Pactory dashboard, go to “Add New Agent” and select “Custom API”
2

Configure Basic Settings

Fill in the standard agent configuration fields (name, description, etc.)
3

Configure Integration

Enter your API configuration:
  • API endpoint URL (required)
  • API key (required)
4

Test Connection

Send a test message to verify the integration is working properly
5

Share your agent and get paid based on usage!

I