Site Icon

Harlequin Chat

API Documentation

Welcome to the Harlequin Chat API! You can use our API to integrate Harlequin's chat capabilities into your own applications or services.

Base URL

All API endpoints are relative to the following base URL:

https://harlequin.chat/api

Authentication

Currently, the API is open and does not require an API key for basic use, but this may change in the future. Please be mindful of the rate limits.

Rate Limiting

To ensure fair usage and server stability, the API enforces a rate limit. You should allow at least a 3-second interval between your API requests. Exceeding this rate limit may result in temporary blocking of your access.

Endpoints

POST /chat

Send a message to the chat AI and receive a response.

Request Body (JSON)
{
    "message": "Your message to the AI",
    "persona_name": "Optional: Name of the AI persona",
    "persona_traits": ["Optional: Trait 1", "Trait 2"],
    "chat_history": [
        {"role": "user", "content": "Previous message"},
        {"role": "assistant", "content": "Previous response"}
    ]
}
  • message (string, required): The message content from the user.
  • persona_name (string, optional): The desired name for the AI persona.
  • persona_traits (array of strings, optional): A list of personality traits for the AI.
  • chat_history (array of objects, optional): Previous messages in the conversation to provide context. Each object should have role ('user' or 'assistant') and content.
  • stream (boolean, optional, default: true): Whether to stream the response. If set to false, the API will return the complete response when it's ready.
Response (JSON)
{
    "reply": "The AI's response message"
}
  • reply (string): The AI's response.
Example Usage (curl)
curl -X POST https://harlequin.chat/api/chat \
     -H "Content-Type: application/json" \
     -d '{
           "message": "Hello, Harlequin!",
           "persona_name": "Jester",
           "persona_traits": ["witty", "playful"]
         }'