Introduction

Retail Mind

AI-powered retail data analysis API. Connect your database, ask questions in plain English, and get answers, insights, forecasts, and charts back over HTTP — from any tech stack.

Retail Mind is an API-first product. You bring your data, your AI provider, and your frontend. We handle the hard parts: schema discovery, NL-to-SQL, read-only enforcement, and streaming responses.

How it works

Your question (natural language)
    → Retail Mind finds relevant tables
    → Generates & validates SQL
    → Executes on your database (read-only)
    → Returns: answer + data + chart-ready JSON

What you can do

  • Query your data — Ask questions like “Top 10 products by revenue last quarter” and get SQL + natural language answers.
  • Streaming responses — Use Server-Sent Events for real-time token streaming — watch answers appear word by word.
  • Insights & anomalies — Run automated insight scans and detect unusual patterns in your retail data.
  • Forecasting — Generate demand forecasts with AI-powered narrative interpretation.

Supported AI Providers

Connect your own AI key — or run fully local:

ProviderTypeNotes
OpenAICloudGPT-4o, GPT-4o-mini
AnthropicCloudClaude 3.7 Sonnet, Haiku
Google GeminiCloudGemini 1.5 Pro, Flash
OllamaLocalAny model, no API key
LM StudioLocalOpenAI-compatible local server
CustomSelf-hostedAny OpenAI wire-format endpoint

Supported Data Sources

SourceNotes
PostgreSQLAsync, row-level limit enforcement
MySQL / MariaDBFull schema discovery
SQLiteGreat for development
BigQueryService account auth
SnowflakeWarehouse + role config
CSV / ExcelLoaded into DuckDB in-memory

Quick Start

# 1. Get an API key
curl -X POST http://localhost:8000/v1/auth/keys \
  -H "Content-Type: application/json" \
  -d '{"name": "my-integration"}'
 
# 2. Connect a database
curl -X POST http://localhost:8000/v1/sources \
  -H "Authorization: Bearer $API_KEY" \
  -d '{"name":"My DB","source_type":"postgresql","credentials":{...}}'
 
# 3. Ask a question
curl -X POST http://localhost:8000/v1/query \
  -H "Authorization: Bearer $API_KEY" \
  -d '{"source_id":"...","question":"Top 5 products by revenue this month"}'