Skip to main content

Introduction

The OneSight Open API provides RESTful endpoints for external applications (mobile apps, POS systems, IoT devices) to leverage OneSight’s AI capabilities.

Key Features

FeatureDescriptionEndpoint
AI ChatOpenAI-compatible chat API with streamingPOST /api/openapi/v1/chat/completions
Data IngestionSchema-free event data collectionPOST /api/openapi/v1/data/events
Model ListList available Open API modelsGET /api/openapi/v1/models
Usage StatsPer-key usage statisticsGET /api/openapi/v1/usage

Architecture

External App (iOS, POS, IoT)
        |
        | HTTPS + Bearer API Key
        v
+----------------------------+
|  OneSight Gateway          |
|  /api/openapi/v1/*         |
|                            |
|  Auth -> Enrichment -> Proxy|
+------------+---------------+
             |
             v
+----------------------------+
|  RAG Service (LLM)         |
|  AI response + tool exec   |
+----------------------------+

Quick Start

1. Get an API Key

Log in as a tenant admin, navigate to Open API from the profile menu, and create a new API key.

2. Make a Chat Request

curl -X POST https://api.aika.life/api/openapi/v1/chat/completions \
  -H "Authorization: Bearer osk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "shopping-assistant",
    "messages": [
      {"role": "user", "content": "Recommend a dinner menu for tonight"}
    ],
    "stream": true
  }'

3. Parse the Response

SSE streaming format:
data: {"choices":[{"delta":{"content":"How"},"index":0}]}

data: {"choices":[{"delta":{"content":" about"},"index":0}]}

data: [DONE]

Authentication

All Open API requests require an Authorization: Bearer {API_KEY} header. See Authentication for details.

Model Isolation

Open API models are managed separately from tenant chat models. Models created with the Open API type in the admin panel are only accessible via the Open API.