> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usefusion.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Model APIs Overview

> AI-powered EEG analysis using foundation models hosted on NeuroFusion GPU infrastructure

# Model APIs

NeuroFusion hosts EEG foundation models on GPU infrastructure for AI-powered brain signal analysis. These models run on **models.usefusion.ai** — an NVIDIA A100 GPU server with auto-sleep/wake to minimize costs.

## Available Models

| Model    | Task          | Description                                                                                |
| -------- | ------------- | ------------------------------------------------------------------------------------------ |
| **ZUNA** | `denoise`     | Remove artifacts (eye blinks, muscle, environmental noise) while preserving neural signals |
| **ZUNA** | `reconstruct` | Reconstruct missing or corrupted EEG channels                                              |
| **ZUNA** | `upsample`    | Expand from fewer channels to a standard montage                                           |

## Supported Devices

| Device          | Channels                               | Sample Rate |
| --------------- | -------------------------------------- | ----------- |
| Neurosity Crown | 8 (CP3, C3, F5, PO3, PO4, F6, C4, CP4) | 256 Hz      |
| Muse (2, S)     | 4 (TP9, AF7, AF8, TP10)                | 256 Hz      |

## How It Works

```
Your EEG Device → CSV data → NeuroFusion API → ZUNA Model (GPU) → Cleaned signal → Your app
```

### Pipeline Detail

1. **CSV Input** — Raw EEG data from your device (values in µV)
2. **Preprocessing** — Automatic conversion to MNE `.fif` format with standard 10-05 montage
3. **ZUNA Processing** — Resampling to 256 Hz, filtering, epoching into 5-second segments, normalization, then GPU inference
4. **Output** — Denoised signal returned as JSON (per-channel arrays) or CSV

### Minimum Requirements

* **Recording duration**: At least **6 seconds** (5s minimum for one ZUNA epoch + buffer)
* **Channels**: 4+ EEG channels with standard 10-20 names
* **Format**: CSV with channel columns and optional timestamp column

## Architecture

```
┌─────────────┐     ┌──────────────────┐     ┌───────────────────────┐
│  Frontend    │────▶│  Backend Server   │────▶│  GPU VM               │
│  /recordings │     │  /api/eeg-models  │     │  models.usefusion.ai  │
│  /analysis   │     │  (auto-wake VM)   │     │  NVIDIA A100 80GB     │
└─────────────┘     └──────────────────┘     │  ZUNA model           │
                                              └───────────────────────┘
```

The backend server automatically manages the GPU VM:

* **Auto-wake**: If the VM is deallocated, the first request starts it and returns HTTP 202 with retry guidance
* **Auto-sleep**: VM deallocates after 30 minutes of inactivity to minimize costs
* **Health checks**: `/api/eeg-models/health` shows GPU status and model availability

## Using the Platform

There are two ways to use ZUNA on NeuroFusion:

### 1. Recordings Page (`/recordings`)

* **Live Recording**: Connect your Neurosity Crown or Muse headband, record EEG, then denoise with one click
* **Upload CSV**: Drop in a CSV file from a previous recording
* **View Results**: See denoised signal preview and download cleaned CSV

### 2. Analysis Page (`/analysis`)

* **Upload & Analyze**: Upload CSV, choose ZUNA AI Denoising or other analysis types
* **Side-by-Side**: View raw vs denoised signals in a split comparison
* **Download**: Export denoised data as CSV for further analysis

Both pages are linked — you can record on `/recordings`, denoise, then view detailed results on `/analysis`.
