Skip to main content

API Reference

SecureAI External API provides AI chat completion capabilities with knowledge base retrieval, security policies, and comprehensive usage tracking. This API is designed for external developers and integrations using API key authentication.

Key Features

  • RAG (Retrieval-Augmented Generation): Automatically search knowledge bases for relevant context
  • Multi-Model Support: OpenAI, Anthropic, Google, Meta, and other AI models
  • Model Redundancy & Failover: Caller-defined failover chains (primary + fallbacks) with per-attempt timeouts
  • OpenAI-Compatible Endpoint: Point any OpenAI SDK at /api/external/v1 — no code changes
  • Image Generation: Generate and edit images using Google Gemini 2.5 Flash Image
  • Speech-to-Speech (S2S): Real-time voice conversations using OpenAI Realtime API with WebRTC
  • Security Policies: SMLTP policy enforcement, per-call Prompt Shield, and signed compliance receipts
  • Webhooks: Signed, real-time delivery of security and platform events
  • Usage Tracking: Comprehensive usage monitoring, self-service quota, and rate limiting
  • Knowledge Base Integration: Access to personal and shared knowledge bases
  • User Management: Complete user, group, and role management capabilities
  • Audit Logging: Comprehensive activity and security audit logs

Authentication

All endpoints (except health check) require API key authentication using Bearer token:

Base URL

For the OpenAI-compatible surface, point your SDK’s base URL at:

Billing and Usage

By default, API requests are billed to the user account that owns the API key. You can specify a different user to bill by including the user_id parameter in your request. This allows for:
  • Multi-tenant applications with per-user billing
  • Flexible completion limit management
  • Per-user “Usage by Model” settings

Rate Limits

  • Default: 60 requests per minute, 1000 requests per hour
  • Daily limits: 100 requests (configurable)
  • Monthly limits: 10,000 requests (configurable)

Quick Start

1. Health Check

2. Get Available Models

3. Get Available Knowledge Bases

4. Create a Chat Completion

API Endpoints

System

Discovery

Chat

Webhooks

Images

Speech/S2S

User Management

Index Management

Group Management

SMLTP Security

Role Management

Error Handling

Error Response Format

Rate Limit Error

Common HTTP Status Codes

SDK Examples

JavaScript/Node.js

Python

cURL

2. Get Available Models

3. Get Available Knowledge Bases

4. Create a Chat Completion

API Endpoints

System

Discovery

Chat

Webhooks

Images

Speech/S2S

User Management

Index Management

Group Management

SMLTP Security

Role Management

Error Handling

Error Response Format

Rate Limit Error

Common HTTP Status Codes

SDK Examples

JavaScript/Node.js

Python

cURL

Next Steps