{"id":13455936,"url":"https://github.com/apocas/restai","last_synced_at":"2026-05-24T12:03:05.073Z","repository":{"id":167037808,"uuid":"642578676","full_name":"apocas/restai","owner":"apocas","description":"RESTai is an AIaaS (AI as a Service) open-source platform. Supports many public and local LLM suported by Ollama/vLLM/etc. Precise embeddings usage, tuning, analytics etc. Built-in image/audio generation with dynamic loading generators. Live chat deployment. Built-in block based graphical language. Prompt versioning and much more...","archived":false,"fork":false,"pushed_at":"2026-05-20T18:43:19.000Z","size":73690,"stargazers_count":506,"open_issues_count":4,"forks_count":101,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-05-20T22:55:44.932Z","etag":null,"topics":["blocky","embeddings","fastapi","langchain","llama","llamaindex","llm","ollama","openai","openaiapi","python","rag","stable-diffusion","transformers"],"latest_commit_sha":null,"homepage":"https://restai.cloud","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apocas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-18T22:27:33.000Z","updated_at":"2026-05-20T18:43:21.000Z","dependencies_parsed_at":"2023-12-03T01:24:33.466Z","dependency_job_id":"b799d501-f16d-4d60-b922-5808794c4f9d","html_url":"https://github.com/apocas/restai","commit_stats":{"total_commits":684,"total_committers":8,"mean_commits":85.5,"dds":"0.14181286549707606","last_synced_commit":"3d82b51839e78a1f6039d0e0cc6c0b85c5f65f66"},"previous_names":["apocas/restai"],"tags_count":136,"template":false,"template_full_name":null,"purl":"pkg:github/apocas/restai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apocas%2Frestai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apocas%2Frestai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apocas%2Frestai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apocas%2Frestai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apocas","download_url":"https://codeload.github.com/apocas/restai/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apocas%2Frestai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33432867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"online","status_checked_at":"2026-05-24T02:00:06.296Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blocky","embeddings","fastapi","langchain","llama","llamaindex","llm","ollama","openai","openaiapi","python","rag","stable-diffusion","transformers"],"created_at":"2024-07-31T08:01:13.690Z","updated_at":"2026-05-24T12:03:05.066Z","avatar_url":"https://github.com/apocas.png","language":"Python","funding_links":[],"categories":["Python","Langchain","Image Generation \u0026 Editing"],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD033 --\u003e\n\n\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/restai-logo.png\" alt=\"RESTai Logo\" width=\"120\"/\u003e\n  \u003cbr/\u003eRESTai\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eAIaaS (AI as a Service) — Create AI projects and consume them via a simple REST API.\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/apocas/restai/actions/workflows/tests.yml\"\u003e\u003cimg src=\"https://github.com/apocas/restai/actions/workflows/tests.yml/badge.svg\" alt=\"Tests\"/\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/python-3.11+-blue.svg\" alt=\"Python 3.11+\"/\u003e\n  \u003ca href=\"https://github.com/apocas/restai/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-green.svg\" alt=\"License\"/\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/docker-ready-2496ED?logo=docker\u0026logoColor=white\" alt=\"Docker\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/kubernetes-ready-326CE5?logo=kubernetes\u0026logoColor=white\" alt=\"Kubernetes\"/\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/templates.png\" width=\"800\" alt=\"RESTai Dashboard\"/\u003e\n\u003c/div\u003e\n\n---\n\n## Live Demo\n\nTry RESTai without installing — **[ai.restai.cloud](https://ai.restai.cloud/admin)**\n\nLogin: `demo` / `demodemo` (restricted account — can browse and chat, but cannot create or modify projects)\n\n---\n\n## Quick Start\n\n### Install from PyPI\n\n```bash\npip install restai-core\nrestai init      # Create database + admin user\nrestai migrate   # Run migrations\nrestai serve     # → http://localhost:9000/admin (admin / admin)\n```\n\nUse an env file for configuration:\n\n```bash\nrestai serve -e .env -p 8080 -w 4\n```\n\nAvailable on [PyPI](https://pypi.org/project/restai-core/) — includes the pre-built React frontend, no Node.js required.\n\n### Run from source (development)\n\n```bash\ngit clone https://github.com/apocas/restai \u0026\u0026 cd restai\nmake install\nmake dev  # → http://localhost:9000/admin (admin / admin)\n```\n\n### Docker\n\nPull the official prebuilt image (multi-arch — `linux/amd64` and `linux/arm64`):\n\n```bash\ndocker run -p 9000:9000 apocas/restai:latest\n# → http://localhost:9000/admin (admin / admin)\n```\n\nAlso published to GitHub Container Registry as `ghcr.io/apocas/restai:latest`. Pin a version with `:6.2.13` (or `:6.2`, `:6`) instead of `:latest`.\n\nOr build locally with the bundled compose stack:\n\n```bash\ndocker compose --env-file .env up --build\n```\n\n## Updating\n\n**PyPI:**\n```bash\npip install --upgrade restai-core\nrestai migrate -e .env\n```\n\n**From source:**\n```bash\nmake update\n```\n\nFetches the latest release tag from GitHub, installs dependencies, runs database migrations, and rebuilds the frontend. Auto-detects GPU for GPU-specific deps.\n\n---\n\n## Why RESTai?\n\n- **Multi-project AI platform** — RAG (with optional SQL-to-NL and auto-sync from URLs/S3), Agents, Block (visual logic), and Inference in one place\n- **Full Web UI included** — React dashboard with analytics, not just an API\n- **Any LLM** — OpenAI, Anthropic, Ollama, Gemini, LiteLLM, vLLM, Azure, and more\n- **Feature complete** — Teams, RBAC, OAuth/LDAP, TOTP 2FA, token tracking, per-project rate limiting, white-label branding, Kubernetes-native\n- **Extensible tools** — MCP (Model Context Protocol) for unlimited agent integrations\n- **Token tracking, cost \u0026 latency analytics** — built-in dashboard with daily usage, per-project costs, latency monitoring, and top LLM charts\n\n---\n\n## Features\n\n### Dashboard \u0026 Analytics\n\nTrack token usage, costs, latency, and project activity from a centralized dashboard. Daily charts for tokens, costs, and response latency per project — identify performance regressions at a glance.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/home.png\" width=\"750\" alt=\"RESTai Dashboard\"/\u003e\n\u003c/div\u003e\n\n### Projects \u0026 Chat Playground\n\nCreate and manage AI projects. Each project has its own LLM, system prompt, tools, and configuration. Test instantly in the built-in chat playground.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/projects.png\" width=\"750\" alt=\"RESTai Projects\"/\u003e\n\u003c/div\u003e\n\n### RAG (Retrieval-Augmented Generation)\n\nUpload documents and query them with LLM-powered retrieval. Supports multiple vector stores, reranking (ColBERT / LLM-based), sandboxed mode to reduce hallucination, and evaluation via [deepeval](https://github.com/confident-ai/deepeval). Optionally connect a MySQL or PostgreSQL database to translate natural language questions into SQL queries automatically.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/rag.png\" width=\"750\" alt=\"RESTai RAG\"/\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/analytics.png\" width=\"750\" alt=\"RESTai RAG Analytics\"/\u003e\n\u003c/div\u003e\n\n### Knowledge Graph (RAG)\n\nOpt-in entity extraction layered on top of RAG. When enabled on a project, every ingested document is run through a NER pipeline (`dslim/bert-base-NER` by default) and the extracted people, organizations, locations, and other entities are persisted in a queryable graph alongside the vector store. Entity extraction runs as a background task so ingestion stays fast.\n\n**What you get:**\n- **Entity-aware retrieval** — A custom postprocessor boosts retrieved chunks whose source documents mention entities found in the user's query, improving recall on questions that reference specific names\n- **Visual graph explorer** — Interactive force-directed graph (vis-network) of all entities and their co-occurrence relationships. Click any node for source list, mention count, and related entities\n- **Entity browser** — Searchable, type-filtered table of every entity in the project with mention counts and one-click rename / merge / delete\n- **Disambiguation** — \"Find Duplicates\" surfaces near-identical entity pairs (Levenshtein-based) for one-click merging — fix \"Acme\", \"Acme Corp\", \"ACME Inc.\" in seconds\n- **Natural language graph queries** — Ask questions like \"What did the document say about Acme Corp?\" and get answers scoped to entity-matched sources, bypassing pure vector similarity\n- **Rebuild** — Re-extract the entire graph from existing sources after enabling the feature on a populated project\n\nEnable it from the project edit page (Knowledge tab → \"Enable Knowledge Graph\"). Available exclusively for RAG projects.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/rag2.png\" width=\"750\" alt=\"RESTai Knowledge Graph\"/\u003e\n\u003c/div\u003e\n\n### Agents + MCP\n\nZero-shot ReAct agents with built-in tools and [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server support for extensible tool access. Connect any MCP-compatible server via HTTP/SSE or stdio.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/agent.png\" width=\"750\" alt=\"RESTai Agent\"/\u003e\n\u003c/div\u003e\n\n### Agentic Browser\n\nGive your agents a real headless Chromium they can drive — log in to vendor portals, fill forms, scrape data, download invoices, take screenshots. Powered by Playwright running in a per-chat Docker container with cookie / localStorage persistence so the agent only needs to log in once.\n\n**Nine `browser_*` builtin tools** the LLM composes into workflows:\n\n- `browser_goto`, `browser_click`, `browser_fill`, `browser_select`, `browser_wait`\n- `browser_content` (sanitized HTML/markdown of the current page)\n- `browser_screenshot` (rendered inline in the chat — uses the same image cache as `draw_image`)\n- `browser_download` (files land in the container's `/home/user/downloads/` so the `terminal` tool can pick them up)\n- `browser_eval` (admin-opt-in JS escape hatch)\n\n**Built for production, safely**:\n\n- 🔐 **Encrypted secrets vault** — admin stores credentials per-project (`portal_password`, etc.) and the agent calls `browser_fill(selector, secret_ref=\"portal_password\")`. The plaintext is resolved server-side and typed straight into the browser; it never enters the LLM's context, the inference log, the audit log, or the chat transcript.\n- 🛡️ **Per-project domain allowlist** — `browser_goto` refuses anything not on `browser_allowed_domains` (supports `*.example.com` suffix globs). Defends against prompt injection that tells the agent to navigate to a hostile site.\n- 💾 **Persistent sessions** — login state (cookies + localStorage) is saved to Redis keyed by `(project_id, domain)` with a 30-day TTL. Future chats on the same project skip the login dance.\n- 🧹 **Auto-cleanup** — idle browser containers are reaped by `crons/browser_cleanup.py` after `browser_timeout` seconds (default 15 min).\n\nToggle the feature on at **Settings → Agentic Browser**. Reuses the same Docker daemon as the sandboxed terminal; image defaults to `mcr.microsoft.com/playwright/python:v1.48.0-jammy`.\n\n### Inference (Multimodal)\n\nDirect LLM chat and completion. Supports sending images alongside text using any vision-capable model (LLaVA, Gemini, GPT-4o, etc.).\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/playground.png\" width=\"750\" alt=\"RESTai Inference\"/\u003e\n\u003c/div\u003e\n\n### Block (Visual Logic Builder)\n\nBuild processing logic visually using a Blockly-based IDE — no LLM required. Drag-and-drop blocks to define how input is transformed into output. Use the \"Call Project\" block to invoke other RESTai projects, enabling composition of AI pipelines without writing code.\n\n**Supported blocks:** text operations, math, logic, variables, loops, and custom RESTai blocks (Get Input, Set Output, Call Project, Log).\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/block.png\" width=\"750\" alt=\"RESTai Block IDE\"/\u003e\n\u003c/div\u003e\n\n### Classifier Playground\n\nBuilt-in zero-shot text classifier with multiple model support. Enter any text and a comma-separated list of candidate labels — get instant classification scores without training. Use it standalone from the UI or programmatically via `POST /tools/classifier`. Also available as a Blockly block for visual logic projects.\n\n**Available models:**\n- **BART Large MNLI** (default) — Established standard, reliable general-purpose classifier\n- **DeBERTa v3 Large** — Best accuracy, newer architecture\n- **DeBERTa v3 Base** — Good balance of speed and accuracy\n- **XLM-RoBERTa** — Multilingual support for 100+ languages\n- **DistilBERT MNLI** — Fastest and lightest, ideal for high-volume classification\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/classifier.png\" width=\"750\" alt=\"RESTai Classifier Playground\"/\u003e\n\u003c/div\u003e\n\n### MCP Server\n\nRESTai includes an optional built-in [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that exposes your projects as tools consumable by any MCP client — Claude Desktop, Cursor, or custom agents. Each user authenticates with a Bearer API key and can only access their assigned projects.\n\nEnable via `MCP_SERVER=true` environment variable or the admin settings page (requires restart). Clients connect to `http://your-host:9000/mcp/sse`.\n\n**Available tools:**\n- `list_projects` — Discover which AI projects you have access to\n- `query_project` — Send a question (with optional image) to any accessible project\n\n### Evaluation Framework\n\nBuilt-in evaluation system to measure and track AI project quality over time. Create test datasets with question/expected-answer pairs, run evaluations with multiple metrics, and visualize score trends.\n\n**Metrics** (powered by [DeepEval](https://github.com/confident-ai/deepeval)):\n- **Answer Relevancy** — Is the answer relevant to the question?\n- **Faithfulness** — Is the answer grounded in the retrieved context? (RAG projects)\n- **Correctness** — Does the answer match the expected output?\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/eval.png\" width=\"750\" alt=\"RESTai Evaluation\"/\u003e\n\u003c/div\u003e\n\n### Prompt Versioning\n\nEvery system prompt change is automatically versioned. Browse the full history, compare versions, and restore any previous prompt with one click. Eval runs are linked to prompt versions, enabling A/B comparison — see exactly how a prompt change affected quality scores.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/prompts.png\" width=\"750\" alt=\"RESTai Prompt Versioning\"/\u003e\n\u003c/div\u003e\n\n### Image Generation\n\nLocal and remote image generators loaded dynamically. Supports Stable Diffusion, Flux, DALL-E, RMBG2, and more.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/image.png\" width=\"45%\" alt=\"Flux1\"/\u003e\n\u003c/div\u003e\n\n### GPU Auto-Detection \u0026 Management\n\nRESTai automatically detects NVIDIA GPUs at startup and displays detailed hardware information in the admin settings — model name, VRAM, temperature, utilization, power draw, driver and CUDA versions. GPU support is auto-enabled when hardware is detected, or can be toggled manually.\n\n`make install` also detects GPUs automatically and installs GPU dependencies when available.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/gpus.png\" width=\"750\" alt=\"RESTai GPU Detection\"/\u003e\n\u003c/div\u003e\n\n### Direct Access (OpenAI-Compatible)\n\nUse LLMs, image generators, and audio transcription directly via OpenAI-compatible API endpoints — no project required. Team-level permissions control which models each user can access, and all usage counts toward team budgets.\n\n**Supported endpoints:**\n- `POST /v1/chat/completions` — Chat with any LLM (streaming supported)\n- `POST /v1/images/generations` — Generate images via DALL-E, Flux, Stable Diffusion, etc.\n- `POST /v1/audio/transcriptions` — Transcribe audio files\n\nWorks with any OpenAI-compatible SDK:\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(base_url=\"http://localhost:9000/v1\", api_key=\"YOUR_API_KEY\")\nresponse = client.chat.completions.create(\n    model=\"gpt-4o\",\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n)\n```\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/directaccess.png\" width=\"750\" alt=\"RESTai Direct Access\"/\u003e\n\u003c/div\u003e\n\n### Teams \u0026 Multi-tenancy\n\nEach team has its own users, admins, projects, and LLM/embedding access controls — including image and audio generator permissions. Users can belong to multiple teams, each with optional custom branding.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/teams.png\" width=\"750\" alt=\"RESTai Teams\"/\u003e\n\u003c/div\u003e\n\n### Custom Branding (White-Labeling)\n\nEach team can customize the platform appearance for its members — ideal for white-labeling or multi-tenant deployments where different teams need distinct identities.\n\n**Configurable per team:**\n- **App Name** — Override the platform name in the sidebar and header\n- **Logo** — Custom logo via URL or data URI (replaces the default logo)\n- **Primary \u0026 Secondary Colors** — Full MUI theme color override with live color picker\n- **Welcome Message** — Custom landing text for team members\n\n**Multi-team users:** When a user belongs to multiple branded teams, a team switcher appears in the sidebar letting them choose which branding to apply. The preference is persisted in user settings.\n\n**API:** `GET /teams/{id}/branding` returns team branding without authentication (useful for custom login pages). Update branding via `PATCH /teams/{id}` with a `branding` object.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/branding.png\" width=\"750\" alt=\"RESTai Branding\"/\u003e\n\u003c/div\u003e\n\n### Two-Factor Authentication (TOTP)\n\nSecure local user accounts with TOTP-based two-factor authentication, compatible with Google Authenticator, Authy, and other authenticator apps.\n\n- **User self-service** — Enable/disable 2FA from the user profile page with QR code setup and one-time recovery codes\n- **Admin enforcement** — Platform admins can enforce 2FA for all local users via the settings page (users cannot disable when enforced)\n- **Recovery codes** — 8 single-use codes generated during setup for account recovery if the authenticator is lost\n- **Local auth only** — 2FA applies to username/password login; SSO and API key authentication are unaffected\n- **Encrypted secrets** — TOTP secrets are encrypted at rest using Fernet; recovery codes are stored as SHA-256 hashes\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/branding.png\" width=\"750\" alt=\"RESTai Branding\"/\u003e\n\u003c/div\u003e\n\n### Guardrails\n\nProtect your AI projects with input and output guards. Guards are regular RESTai projects — define safety rules via system prompts, and they'll evaluate every request and response automatically.\n\n- **Input Guard** — Checks user questions before inference\n- **Output Guard** — Checks LLM responses after inference\n- **Block or Warn mode** — Hard-block unsafe content or flag it while passing through\n- **Analytics dashboard** — Track block rates, view blocked requests, and monitor guard effectiveness over time\n\n### Audit Log\n\nEvery mutation (create, update, delete) across the platform is automatically logged — who did what, when, and which resource was affected. Admins can review the full audit trail from the admin dashboard.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/audit.png\" width=\"750\" alt=\"RESTai Audit Log\"/\u003e\n\u003c/div\u003e\n\n### Rate Limiting\n\nSet per-project request limits to prevent abuse and control costs. Configure the maximum number of requests per minute in the project edit page. Returns HTTP 429 when the limit is exceeded.\n\n### Knowledge Base Sync\n\nAutomatically keep your RAG knowledge base up-to-date by syncing from external sources on a schedule. Configure per project — each project manages its own sources and sync interval.\n\n**Supported sources:**\n- **Web URLs** — Periodically re-scrape web pages and update the knowledge base\n- **Amazon S3** — Sync documents from S3 buckets with optional prefix filtering (supports all file types: PDF, DOCX, CSV, etc.)\n- **Confluence** — Sync all pages from a Confluence Cloud space (HTML stripped to plain text, paginated)\n- **SharePoint / Microsoft 365** — Sync files from a SharePoint Online document library via Microsoft Graph API (OAuth2 client credentials, optional folder filter)\n- **Google Drive** — Sync files from a Drive folder via service account (supports native Google Docs/Sheets/Slides export + binary files)\n\n**Features:**\n- Configurable sync intervals (15 minutes to 24 hours)\n- Multiple sources per project with independent settings (splitter, chunk size)\n- Manual \"Sync Now\" trigger via UI or API (`POST /projects/{id}/sync/trigger`)\n- Last sync timestamp tracking\n- All credentials masked in API responses (S3 keys, Confluence tokens, SharePoint secrets, Drive service account JSON)\n\n### Embeddable Chat Widget\n\nAdd an AI chat bubble to any website with a single `\u003cscript\u003e` tag — no frontend development needed. The widget connects to a RESTai project, streams responses in real-time, and maintains conversation context.\n\n```html\n\u003cscript\n  src=\"https://your-restai.com/widget/chat.js\"\n  data-project-id=\"7\"\n  data-api-key=\"sk-abc123...\"\n  data-title=\"Support Bot\"\n  data-primary-color=\"#6366f1\"\n  data-welcome-message=\"Hi! How can I help?\"\n\u003e\u003c/script\u003e\n```\n\n**Customizable:** title, subtitle, colors, avatar, position (left/right), and welcome message — all via `data-*` attributes. Configure and preview live from the Widget tab in the project page before deploying.\n\n**Secure:** Requires a read-only, project-scoped API key (visible in page source by design — same model as Stripe publishable keys). Shadow DOM isolates styles from the host page.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/widget.png\" width=\"750\" alt=\"RESTai Chat Widget\"/\u003e\n\u003c/div\u003e\n\n### WordPress Plugin\n\nA full-featured WordPress plugin that turns any RESTai instance into the AI engine of a WordPress site. Each capability maps to its own RESTai project, so models, prompts and budgets stay tunable per task — and the plugin auto-provisions the starter projects on first connect, so there's nothing to wire up by hand.\n\n**What it does:**\n- **Generate post content, excerpts and SEO meta** straight from Gutenberg — also wires title/description/focus keyphrase into Yoast and Rank Math fields\n- **One-click featured image generation** using whichever generator your team has access to (Flux, SDXL, DALL·E…)\n- **Translate any post to N languages** as drafts, with Polylang/WPML compatibility\n- **AI comment moderation** — auto-flag spam and toxic comments before they're approved, with optional suggested replies\n- **WooCommerce product descriptions and FAQ generation** from product attributes\n- **Knowledge sync** — every published post and page is auto-pushed into a Support Bot RAG project so the bot is always current\n- **AI site search** — replaces native WP search with semantic answers from the support bot\n- **Embeddable chat widget** — one toggle adds the chat bubble to public pages with the right widget key auto-provisioned\n- **AI-personalised transactional emails** via the `wp_mail` filter\n- **Token usage and cost panel** mirrored straight into the WP admin\n\n**One Make-style install:** drop the plugin zip into `Plugins → Add New → Upload Plugin`, paste your RESTai URL + API key in **Settings → RESTai**, pick a team, click **Auto-provision starter projects** — done.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/wordpress1.png\" width=\"49%\" alt=\"RESTai WordPress plugin — Settings page\"/\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/wordpress2.png\" width=\"49%\" alt=\"RESTai WordPress plugin — Editor sidebar\"/\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/wordpress3.png\" width=\"49%\" alt=\"RESTai WordPress plugin — Analytics page\"/\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/wordpress4.png\" width=\"49%\" alt=\"RESTai WordPress plugin — Front-end widget\"/\u003e\n\u003c/div\u003e\n\n### Telegram, Slack \u0026 WhatsApp Integration\n\nConnect any project to **Telegram**, **Slack**, or **WhatsApp** — messages are processed through the project's chat pipeline and responses are sent back automatically.\n\n- **Telegram** — Paste your [BotFather](https://t.me/BotFather) token in the project settings. No public URL required.\n- **Slack** — Create a Slack app at [api.slack.com](https://api.slack.com), add the standard message/history scopes, install it to your workspace, and paste the Bot Token (xoxb-...) in the project settings. Polled by the cron runner — no public URL or daemon required.\n- **WhatsApp Business Cloud API** — First-party Meta integration (no Twilio middleman, ~1k free conversations/month). Webhook-driven: paste the auto-generated webhook URL into Meta Business Suite → WhatsApp → Configuration → Webhooks, configure phone-number id + access token + app secret + verify token in the project's Integrations tab, and the bot is live. Per-project allowlist of E.164 senders protects your number's quality rating from spam. Includes a `send_whatsapp` built-in tool for outbound notifications (constrained by Meta's 24-hour customer-service window). **Requires a public URL** — local dev needs a tunnel like ngrok or Cloudflare Tunnel.\n\n### Project Routines\n\nSchedule recurring messages that auto-fire on any project — the message runs through the project's normal chat/question pipeline, so it works with RAG, agents, and block projects alike.\n\n### Settings \u0026 Configuration\n\nWhite-label the UI, configure currency for cost tracking, set agent iteration limits, manage LLM proxy, and more.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/settings.png\" width=\"750\" alt=\"RESTai Settings\"/\u003e\n\u003c/div\u003e\n\n---\n\n## Supported LLMs\n\nTalks directly to provider SDKs. Each model has a configurable context window with automatic chat memory management — older messages are summarized rather than dropped.\n\n| Provider | Class |\n|----------|-------|\n| [Ollama](https://ollama.com/) | `Ollama` / `OllamaMultiModal` |\n| [OpenAI](https://platform.openai.com/) | `OpenAI` |\n| [Anthropic](https://www.anthropic.com/) | `Anthropic` |\n| [Google Gemini](https://ai.google.dev/) | `Gemini` / `GeminiMultiModal` |\n| [Grok (xAI)](https://x.ai/) | `Grok` |\n| [LiteLLM](https://litellm.ai/) | `LiteLLM` |\n| [vLLM](https://vllm.ai/) | `vLLM` |\n| [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) | `AzureOpenAI` |\n| [AWS Bedrock](https://aws.amazon.com/bedrock/) | `Bedrock` |\n| OpenAI-Compatible | `OpenAILike` |\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/llms.png\" width=\"750\" alt=\"RESTai LLMs\"/\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/ollama.png\" width=\"750\" alt=\"RESTai Ollama\"/\u003e\n\u003c/div\u003e\n\n---\n\n## Tech Stack\n\n**Backend:** [FastAPI](https://fastapi.tiangolo.com/) · [SQLAlchemy](https://www.sqlalchemy.org/) · [LlamaIndex](https://www.llamaindex.ai/) · [Alembic](https://alembic.sqlalchemy.org/)\n**Frontend:** [React 18](https://react.dev/) · [MUI v5](https://mui.com/) · [Redux Toolkit](https://redux-toolkit.js.org/)\n**Vector Stores:** [ChromaDB](https://www.trychroma.com/) · [PGVector](https://github.com/pgvector/pgvector) · [Weaviate](https://weaviate.io/) · [Pinecone](https://www.pinecone.io/)\n**Databases:** SQLite (default) · PostgreSQL · MySQL\n**Package Manager:** [uv](https://github.com/astral-sh/uv)\n\n---\n\n## API\n\nAll endpoints are documented via [Swagger](https://restai.cloud/swagger/).\n\n**Create a project:**\n\n```bash\ncurl -X POST http://localhost:9000/projects \\\n  -u admin:admin \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"name\": \"my-rag\",\n    \"type\": \"rag\",\n    \"llm\": \"gpt-4o\",\n    \"embeddings\": \"text-embedding-3-small\",\n    \"vectorstore\": \"chroma\"\n  }'\n```\n\n**Chat with a project:**\n\n```bash\ncurl -X POST http://localhost:9000/projects/1/chat \\\n  -u admin:admin \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"message\": \"What is RESTai?\"}'\n```\n\n---\n\n## Installation\n\nRESTai uses [uv](https://github.com/astral-sh/uv) for dependency management. Python 3.11+ required.\n\n### Local\n\n```bash\nmake install    # Install deps, initialize DB, build frontend\nmake dev        # Development server with hot reload (port 9000)\nmake start      # Production server (4 workers, port 9000)\n```\n\nDefault credentials: `admin` / `admin` (configurable via `RESTAI_DEFAULT_PASSWORD`).\n\n### Docker\n\n**Prebuilt image** (recommended — no build, no toolchain):\n\n```bash\ndocker run -d --name restai -p 9000:9000 apocas/restai:latest\n```\n\nPass an env file to inject configuration (API keys, DB host, etc.) and a volume to persist the SQLite DB / uploads across restarts:\n\n```bash\ndocker run -d --name restai -p 9000:9000 --env-file .env \\\n  -v restai-data:/app/data \\\n  apocas/restai:6.2.13\n```\n\nPublished on every release to both registries — pick whichever you prefer:\n\n| Registry | Image |\n|----------|-------|\n| Docker Hub | `apocas/restai:latest` · `apocas/restai:6.2.13` · `apocas/restai:6.2` · `apocas/restai:6` |\n| GitHub Container Registry | `ghcr.io/apocas/restai:latest` (same tag scheme) |\n\nBuilt for `linux/amd64` and `linux/arm64` (Apple Silicon / Graviton). Pin a specific version in production (`:6.2.13`) rather than `:latest`. The publishing workflow lives in [`.github/workflows/docker-publish.yml`](.github/workflows/docker-publish.yml) — releases auto-build, or trigger manually with a tag input.\n\n**Build locally with compose** (for development):\n\n```bash\n# Edit .env with your configuration, then:\ndocker compose --env-file .env up --build\n```\n\nOptional profiles for additional services:\n\n```bash\ndocker compose --env-file .env --profile redis up --build      # + Redis\ndocker compose --env-file .env --profile postgres up --build   # + PostgreSQL\ndocker compose --env-file .env --profile mysql up --build      # + MySQL\n```\n\n### Kubernetes (Helm)\n\nA Helm chart is provided in `chart/restai/`.\n\n```bash\nhelm install restai chart/restai/ \\\n  --set config.database.postgres.host=my-postgres \\\n  --set secrets.postgresPassword=mypassword\n```\n\nFor production with multiple replicas, set fixed secrets for JWT and encryption:\n\n```bash\nhelm install restai chart/restai/ \\\n  --set config.database.postgres.host=postgres \\\n  --set secrets.postgresPassword=mypassword \\\n  --set secrets.authSecret=$(openssl rand -base64 48) \\\n  --set secrets.ssoSecretKey=$(openssl rand -base64 48) \\\n  --set secrets.fernetKey=$(python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())')\n```\n\nSee `chart/restai/` for full Helm values and configuration options.\n\n---\n\n## Architecture\n\n### Stateless (Production)\n\nNo state stored in the RESTai service — ideal for horizontal scaling.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/restai_stateless.png\" width=\"750\" alt=\"RESTai Stateless Architecture\"/\u003e\n\u003c/div\u003e\n\n### Stateful (Development)\n\nDirect interaction with the GPU layer — ideal for small deployments.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/apocas/restai/blob/master/readme/assets/restai_stateful.png\" width=\"750\" alt=\"RESTai Stateful Architecture\"/\u003e\n\u003c/div\u003e\n\n---\n\n## Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `RESTAI_DEFAULT_PASSWORD` | Admin user password | `admin` |\n| `RESTAI_DEV` | Enable dev mode with hot reload | `false` |\n| `POSTGRES_HOST` | Use PostgreSQL instead of SQLite | — |\n| `MYSQL_HOST` | Use MySQL instead of SQLite | — |\n| `MCP_SERVER` | Enable built-in MCP server at `/mcp/sse` | `false` |\n\nLLM credentials (OpenAI, Anthropic, Gemini, Grok, Azure, etc.) live on\neach LLM in `/admin/llms` — encrypted per-LLM in the DB and scoped to\nteams. Image-generator credentials (DALL-E, Imagen) live in\n`/admin/image-generators`. GPU toggle, Redis (chat memory) and the\nvector backends (ChromaDB / PGVector / Weaviate / Pinecone) are\nconfigured in `/admin/settings`. None of these need env vars; GPU is\nauto-detected on first boot.\n\nFull configuration in [`restai/config.py`](restai/config.py).\n\n---\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n```bash\nmake dev        # Run dev server\npytest tests    # Run tests\nmake code       # Format with black\n```\n\n\u003e **Note:** This project started as 100% human-written code. Nowadays, only a small percentage of the codebase is human-developed — the majority is AI-generated.\n\n---\n\n## License\n\nPedro Dias - [@pedromdias](https://twitter.com/pedromdias)\n\nLicensed under the Apache License, Version 2.0. See [LICENSE](http://www.apache.org/licenses/LICENSE-2.0.html) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapocas%2Frestai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapocas%2Frestai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapocas%2Frestai/lists"}