🔌 ENV Platform API Reference

Complete documentation for all 7 microservices

🔐 Authentication: All endpoints require API key authentication. Include in headers: Authorization: Bearer YOUR_API_KEY

Session Orchestrator

Master API coordinator - manages session state, service health, and request routing

Port 8000 Base URL: http://localhost:8000 Version: v1
POST /api/v1/session/create

Create a new user session for brain-to-image generation

Request Body:

JSON { "user_id": "user_12345", "device_type": "muse", "session_config": { "duration_minutes": 30, "model": "sdxl-turbo" } }
Response (200 OK):
{ "session_id": "sess_abc123", "status": "active", "created_at": "2025-01-17T01:00:00Z", "websocket_url": "ws://localhost:8007/stream/sess_abc123" }
GET /api/v1/session/{session_id}

Retrieve current session status and statistics

Path Parameters:

Parameter Type Required Description
session_id string Required Unique session identifier from create endpoint
Response (200 OK):
{ "session_id": "sess_abc123", "status": "active", "images_generated": 42, "duration_seconds": 1245, "last_activity": "2025-01-17T01:20:00Z" }
POST /api/v1/session/{session_id}/end

Gracefully terminate an active session and cleanup resources

Response (200 OK):
{ "session_id": "sess_abc123", "status": "ended", "summary": { "total_images": 42, "duration_seconds": 1800, "avg_latency_ms": 87 } }

Generation Service

SDXL-powered image generation from neural prompts

Port 8005 Base URL: http://localhost:8005 GPU Required
POST /api/v1/generate

Generate an image from a text prompt or neural embedding

Request Body:

JSON { "prompt": "sunset over mountains", "negative_prompt": "blurry, distorted", "steps": 20, "guidance_scale": 7.5, "width": 1024, "height": 1024, "seed": null }

Parameters:

Parameter Type Required Description
prompt string Required Text description or neural embedding
steps integer Optional Inference steps (default: 20, range: 10-50)
guidance_scale float Optional Prompt adherence (default: 7.5, range: 1-15)
width/height integer Optional Image dimensions (default: 1024x1024)
Response (200 OK):
{ "image_url": "https://cdn.ethereavision.com/images/abc123.png", "image_base64": "iVBORw0KGgoAAAANS...", "metadata": { "steps": 20, "guidance_scale": 7.5, "generation_time_ms": 245 } }

XR Streaming Gateway

WebSocket server for real-time VR streaming

Port 8007 WebSocket Real-time
WS /stream/{session_id}

Open WebSocket connection for real-time image streaming to VR headset

Connection Example (JavaScript):

JavaScript const ws = new WebSocket('ws://localhost:8007/stream/sess_abc123'); ws.onopen = () => { console.log('Connected to ENV Platform'); }; ws.onmessage = (event) => { const data = JSON.parse(event.data); if (data.type === 'image') { displayImage(data.image_base64); } }; ws.onerror = (error) => { console.error('WebSocket error:', error); };

Message Format:

JSON { "type": "image", "image_base64": "iVBORw0KGgoAAAANS...", "timestamp": 1705456800, "metadata": { "prompt": "neural_embedding_123", "confidence": 0.87 } }

📋 Quick Reference

Service Port Primary Endpoints
Session Orchestrator 8000 /api/v1/session/*
Neuro Ingest 8001 /api/v1/ingest/stream
Preprocessing 8002 /api/v1/preprocess
Brain Encoder 8003 /api/v1/encode
Semantic Engine 8004 /api/v1/semantic/extract
Generation Service 8005 /api/v1/generate
XR Streaming 8007 ws://host/stream/{id}

Note: Individual service endpoints are documented in their respective service READMEs in the services/ directory.