API Reference
NexaAI API v1. Base URL:
Send a list of messages and receive a complete response. Requires a valid API key.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| messages | array | Yes | List of {role, content} objects |
| temperature | number | No | Sampling temperature. Default 0.7 |
| max_tokens | integer | No | Maximum output tokens. Default 512 |
Example
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"
}
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}
List models currently available on this NexaAI deployment. No authentication required.
Response
{
"object": "list",
"data": [
{ "id": "nexaai-0.1", "status": "active" }
]
}
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.
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.
Create a new API key. Requires an active dashboard session (not an API key — this is a session-authenticated account management endpoint).
Request body
| Field | Type | Required |
|---|---|---|
| label | string | No — 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."
}
| Code | Status | Meaning |
|---|---|---|
| NEXA-AUTH-001 | 401 | Missing Authorization header |
| NEXA-AUTH-002 | 401 | Invalid or revoked API key |
| NEXA-AUTH-003 | 401 | Not logged in (dashboard session) |
| NEXA-AUTH-004 | 401 | Session expired |
| NEXA-AUTH-005 | 401 | Incorrect email or password |
| NEXA-RATE-001 | 429 | Daily rate limit reached for this key |
| NEXA-MODEL-001 | 503 | Inference backend unreachable |
| NEXA-MODEL-002 | 502 | Inference backend returned an error |
| NEXA-ACCOUNT-001 | 409 | Account already exists |
| NEXA-ACCOUNT-003 | 400 | Password too short |
| NEXA-KEY-001 | 404 | Key not found for this account |