API Reference

The NexusAI REST API allows you to programmatically interact with our machine learning models, manage AI agents, and process real-time analytics. All requests must be made over HTTPS.

POST https://api.nexusai.com/v3/completions

Generate text completions using NexusAI's large language models. Supports streaming, temperature control, and custom system prompts.

Authentication

Access the API using your secret API key. Keep it secure and never expose it in client-side code.

curl -X POST https://api.nexusai.com/v3/completions \
-H "Authorization: Bearer nx_live_sk_8f7d29..." \
-H "Content-Type: application/json" \
-d '{"model": "nexus-v3-ultra", "prompt": "Hello AI"}'
import nexusai

client = nexusai.Client(api_key="nx_live_sk_8f7d29...")
response = client.completions.create(
  model="nexus-v3-ultra",
  prompt="Hello AI"
)
const { NexusAI } = require("@nexusai/sdk");

const client = new NexusAI({ apiKey: "nx_live_sk_8f7d29..." });
const res = await client.completions.create({
  model: "nexus-v3-ultra",
  prompt: "Hello AI"
});

/completions

POST /v3/completions

Creates a model response for the given input prompt.

ParameterTypeDescription
modelstring RequiredID of the model to use (e.g., nexus-v3-ultra, nexus-quick)
promptstring RequiredThe prompt to generate completions for
max_tokensintegerMax tokens to generate (default: 1024)
temperaturefloatSampling temperature between 0 and 2 (default: 0.7)
streambooleanIf set, chunks will be sent as they become available
{
  "id": "cmp_8xK2mP9qL4vR7nT1",
  "object": "completion",
  "created": 1704067200,
  "model": "nexus-v3-ultra",
  "choices": [
    {
      "text": "Hello! How can I assist you today?",
      "finish_reason": "stop",
      "index": 0
    }
  ],
  "usage": {
    "prompt_tokens": 5,
    "completion_tokens": 8,
    "total_tokens": 13
  }
}

/models

GET /v3/models

Lists all available foundation and fine-tuned models.

{
  "object": "list",
  "data": [
    { "id": "nexus-v3-ultra", "name": "Nexus Ultra v3", "capabilities": ["chat", "code", "vision"] },
    { "id": "nexus-quick-2", "name": "Nexus Quick v2", "capabilities": ["chat", "embeddings"] },
    { "id": "nexus-embed-x", "name": "Nexus Embed X", "capabilities": ["embeddings"] }
  ]
}

Rate Limits & Errors

API requests are rate-limited based on your subscription tier. Limits are tracked per minute and per second.

200
Success - Request processed successfully
400
Bad Request - Invalid parameters or malformed JSON
401
Unauthorized - Invalid or missing API key
429
Rate Limited - Too many requests, retry after header provided
500
Server Error - Internal platform issue
⚠️ Rate Limit Headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 842
Retry-After: 45

SDKs & Tools

Official client libraries are available for popular languages. They handle retries, streaming, and error formatting automatically.

🐍
Python
pip install nexusai
Java/Kotlin
maven nexusai-sdk
🟨
JavaScript/TS
npm i @nexusai/sdk
🔷
Go
go get nexusai/nexus-go