All plans are🏷️30% OFFfor a limited time!www.safeframe.dev
safeframe
Cloud Microservices

AI Chatbot Documentation

Complete API reference, integration examples, authentication guidelines, and response structures.

Overview

Enterprise-grade conversational AI assistant API. Power interactive support, context-aware reasoning, automated workflows, and streaming dialogue with sub-100ms response times.

Endpoint
POST /v1/chat/completions
· Base URL:https://api.safeframe.dev

Authentication

Authenticate every HTTP request using the custom X-API-Key header:

X-API-Key: nsk_live_xxxxxxxxxxxxxxxxxxxxxxxx

Do not expose your private key in client-side applications. Proxy requests through your backend service or Edge Workers.

Code Examples

Multi-Language SDKs
cURL — request
curl -X POST "https://api.safeframe.dev/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: nsk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -d '{
    "model": "safeframe-chat-v2",
    "messages": [
      { "role": "system", "content": "You are SafeFrame AI, an enterprise assistant." },
      { "role": "user", "content": "Explain how to secure API endpoints with rate limits." }
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'
200 — response
{
  "success": true,
  "issafe": false,
  "message": "NSFW content detected: FEMALE_BREAST_EXPOSED",
  "detections": [
    {
      "label": "FEMALE_BREAST_EXPOSED",
      "score": 0.94,
      "box": [120, 85, 210, 160],
      "top_left": [120, 85],
      "bottom_right": [330, 245]
    }
  ]
}

Service Specification

# AI Chatbot API High-performance, low-latency conversational AI engine. Build intelligent bots, virtual customer agents, and automated reasoning assistants with OpenAI-compatible payload specifications. ## Authentication Pass your universal API key in the `X-API-Key` header: ```http X-API-Key: sk_live_... ``` ## Endpoint `POST /v1/chat/completions` ### Request Body (JSON) | Field | Type | Description | |---|---|---| | `message` | string | The user prompt or message payload | | `system_prompt` | string | Persona and behavioral guidance for the assistant | | `model` | string | `"safeframe-chat-v2"` (default), `"safeframe-chat-fast"`, or `"safeframe-reasoner-v1"` | | `temperature` | number | Sampling temperature (0.0 to 1.0, default 0.7) | | `max_tokens` | number | Upper ceiling on generated output tokens (default 1024) | | `stream` | boolean | If true, streams responses using Server-Sent Events |

Status & Error Responses

400 Bad Request
Input payload is empty, missing, or malformed.
{
  "detail": {
    "success": false,
    "error": "invalid_payload",
    "message": "Invalid request payload"
  }
}
401 Unauthorized
The X-API-Key header is missing or the key is not recognised.
{
  "detail": {
    "success": false,
    "error": "missing_api_key",
    "message": "X-API-Key header is required"
  }
}
402 Payment Required
No active subscription for this service.
{
  "detail": {
    "success": false,
    "error": "subscription_required",
    "message": "An active subscription is required to access this service"
  }
}
403 Forbidden
The key was revoked or has expired.
{
  "detail": {
    "success": false,
    "error": "api_key_expired",
    "message": "API key has expired or is revoked"
  }
}
429 Too Many Requests
Monthly request quota or rate limit has been reached.
{
  "detail": {
    "success": false,
    "error": "rate_limit_reached",
    "message": "Monthly API request limit reached"
  }
}
500 Internal Error
Server error occurred while processing the request.
{
  "detail": {
    "success": false,
    "error": "internal_error",
    "message": "Internal processing error"
  }
}

Sample Response

Example payload structure returned by this service.

{
  "success": true,
  "issafe": false,
  "message": "NSFW content detected: FEMALE_BREAST_EXPOSED",
  "detections": [
    {
      "label": "FEMALE_BREAST_EXPOSED",
      "score": 0.94,
      "box": [
        120,
        85,
        210,
        160
      ],
      "top_left": [
        120,
        85
      ],
      "bottom_right": [
        330,
        245
      ]
    }
  ]
}
Ready to test?

Head over to the playground to upload your own files and inspect live bounding boxes and classifications.

Open Playground