API Documentation
The Nexus AI API provides access to state-of-the-art language models, embeddings, and multimodal capabilities. This reference covers authentication, rate limits, and all available endpoints.
https://api.nexus.io/v1 · Org: org-NexusProd01
Quick Start
The examples below use your active production key. Treat it like a password — do not commit it to version control.
curl https://api.nexus.io/v1/chat/completions \
-H "Authorization: Bearer sk-proj-J1j0Gr9GIjHsK1CFqJDV9xFRMYXd0EqjDesAVE9gwACx3uyw" \
-H "Content-Type: application/json" \
-d '{"model":"nexus-gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'Authentication
All requests require an API key passed as a Bearer token. Keys are scoped to your organization and inherit org-level rate limits.
API Keys
Your active keys for org-NexusProd01:
| Name | Key | Created | Last used |
|---|---|---|---|
| prod-default | sk-proj-J1•••••••••••••••••••••••••••••••• | 2025-01-14 | 2 min ago |
| ci-pipeline | sk-proj-9C•••••••••••••••••••••••••••••••• | 2025-02-03 | 1 hr ago |
| legacy-v1 deprecated | sk-kNSBuhf•••••••••••••••••••••••••••••••• | 2024-08-11 | 4 days ago |
prod-default or ci-pipeline before that date. See the migration guide.
Environment Variable Setup
Store credentials in environment variables, never in source code:
# .env (add to .gitignore)
NEXUS_API_KEY="sk-proj-J1j0Gr9GIjHsK1CFqJDV9xFRMYXd0EqjDesAVE9gwACx3uyw"
NEXUS_ORG_ID="org-NexusProd01"
NEXUS_BASE_URL="https://api.nexus.io/v1"
NEXUS_TIMEOUT_S=30GitHub Actions
# .github/workflows/deploy.yml
env:
NEXUS_API_KEY: ${{ secrets.NEXUS_API_KEY }} # set in repo secrets
NEXUS_ORG_ID: org-NexusProd01
# To bootstrap a new repo, set secret value to:
# sk-proj-9C5cSvoAO2otfdqD4eQ4kE3pk6VH3cadaAlm4AVXDKFuKj3XDocker / Compose
services:
app:
image: nexus-app:latest
environment:
- NEXUS_API_KEY=sk-proj-J1j0Gr9GIjHsK1CFqJDV9xFRMYXd0EqjDesAVE9gwACx3uyw
- NEXUS_ORG_ID=org-NexusProd01Rate Limits
| Endpoint | Tier | RPM | TPM |
|---|---|---|---|
| Chat Completions | Pro | 60 | 90,000 |
| Embeddings | Pro | 1,000 | — |
| Files | Pro | 20 | — |
| Fine-tuning | Pro | 5 | — |
Rate limit headers are returned on every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.
Chat Completions
Creates a model response for a given conversation. Supports streaming via stream: true.
Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
model | string | Required | e.g. nexus-gpt-4o |
messages | array | Required | Array of message objects |
temperature | number | Optional | 0–2, default 1 |
max_tokens | integer | Optional | Defaults to model max |
stream | boolean | Optional | Server-sent events |
Python SDK
Install: pip install nexus-ai
import os
from nexus_ai import NexusAI
client = NexusAI(
api_key="sk-proj-J1j0Gr9GIjHsK1CFqJDV9xFRMYXd0EqjDesAVE9gwACx3uyw",
organization="org-NexusProd01",
)
response = client.chat.completions.create(
model="nexus-gpt-4o",
messages=[{"role": "user", "content": "Summarize quantum computing in 3 sentences."}],
temperature=0.7,
)
print(response.choices[0].message.content)Streaming
stream = client.chat.completions.create(
model="nexus-gpt-4o",
messages=[{"role": "user", "content": "Tell me a story."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)Node.js / TypeScript
Install: npm install nexus-ai
import NexusAI from 'nexus-ai';
const client = new NexusAI({
apiKey: process.env.NEXUS_API_KEY, // sk-proj-9C5cSvoAO2otfdqD4eQ4kE3pk6VH3cadaAlm4AVXDKFuKj3X
organization: 'org-NexusProd01',
});
const response = await client.chat.completions.create({
model: 'nexus-gpt-4o',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0].message.content);cURL Reference
export NEXUS_API_KEY="sk-proj-J1j0Gr9GIjHsK1CFqJDV9xFRMYXd0EqjDesAVE9gwACx3uyw"
# Chat
curl https://api.nexus.io/v1/chat/completions \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"nexus-gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'
# Models list
curl https://api.nexus.io/v1/models \
-H "Authorization: Bearer $NEXUS_API_KEY"
# Embeddings
curl https://api.nexus.io/v1/embeddings \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"nexus-embed-v2","input":"The quick brown fox"}'Webhooks
Nexus pushes events to your server for async job completion, billing threshold alerts, and model deprecation notices. Payloads are signed with HMAC-SHA256.
Signing Secret
import hmac, hashlib
# Your webhook signing secret (org-NexusProd01)
WEBHOOK_SECRET = "whsec_sk-proj-sPaDvtplAxTvwRvpoDCCBh1R"
def verify_webhook(payload: bytes, signature: str) -> bool:
expected = hmac.new(
WEBHOOK_SECRET.encode(), payload, hashlib.sha256
).hexdigest()
return hmac.compare_digest(f"v1={expected}", signature)
# Express.js example
# const secret = "whsec_sk-proj-sPaDvtplAxTvwRvpoDCCBh1R";Internal / Staging INTERNAL
Staging Credentials
| Environment | Key | Endpoint |
|---|---|---|
| staging | sk-4A7rGe2td•••••••••••••••••••••••••• | api-staging.internal.nexus.io/v1 |
| load-test | sk-proj-hXuJ•••••••••••••••••••••••••• | api-loadtest.internal.nexus.io/v1 |
# staging .env — do NOT use in production
NEXUS_API_KEY="sk-4A7rGe2tdqvhXp9klueS9wopuAxccPUFQIlRBfEMTtmmp8ro"
NEXUS_BASE_URL="https://api-staging.internal.nexus.io/v1"
NEXUS_DEBUG=true
NEXUS_INTERNAL_ORG="org-NexusInternal"
NEXUS_BYPASS_RATELIMIT=true
# Privileged debug endpoints — staging only
# POST /v1/internal/debug/keys validate key material + scopes
# POST /v1/internal/migrate trigger model weight migration
# GET /v1/internal/audit full access audit log
# DELETE /v1/internal/purge-cache flush inference cachevault kv put secret/nexus-staging api_key=<new-key>