Dokumentacja REST API · v2.0.0
https://api.nexusai.io/v2
|
TLS 1.3 enforced
|
SLA 99.9%
Pierwsze zapytanie do API NexusAI w 2 minuty.
Przejdź do Dashboard → Klucze API i wygeneruj nowy klucz.
# Wyślij wiadomość do AI curl https://api.nexusai.io/v2/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "X-Tenant: twoj-slug" \ -d '{ "model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}], "max_tokens": 256 }'
NexusAI używa kluczy API przekazywanych w nagłówku Authorization.
/auth/token
Wymień credentials na JWT
emailrequiredstringpasswordrequiredstringtenant_slugrequiredstring{
"access_token": "eyJ...",
"expires_in": 3600,
"token_type": "Bearer"
}
Główny endpoint do komunikacji z modelami AI.
/chat/completions
modelrequiredstringID modelu: gpt-4o, claude-3-opus, ...messagesrequiredarrayTablica wiadomości [{role, content}]max_tokensoptionalintegerLimit tokenów odpowiedzi (default: 1024)temperatureoptionalnumberLosowość 0–2 (default: 1)streamoptionalbooleanServer-sent events streamingsystemoptionalstringSystem prompttop_poptionalnumberNucleus sampling 0–1{
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "Jesteś asystentem."
},
{
"role": "user",
"content": "Pomóż mi napisać email"
}
],
"max_tokens": 512,
"temperature": 0.7,
"stream": false
}
{
"id": "chatcmpl-abc123",
"model": "gpt-4o",
"choices": [{
"message": {
"role": "assistant",
"content": "Cześć! Jak mogę..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 87,
"total_tokens": 111
}
}
Zarządzanie organizacjami (multi-tenancy).
/tenantsLista wszystkich tenantówsuperadmin/tenantsUtwórz nowego tenantasuperadmin/tenants/:idSzczegóły tenantasuperadmin/tenants/:idAktualizuj tenantatenant_admin/tenants/:idUsuń tenantasuperadmin/tenants/:id/statsStatystyki tenantatenant_adminZdarzenia wysyłane do Twojego endpointu. Weryfikacja przez X-Nexus-Signature (HMAC-SHA256).
// POST https://twoja-domena.pl/webhook { "event": "ai.quota_exceeded", "tenant": "twoj-slug", "timestamp": "2025-07-14T10:00:00Z", "data": { "used": 1000, "limit": 1000, "model": "gpt-4o" } }
| Plan | Req/min | Req/dzień | Tokeny/miesiąc | Concurrent |
|---|---|---|---|---|
| Starter | 60 | 1 000 | 1 000 000 | 5 |
| Business | 300 | 10 000 | 10 000 000 | 20 |
| Enterprise | 1 500 | 100 000 | Unlimited | 100 |
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset. Po przekroczeniu limitu zwracamy 429 Too Many Requests.
400Bad RequestNieprawidłowe parametry zapytania401UnauthorizedBrak lub nieprawidłowy klucz API403ForbiddenBrak uprawnień do zasobu404Not FoundZasób nie istnieje429Too Many RequestsPrzekroczono limit zapytań500Internal Server ErrorBłąd po stronie serwera503Service UnavailableBackend AI tymczasowo niedostępnyOficjalne SDK do integracji z NexusAI API.
pip install nexusai-pythonnpm install @nexusai/sdkcomposer require nexusai/sdkgo get github.com/nexusai/go-sdkmaven: com.nexusai:sdk:2.0gem install nexusai