RAG Documents & Video — Upload and Analysis
Upload documents, images or videos and query them with AI through the single universal endpoint.
📡 SINGLE ENDPOINT FOR ALL FUNCTIONS
https://app.neuralaiweb.com/functions/neuralaiPublicApiAll functions — chat, image, video, music, document RAG, video RAG — go through this single POST endpoint. The orchestrator automatically detects intent from the prompt or you can force it with force_intent.
Part 1 — Document RAG
🔄 Document RAG Pipeline
- File upload →
https://app.neuralaiweb.com/functions/publicUploadFile - Text extraction / OCR →
https://app.neuralaiweb.com/functions/extractDocumentText - Inject text into prompt → chat con
https://app.neuralaiweb.com/functions/neuralaiPublicApi
📄 Supported document formats (native OCR)
- PDF — including scanned PDFs (native OCR)
- DOCX / ODT — Word and LibreOffice documents
- XLS / XLSX — Excel spreadsheets
- PPT / PPTX — PowerPoint presentations
- TXT / MD / CSV / JSON / HTML — plain text
- PNG / JPG / JPEG / WEBP / GIF / BMP — images with visual OCR
- Maximum 3 files per request
- Size limits: text files (TXT/MD/CSV/JSON/HTML) 50MB · PDF/DOCX and images 20MB · audio 30MB · video 150MB
Step 1 — File upload (public endpoint without auth)
Use https://app.neuralaiweb.com/functions/publicUploadFile to upload the file and get a permanent URL.
const UPLOAD_URL = 'https://app.neuralaiweb.com/functions/publicUploadFile';
async function uploadFile(file) {
const formData = new FormData();
formData.append('file', file);Step 2 — Text extraction / OCR
Extract text content from the file (scanned PDF, images, Office, etc.) via OCR.
const EXTRACT_URL = 'https://app.neuralaiweb.com/functions/extractDocumentText';
async function extractText(fileUrl, fileName) {
const res = await fetch(EXTRACT_URL, {
method: 'POST',Step 3 — RAG Chat with the document
Inject the extracted text into the prompt and send it to the main endpoint.
const API_URL = 'https://app.neuralaiweb.com/functions/neuralaiPublicApi';
async function ragDocumentChat(apiKey, userQuestion, documentText) {
// Costruisci il prompt con il testo del documento
const fullPrompt = `Hai accesso al seguente documento:Complete example — Document RAG from scratch
const API_KEY = 'nai_...'; const API_URL = 'https://app.neuralaiweb.com/functions/neuralaiPublicApi'; const UPLOAD_URL = 'https://app.neuralaiweb.com/functions/publicUploadFile'; const EXTRACT_URL= 'https://app.neuralaiweb.com/functions/extractDocumentText';
Example — RAG with multiple documents (max 3)
async function chatWithMultipleDocs(files, userQuestion) {
// Upload + OCR di tutti i file in parallelo
const docs = await Promise.all(Array.from(files).slice(0, 3).map(async (file) => {
const fd = new FormData();
fd.append('file', file);🧪 Pagina di Test Completa — RAG Documenti & Video
Copia questo file HTML completo, aprilo nel browser e testa subito il RAG documenti (con OCR) e il Video RAG senza installare nulla. Inserisci la tua API key, carica i file e fai domande.
📋 Instructions
- Copy the code below and save it as
test-rag-chat.html - Open it in any browser (double click on the file)
- Enter your API Key in the top left field
- RAG Documents — drag or select files, click Upload + OCR, wait, write your question
- Video RAG — click on Video RAG tab, paste URL or upload file, write question, send
✅ Included features
Open directly in browser — no installation required.
<!DOCTYPE html> <html lang="it"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
Part 2 — Video RAG
🎬 How Video RAG works
The video is analyzed frame by frame with audio and visual understanding via our LLM Orchestrator, and the result is returned as text. You can ask questions about the content, transcriptions, summaries, specific scenes, etc.
- The video is downloaded/uploaded to the LLM Orchestrator
- The LLM Orchestrator processes the video (takes 5–60s for long videos)
- Your question is answered based on the video content
🎥 Supported video formats and limits
Accepted formats
- MP4 (recommended)
- MOV — Apple QuickTime
- AVI — Audio Video Interleave
- MKV — Matroska
- WebM — web format
Limits
- Maximum duration: 60 minutes
- Max size: ~1 GB (via public URL)
- Upload size: ~50 MB (via publicUploadFile)
- Cost: 20 tokens per analysis
Mode A — Video RAG from public URL
If the video is already on a public server (YouTube direct, CDN, etc.), pass the URL in the video_url field. The server will download it and analyze it via LLM Orchestrator.
const response = await fetch('https://app.neuralaiweb.com/functions/neuralaiPublicApi', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: 'nai_...',Mode B — Video RAG from local upload (user file)
If the video is local (user file input), upload it first with publicUploadFile, then pass the resulting file_url in the video_file_url field.
const UPLOAD_URL = 'https://app.neuralaiweb.com/functions/publicUploadFile';
const API_URL = 'https://app.neuralaiweb.com/functions/neuralaiPublicApi';
async function videoRAGFromFile(videoFile, userQuestion) {
// Step 1: Upload del video💡 Example questions for Video RAG
- "Summarize the video content in 5 key points"
- "Transcribe all spoken dialogues in the video"
- "Describe what happens at minute 2:30"
- "Extract all text written on screen (video OCR)"
- "How many people appear in the video and what do they do?"
- "Is this video appropriate for children?"
Complete example — UI with file input and URL
<!DOCTYPE html> <html> <head><meta charset="UTF-8"><title>Video RAG NeuralAI</title></head> <body> <h2>🎬 Video RAG</h2>
⚠️ Video RAG Technical Notes
- Processing takes 10–60 seconds depending on video length
- Video > 50 MB: use Mode A (public URL) — the server downloads directly
- Video < 50 MB: use Mode B (upload) for maximum reliability
- Private or authentication-required video URLs are not supported in Mode A
- Uploaded videos are automatically deleted after analysis
📋 RAG field summary — POST request body
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | string | ✅ Yes | Your API key (nai_...) |
| prompt | string | ✅ Yes | Question or instruction for AI |
| force_intent | string | Recommended | 'chat' for doc RAG · 'video_rag' for video |
| video_url | string | Video only (A) | Public URL of the video to analyze |
| video_file_url | string | Video only (B) | URL of video uploaded via publicUploadFile |
| file_urls | array | No | Array of document file URLs (max 3) — alternative to manual extraction |
Deleting storage files from external apps
If your app generates or uploads files via the NeuralAI API key, you can list and delete them programmatically to free up your account's storage quota, by integrating these calls into your application's backend.
📡 Endpoint and requirements
https://app.neuralaiweb.com/functions/manageMediaStorage- API key with the 💾 Storage scope active, passed as x-api-key header (or Authorization Bearer)
- Up to 1 GB everything works without tokens (free quota); beyond, each extra GB costs 50 tokens per month, charged automatically from the owner's wallet
- The key can list and delete ONLY the key owner's files
Example — list and delete files from your app
const STORAGE_URL = 'https://app.neuralaiweb.com/functions/manageMediaStorage';
// 1) Elenca i file del tuo account storage (nomi, cartelle, dimensioni)
async function listMyFiles(apiKey) {
const res = await fetch(STORAGE_URL, {⚠️ Notes
- Files still referenced by NeuralAI records (search history, document library, published sites) are skipped and counted in skipped
- Deletion immediately frees up the key owner's storage quota
- Calls must be integrated into your app's backend (the key is a secret: never expose it in frontend code)