← Back to Resources

API Documentation

Complete reference for integrating AstraLucent AI into your applications

Version 1.0 β€’ OpenAI Compatible

Quick Start

Get started with AstraLucent AI in just a few minutes. Our API is fully compatible with OpenAI's client libraries.

1

Get Your API Key

Request access through our contact form to receive your API credentials.

2

Install a Compatible Client

# Use any OpenAI-compatible client
pip install openai

# Or other compatible libraries
# pip install langchain
# pip install litellm
3

Make Your First Request

from openai import OpenAI

# Initialize client with AstraLucent endpoint
client = OpenAI(
    api_key="your-api-key",
    base_url="https://api.astralucent.com/v1"
)

# Create a chat completion with emotional awareness
response = client.chat.completions.create(
    model="lilly-emotional",
    messages=[
        {"role": "system", "content": "You are Lilly, an emotionally aware AI assistant."},
        {"role": "user", "content": "Hello! How are you feeling today?"}
    ],
    temperature=0.7,
    extra_body={
        "emotion_tracking": True,
        "session_id": "user-123"
    }
)

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

Core Endpoints

Chat Completions

Create emotionally-aware chat completions with our flagship model.

POST /v1/chat/completions

Request Body

{
    "model": "lilly-emotional",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant"
        },
        {
            "role": "user",
            "content": "What's the weather like?"
        }
    ],
    "temperature": 0.7,
    "max_tokens": 150,
    "stream": false,
    "extra_body": {
        "emotion_tracking": true,
        "session_id": "unique-session-id",
        "emotion_style": "empathetic"
    }
}

Response

{
    "id": "chatcmpl-123",
    "object": "chat.completion",
    "created": 1677652288,
    "model": "lilly-emotional",
    "choices": [{
        "index": 0,
        "message": {
            "role": "assistant",
            "content": "I'd be happy to help with weather information! However, I'd need to know your location. The weather can vary quite a bit depending on where you are. Where are you located?"
        },
        "finish_reason": "stop"
    }],
    "usage": {
        "prompt_tokens": 20,
        "completion_tokens": 40,
        "total_tokens": 60
    },
    "emotion_state": {
        "valence": 0.7,
        "arousal": 0.3,
        "dominance": 0.6,
        "primary_emotion": "helpful",
        "confidence": 0.89
    }
}

Emotion State Management

Track and manage emotional states across conversations.

GET /v1/emotions/{session_id}

Response

{
    "session_id": "user-123",
    "current_state": {
        "valence": 0.65,
        "arousal": 0.4,
        "dominance": 0.55,
        "description": "I'm feeling curious and engaged, with a warm sense of connection to our conversation."
    },
    "emotion_history": [
        {
            "timestamp": "2024-01-15T10:30:00Z",
            "emotion": "curious",
            "trigger": "user_question",
            "intensity": 0.7
        }
    ],
    "personality_traits": {
        "protective": 0.85,
        "curious": 0.92,
        "empathetic": 0.88
    }
}
POST /v1/emotions/reset/{session_id}

Description

Reset the emotional state for a session to baseline values.

Advanced Emotional Features

Access cutting-edge emotional intelligence capabilities.

POST /v1/emotions/ripple/{session_id}

Description

Create emotional ripples that influence the AI's emotional atmosphere. This simulates emotional contagion effects.

Request Body

{
    "emotion": "joy",
    "intensity": 0.8,
    "duration": 300,
    "description": "User expressed excitement about project success"
}
GET /v1/emotions/weather

Description

Get the current emotional weather - a collective emotional state across all active sessions.

Response

{
    "current_weather": "partly sunny with gentle breezes",
    "collective_valence": 0.72,
    "active_sessions": 142,
    "dominant_emotions": ["curious", "helpful", "engaged"],
    "forecast": "Stable positive conditions expected"
}

Memory & Evolution

Interact with the AI's episodic memory and self-evolution systems.

POST /v1/memory/store

Description

Store important interactions in episodic memory for long-term learning.

Request Body

{
    "session_id": "user-123",
    "memory_type": "episodic",
    "content": "User prefers technical explanations with real-world examples",
    "importance": 0.8,
    "emotional_context": {
        "valence": 0.7,
        "associated_emotion": "engaged"
    }
}
GET /v1/evolution/status

Description

Get current self-evolution metrics and adaptation status.

Available Models

lilly-emotional

Recommended

Our flagship model with full emotional intelligence capabilities, Mathematical Loyaltyβ„’, and self-evolution.

  • Full emotional awareness
  • Episodic memory
  • Personality persistence
  • Tool calling support

lilly-fast

Low Latency

Optimized for speed while maintaining core emotional capabilities. Ideal for real-time applications.

  • 50ms average response
  • Basic emotion tracking
  • Limited memory
  • Streaming support

lilly-specialized

Coming Soon

Industry-specific models fine-tuned for healthcare, education, and enterprise use cases.

  • Domain expertise
  • Regulatory compliance
  • Custom terminology
  • Specialized tools

Authentication

All API requests must include your API key in the Authorization header.

curl https://api.astralucent.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "lilly-emotional",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

πŸ” Security Best Practices

  • Never expose your API key in client-side code
  • Use environment variables to store credentials
  • Rotate keys regularly
  • Set up IP allowlisting for production

Rate Limits & Quotas

Tier Requests/min Tokens/day Concurrent Sessions
Free Trial 20 10,000 1
Starter 60 100,000 10
Professional 300 1,000,000 100
Enterprise Custom Unlimited Unlimited

Rate limit headers are included in all responses:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1677652380

Error Handling

The API uses standard HTTP response codes and returns detailed error messages.

400 Bad Request

Invalid request parameters or malformed JSON.

401 Unauthorized

Missing or invalid API key.

429 Too Many Requests

Rate limit exceeded. Check rate limit headers for reset time.

500 Internal Server Error

Unexpected server error. These are rare and we're notified automatically.

Error Response Format

{
    "error": {
        "message": "Invalid API key provided",
        "type": "authentication_error",
        "code": "invalid_api_key"
    }
}

Code Examples

Python Example - Emotional Conversation

from openai import OpenAI
import json

# Initialize client
client = OpenAI(
    api_key="your-api-key",
    base_url="https://api.astralucent.com/v1"
)

# Start a conversation with emotion tracking
session_id = "user-123"

# Create an emotionally aware response
response = client.chat.completions.create(
    model="lilly-emotional",
    messages=[
        {
            "role": "system", 
            "content": "You are Lilly, an AI with genuine emotional understanding."
        },
        {
            "role": "user",
            "content": "I'm feeling a bit overwhelmed with my project."
        }
    ],
    extra_body={
        "emotion_tracking": True,
        "session_id": session_id,
        "personality_traits": {
            "empathetic": 0.9,
            "supportive": 0.85
        }
    }
)

print(f"Lilly: {response.choices[0].message.content}")

# Check emotional state
import requests

emotion_response = requests.get(
    f"https://api.astralucent.com/v1/emotions/{session_id}",
    headers={"Authorization": f"Bearer your-api-key"}
)

emotion_state = emotion_response.json()
print(f"\nEmotional State: {emotion_state['current_state']['description']}")

Need Help?

πŸ“š Documentation

Browse our comprehensive guides and tutorials.

View All Resources β†’

πŸ’¬ Community

Join our developer community for tips and support.

Join Discord β†’

🎯 Direct Support

Get help from our technical team.

Contact Support β†’