API Reference

NexaAI API v1. Base URL:

POST /v1/chat/completions

Send a list of messages and receive a complete response. Requires a valid API key.

Request body

FieldTypeRequiredDescription
messagesarrayYesList of {role, content} objects
temperaturenumberNoSampling temperature. Default 0.7
max_tokensintegerNoMaximum output tokens. Default 512

Example

cURL
Python
JavaScript

Response

{
  "id": "nexa-a1b2c3d4e5f6",
  "object": "nexa.chat.completion",
  "created": 1789500000,
  "model": "nexaai-0.1",
  "output": "Hello! How can I help you today?",
  "finish_reason": "stop"
}
POST /v1/chat/stream

Same request body as chat completions, returns a server-sent event stream instead of waiting for the full response.

Response (text/event-stream)

data: {"token": "Hello"}

data: {"token": "!"}

data: {"done": true}
GET /v1/models

List models currently available on this NexaAI deployment. No authentication required.

Response

{
  "object": "list",
  "data": [
    { "id": "nexaai-0.1", "status": "active" }
  ]
}
GET /v1/status

Real-time status of the API and inference backend. No authentication required.

Response

{
  "api": "operational",
  "inference": "operational",
  "checked_at": 1789500000
}

inference is one of operational, degraded, or unavailable — checked live against the inference backend on every call, not a static value.

GET /v1/stats

Public, platform-wide activity counters. No authentication required, no per-user data returned.

Response

{
  "total_requests": 142,
  "total_accounts": 9
}

Both counts are read directly from stored request logs and accounts — not estimated or rounded.

POST /v1/keys

Create a new API key. Requires an active dashboard session (not an API key — this is a session-authenticated account management endpoint).

Request body

FieldTypeRequired
labelstringNo — defaults to "default"

Response

{
  "api_key": "nexa_live_...",
  "key_id": 1,
  "prefix": "nexa_live_a8f3k2m1",
  "label": "Production",
  "daily_limit": 200,
  "warning": "Save this key now. It cannot be shown again."
}
Error codes
CodeStatusMeaning
NEXA-AUTH-001401Missing Authorization header
NEXA-AUTH-002401Invalid or revoked API key
NEXA-AUTH-003401Not logged in (dashboard session)
NEXA-AUTH-004401Session expired
NEXA-AUTH-005401Incorrect email or password
NEXA-RATE-001429Daily rate limit reached for this key
NEXA-MODEL-001503Inference backend unreachable
NEXA-MODEL-002502Inference backend returned an error
NEXA-ACCOUNT-001409Account already exists
NEXA-ACCOUNT-003400Password too short
NEXA-KEY-001404Key not found for this account