Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

939 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SalmAlm β€” Private AI Gateway

Self-hosted, privacy-first AI gateway. Your data never leaves your machine.

PyPI Python License: MIT

Quick Start

pip install salmalm
salmalm start
# Open http://localhost:8000

Features

  • πŸ”’ 100% Local β€” no data sent to third parties
  • πŸ€– Multi-LLM β€” Claude, GPT, Gemini in one interface
  • πŸ“š RAG β€” chat with your own documents
  • πŸ› οΈ 62 built-in tools β€” web search, file ops, code execution
  • πŸ” Vault encryption for sensitive data
  • 🐳 Docker ready

Docker

docker-compose up -d

Requirements

  • Python 3.10+
  • API key for at least one LLM provider

😈 SalmAlm

PyPI Python License: MIT CI Tests

Self-hosted personal AI gateway β€” one pip install, no Docker, no Node.js.

Documentation Β· Korean README Β· Changelog


Features

  • Multi-provider LLM routing β€” OpenAI, Anthropic, Google, xAI, Ollama with 3-tier auto-routing (simple / moderate / complex)
  • Automatic failover + circuit breaker β€” transparent retry across providers; unhealthy endpoints are isolated
  • RAG β€” BM25 + semantic search with Reciprocal Rank Fusion (RRF); indexes your local files automatically
  • Vault encryption β€” AES-256-GCM with PBKDF2-200K key derivation; opt-in per secret
  • OAuth2 β€” Google and Anthropic social login flows
  • WebSocket streaming β€” real-time token streaming to the web UI
  • Multi-user auth β€” JWT-based session management with per-user quotas
  • Cost tracking + daily quotas β€” per-model token accounting with configurable daily spend caps
  • Prometheus metrics β€” /metrics endpoint; drop-in for any Grafana stack
  • SQLite audit log β€” WAL mode; every request, tool call, and auth event is logged
  • 62 built-in tools β€” shell exec, file I/O, web search (Brave), browser automation, TTS/STT, image gen, cron, and more

Quick Start

pip install salmalm
salmalm start
# β†’ http://localhost:18800

A Setup Wizard opens on first launch. Paste an API key, pick a model β€” done.

Recommended: use pipx install salmalm to avoid dependency conflicts.


Configuration

All configuration is via environment variables. No config files required.

Variable Default Description
SALMALM_PORT 18800 HTTP listen port
SALMALM_BIND 127.0.0.1 Bind address (0.0.0.0 for LAN access)
SALMALM_SECRET (none) Master secret for Vault + JWT signing (set this!)
SALMALM_ALLOW_SHELL 0 Enable shell operators in tool exec (1 to opt in)
SALMALM_PYTHON_EVAL 0 Enable Python eval tool (1 to opt in)
SALMALM_DAILY_BUDGET (none) Daily spend cap in USD, e.g. 2.00

API Reference

Method Path Description
POST /api/chat Send a message; returns SSE stream
GET /api/sessions List chat sessions
DELETE /api/sessions/{id} Delete a session
GET /api/tools List available tools and their schemas
GET /api/models List discovered models across all providers
GET /api/costs Cost summary (today / 30-day)
GET /metrics Prometheus metrics endpoint
GET /api/vault List vault entries (values redacted)
POST /api/vault Store an encrypted secret
GET /api/audit Recent audit log entries

Architecture

Client (Browser / Telegram / Discord)
        β”‚
        β–Ό  HTTP + WebSocket
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 SalmAlm                   β”‚
β”‚                                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ 3-Tier      β”‚   β”‚  Engine Pipeline  β”‚  β”‚
β”‚  β”‚ LLM Router  │──▢│  classify β†’ route β”‚  β”‚
β”‚  β”‚ + Failover  β”‚   β”‚  β†’ context β†’ exec β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚         β”‚                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Providers                          β”‚  β”‚
β”‚  β”‚  OpenAI Β· Anthropic Β· Google Β· xAI  β”‚  β”‚
β”‚  β”‚  Ollama Β· LM Studio Β· vLLM          β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                           β”‚
β”‚  RAG (BM25 + Semantic + RRF)              β”‚
β”‚  Vault (AES-256-GCM)                      β”‚
β”‚  JWT Auth Β· OAuth2                        β”‚
β”‚  62 Tools Β· Cron Β· Sub-Agents             β”‚
β”‚  SQLite Audit (WAL) Β· Prometheus /metrics β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Development

git clone https://github.com/hyunjun6928-netizen/salmalm.git
cd salmalm
pip install -e ".[dev]"
pytest tests/ -q --timeout=30 -x \
  --ignore=tests/test_multi_tenant.py \
  --ignore=tests/test_fresh_install_e2e.py

See CONTRIBUTING.md for guidelines.


License

MIT Β© 2024 hyunjun6928-netizen


SalmAlm = μ‚Ά (Life) + μ•Ž (Knowledge)

Your life, understood by AI.


SalmAlm β€” Private AI Gateway

Self-hosted, privacy-first AI gateway. Your data never leaves your machine.

Quick Start

pip install salmalm
salmalm start
# Open http://localhost:8000

Features

  • πŸ”’ 100% local β€” no data sent to third parties
  • πŸ€– Multi-LLM β€” Claude, GPT, Gemini in one place
  • πŸ“š RAG β€” chat with your documents
  • πŸ› οΈ 62 built-in tools
  • πŸ” Vault encryption for sensitive data

Docker

docker-compose up -d

About

🧠 Personal AI Gateway β€” Single-file Python AI agent with multi-LLM, tools, vision, TTS, encrypted vault. Your own ChatGPT on localhost.

Resources

Contributing

Security policy

Stars

26 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages