Eve library

Getting Started with Lilith API

Guide

Revision 1

On this page

This guide will help you get up and running with the Lilith AI-powered wisdom platform.

Quick Start#

1. Authentication#

javascript
// JavaScript/Node.js
const response = await fetch('https://api.lilith.app/v1/auth/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    email: 'your-email@example.com',
    password: 'your-password'
  })
});

const auth = await response.json();
const token = auth.tokens.access_token;
curl
# cURL
curl -X POST "https://api.lilith.app/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your-email@example.com",
    "password": "your-password"
  }'

2. First API Call#

javascript
// Check API health
const health = await fetch('https://api.lilith.app/v1/health', {
  headers: { 'Authorization': `Bearer ${token}` }
});

console.log(await health.json());

3. Chat with AI#

javascript
// Start a conversation
const chat = await fetch('https://api.lilith.app/v1/chat', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'What is the essence of mindfulness?',
    persona: 'zen_master'
  })
});

const response = await chat.json();
console.log(response.message);

Error Handling#

Always implement proper error handling in your applications:

javascript
async function makeApiCall(url, options) {
  try {
    const response = await fetch(url, options);

    if (!response.ok) {
      const error = await response.json();
      throw new Error(`API Error: ${error.message}`);
    }

    return await response.json();
  } catch (error) {
    console.error('API call failed:', error);
    throw error;
  }
}

Next Steps#


This guide was automatically generated and validated. All code examples have been tested.