Skip to main content

First Steps with Enclava

After installing Enclava, follow these steps to configure and test your instance.

Step 1: Verify Installation

Check that all services are running:

docker compose ps

All services should show "Up" status:

  • enclava-backend
  • enclava-frontend
  • enclava-postgres
  • enclava-redis
  • enclava-qdrant

Step 2: Access Web Interface

Navigate to http://localhost in your browser.

Initial Login

Use the default credentials:

Important: Change these credentials immediately!

Step 3: Change Admin Password

  1. Go to Settings in the sidebar
  2. Navigate to Profile or User Management
  3. Change your password to a secure value
  4. Save changes

Step 4: Get PrivateMode API Key

For confidential LLM processing:

  1. Visit privatemode.ai
  2. Sign up and create an account
  3. Generate an API key
  4. Update your .env file:
PRIVATEMODE_API_KEY=your-privatemode-api-key-here
  1. Restart containers:
docker compose restart enclava-backend

Step 5: Create Your First API Key

Via Web Interface

  1. Navigate to API Keys in the sidebar
  2. Click Create API Key
  3. Fill in the form:
    • Name: My First Key
    • Description: Testing Enclava API
    • Allowed Models: Leave empty for all models
    • Budget: Set optional spending limits
  4. Click Create

Copy Your API Key

⚠️ Important: Copy the API key now - you won't see it again!

The key will look like: en_xxxxxxxxxxxxxxxxxxxxxxxx

Step 6: Test the Connection

Using cURL

curl http://localhost/api/v1/health

Expected response:

{
"status": "healthy",
"app": "Enclava",
"version": "1.0.0"
}

Using Python

import requests

response = requests.get("http://localhost/api/v1/health")
print(response.json())

Using JavaScript/Node.js

const response = await fetch('http://localhost/api/v1/health');
const data = await response.json();
console.log(data);

Step 7: Make Your First Chat Completion

Using cURL

curl -X POST http://localhost/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello, Enclava!"}]
}'

Using Python

import requests

response = requests.post(
"http://localhost/api/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello, Enclava!"}]
}
)

data = response.json()
print(data["choices"][0]["message"]["content"])

Using JavaScript

const response = await fetch('http://localhost/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Hello, Enclava!' }]
})
});

const data = await response.json();
console.log(data.choices[0].message.content);

Step 8: Explore Available Models

import requests

response = requests.get(
"http://localhost/api/v1/models",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)

models = response.json()["data"]
for model in models:
print(f"ID: {model['id']}")
print(f"Owned by: {model['owned_by']}")
print("-" * 40)

Step 9: Check API Documentation

Visit http://localhost/api/v1/docs to explore:

  • All available endpoints
  • Request/response schemas
  • Try endpoints directly from the browser
  • View authentication requirements

Common Setup Issues

API Key Not Working

Problem: 401 Unauthorized errors

Solutions:

  • Verify the key is copied correctly (no extra spaces)
  • Check the key hasn't been revoked
  • Ensure you're using the correct base URL

Connection Refused

Problem: Cannot connect to localhost

Solutions:

  • Verify Docker containers are running: docker compose ps
  • Check if port 8000 is available
  • Try using http://localhost:8000 if using Docker directly

Model Not Available

Problem: "Model not found" error

Solutions:

  • Verify PrivateMode API key is configured
  • Check which models are available: GET /api/v1/models
  • Ensure your API key has access to the model

What's Next?

Now that Enclava is running, explore:

Best Practices

  1. Secure Your Keys: Store API keys in environment variables, never in code
  2. Use Specific Keys: Create separate keys for different applications
  3. Set Budgets: Always set spending limits on new API keys
  4. Monitor Usage: Check analytics regularly to understand usage patterns
  5. Handle Errors: Implement proper error handling in your applications