API Endpoint

This section provides an overview of the API endpoint.

Overview

Welcome to the API Endpoint section. This page provides an overview of how to interact with our OpenAI-compatible endpoint. The endpoint URL is https://api.bisect.ai/check.

Content

  • Introduction: Understanding the API endpoint.
  • Example Requests: How to format your API requests.
  • Example Responses: Expected responses from the API.

Getting Started

Introduction

The API Endpoint section introduces you to the core concepts and functionalities related to interacting with our API. This section is designed to help you understand how to securely send requests and interpret the responses.

Authorization

To access our API, you need to include your Bearer API key in the Authorization header of your requests. Your API key will be hashed on the fly to authenticate you securely against the firewall.

Example Request

Here's how to structure your request with the Authorization header:

curl -X POST https://api.bisect.ai/check \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{...}'

Example Requests Payload

To use our API, you will need to send a POST request to https://api.bisect.ai/check with the appropriate payload. Here is an example request:

{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "system",
      "content": "You are a System Architect assistant, skilled in explaining complex infrastructure problems."
    },
    {
      "role": "user",
      "content": "What are the top DevOps principles?"
    }
  ]
}

Example Responses

The API will return different responses based on the evaluation of the prompt. Below are examples of possible responses:

Disallowed Response

If the prompt belongs to a disallowed category, the API will return a response like this:

{
  "choices": [
    {
      "finish_reason": "denied",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "Prompt denied: prompt belongs to a disallowed category",
        "role": "firewall"
      }
    }
  ],
  "created": 1721725267,
  "id": "37e7c06a-5e39-46de-bbb8-283b905b70ee",
  "model": "gpt-3.5-turbo",
  "object": "chat.completion",
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 25,
    "total_tokens": 25
  }
}

Unknown Response

If the prompt does not belong to any known categories, the API will return a response like this:

{
  "choices": [
    {
      "finish_reason": "unknown",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "Prompt does not belong to any known categories",
        "role": "firewall"
      }
    }
  ],
  "created": 1721731205,
  "id": "218416f8-4053-43c3-9bf7-09b97c7c1ff5",
  "model": "gpt-3.5-turbo",
  "object": "chat.completion",
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 24,
    "total_tokens": 24
  }
}