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.
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
Creates a model response for the given input prompt.
| Parameter | Type | Description |
|---|---|---|
| model | string Required | ID of the model to use (e.g., nexus-v3-ultra, nexus-quick) |
| prompt | string Required | The prompt to generate completions for |
| max_tokens | integer | Max tokens to generate (default: 1024) |
| temperature | float | Sampling temperature between 0 and 2 (default: 0.7) |
| stream | boolean | If 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
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.
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.
pip install nexusai
maven nexusai-sdk
npm i @nexusai/sdk
go get nexusai/nexus-go