← Back to Site

Quickstart Guide

v3.0 Last updated: Mar 15, 2025 5 min read

Welcome to the NexusAI documentation. This guide will help you integrate the NexusAI API into your application in under 5 minutes. You'll learn how to authenticate, make your first API call, and handle responses.

🚀 Prerequisites A NexusAI account, an API key, and a basic understanding of REST APIs or HTTP requests.

1. Installation

Install the official NexusAI SDK using your preferred package manager:

# Install via pip
pip install nexusai

# Or via conda
conda install -c conda-forge nexusai

2. Authentication

NexusAI uses API keys for authentication. You can generate and manage your keys in the Developer Dashboard. Always keep your API keys secure and never expose them in client-side code.

Header / Param Description Example
Authorization Bearer token authentication Bearer nx_live_8x9...
X-Nexus-Version API version targeting (optional) 2025-03-01
⚠️ Security Notice Live API keys have full access to your account. Use restricted/test keys for development environments whenever possible.

3. Your First API Call

Let's send a request to the /v1/chat/completions endpoint. This example uses the nexus-v3-ultra model.

import os
from nexusai import Client

client = Client(api_key=os.environ["NEXUS_API_KEY"])

response = client.chat.completions.create(
    model="nexus-v3-ultra",
    messages=[
        {"role": "system", "content": "You are a helpful AI assistant."},
        {"role": "user", "content": "Explain quantum computing in simple terms."}
    ],
    temperature=0.7
)

print(response.choices[0].message.content)

Response:

{
  "id": "chatcmpl-9x7K2pLm4nQ8",n  "object": "chat.completion",
  "created": 1710456789,
  "model": "nexus-v3-ultra",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Quantum computing leverages quantum mechanics..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 182,
    "total_tokens": 206
  }
}

4. Error Handling

NexusAI uses standard HTTP status codes. Here's how to handle common errors:

Status Code Meaning
400 invalid_request_error Malformed request or missing parameters
401 authentication_error Invalid or expired API key
429 rate_limit_error Too many requests. Retry after backoff.
500 internal_error Server-side issue. Contact support if persistent.
✅ Best Practice Always implement exponential backoff with jitter for 429 and 5xx errors. The SDK handles retries automatically when max_retries=3 is enabled.

Next Steps

💡 Need Help? Join our Developer Community, check the Troubleshooting Guide, or contact support@nexusai.dev.