Personal AI Gateway โ Pure Python, zero-dependency AI assistant with multi-model routing, web UI, and 67 built-in tools
Project description
What is SalmAlm?
SalmAlm is a self-hosted personal AI gateway โ one Python package that gives you a full-featured AI assistant with web UI, Telegram/Discord bots, 62 tools, memory system, sub-agents, and multi-provider model routing.
No Docker. No Node.js. No config files. Just:
pip install salmalm
python3 -m salmalm
# โ http://localhost:18800
First launch opens a Setup Wizard โ paste an API key, pick a model, done.
Why SalmAlm?
| Feature | SalmAlm | ChatGPT | OpenClaw | Open WebUI |
|---|---|---|---|---|
| Install | pip install |
N/A | npm + config | Docker |
| Multi-provider routing | โ 3-tier auto | โ | โ | โ |
| Memory (2-layer + auto-recall) | โ | โ | โ | โ |
| Sub-agents (spawn/steer) | โ | โ | โ | โ |
| Extended Thinking (4 levels) | โ | โ | โ | โ |
| Encrypted Vault (AES-256-GCM) | โ | N/A | โ | โ |
| Telegram + Discord bots | โ | โ | โ | โ |
| Local LLM (Ollama) | โ | โ | โ | โ |
| Zero external deps* | โ | N/A | โ | โ |
| Cost optimization | โ 83% savings | โ | โ | โ |
| Self-hosted | โ | โ | โ | โ |
*stdlib-only core; optional cryptography for vault encryption
โก Quick Start
# Install
pip install salmalm
# Run
python3 -m salmalm --open
# โ Browser opens http://localhost:18800
# Setup Wizard appears โ paste API key โ done!
Supported Providers
| Provider | Models | Tier |
|---|---|---|
| Anthropic | Claude Opus 4.6, Sonnet 4.6, Haiku 4.5 | Complex / Moderate / Simple |
| OpenAI | GPT-5.2, GPT-5.1, o3 | Complex / Moderate |
| Gemini 3 Pro, 3 Flash | Moderate / Simple | |
| xAI | Grok-4, Grok-3-mini | Complex / Simple |
| Local | Ollama / LM Studio / vLLM | Auto-detected |
๐ง Architecture
Browser โโSSE/WSโโโบ SalmAlm โโโบ Anthropic / OpenAI / Google / xAI / Ollama
Telegram โโโบ โโโ 3-Tier Model Router (simple/moderate/complex)
Discord โโโบ โโโ Engine Pipeline (classify โ route โ context โ execute)
โโโ Memory (MEMORY.md + daily logs + auto-recall + RAG)
โโโ Sub-Agent Manager (spawn/steer/kill/notify)
โโโ 62 Tools (risk-tiered, dynamic loading)
โโโ Vault (PBKDF2-200K + AES-256-GCM)
โโโ Cron / Backup / Self-Diagnostics
๐ฏ Features
AI Engine
- 3-tier auto-routing โ simpleโHaiku, moderateโSonnet, complexโOpus/GPT-5 (cost-optimized)
- Extended Thinking โ 4 levels (low/medium/high/xhigh) with budget control
- 5-stage context compaction โ keeps conversations going without losing context
- Prompt caching โ Anthropic cache_control for cost reduction
- Model failover โ automatic retry across providers
- Tier momentum โ prevents model downgrade mid-complex-task
Memory System
- 2-layer โ
MEMORY.md(curated long-term) +memory/YYYY-MM-DD.md(daily logs) - Auto-recall โ searches memory before each response, injects relevant context
- Auto-curation โ promotes important daily entries to long-term memory
- TF-IDF RAG โ cosine similarity search across all files
Sub-Agents
- Spawn background AI workers with independent sessions
- Thinking level per agent, labels, mid-task steering
- Auto-notify on completion (WebSocket + Telegram)
62 Built-in Tools
Shell exec, file I/O, web search (Brave), web fetch, Python eval (opt-in), image gen (DALL-E), TTS/STT, browser automation (Playwright), RAG search, cron jobs, system monitor, and more.
Web UI
- SSE streaming with real-time thinking display
- Multi-file upload (drag-drop, paste, clip button)
- Session management (branch, rollback, search)
- Command palette (
Ctrl+Shift+P), dark/light themes, EN/KR i18n - Settings: Engine, Routing, Channels, Memory, Cron, Backup
- PWA installable
Channels
- Web โ SPA at
localhost:18800 - Telegram โ polling + webhook with inline buttons
- Discord โ bot with thread support
๐ฐ Cost Optimization
| Technique | Effect |
|---|---|
| 3-tier auto-routing | Simpleโ$1/M, Complexโ$3/M |
| Dynamic tool loading | 62 โ 0-12 tools per request |
| Tool schema compression | 91% token reduction |
| Intent-based max_tokens | Chat 512, code 4096 |
| Response caching | Same question cached 30min-24h |
$7/day โ $1.2/day at 100 calls/day (83% savings)
๐ Security
All dangerous features default OFF:
| Feature | Default | Opt-in |
|---|---|---|
| Network bind | 127.0.0.1 |
SALMALM_BIND=0.0.0.0 |
| Shell operators | Blocked | SALMALM_ALLOW_SHELL=1 |
| Python eval | Disabled | SALMALM_PYTHON_EVAL=1 |
Plus: SSRF defense, CSRF protection, CSP, audit logging, memory scrubbing, path validation, 150+ security tests.
See SECURITY.md for details.
๐ฆ Local LLM
# Ollama
ollama serve
# โ Settings โ Local LLM โ http://localhost:11434/v1 โ models auto-discovered
Also supports LM Studio (localhost:1234/v1) and vLLM (localhost:8000/v1).
๐ Codebase
| Metric | Value |
|---|---|
| Python files | 192 |
| Lines of code | ~52,760 |
| Tools | 62 |
| Tests | 1,879 passing |
| Max cyclomatic complexity | โค20 (all but 1 function) |
| Files > 800 lines | 0 |
๐ค Contributing
git clone https://github.com/hyunjun6928-netizen/salmalm.git
cd salmalm
pip install -e ".[dev]"
python -m pytest tests/ -q --timeout=30 -x \
--ignore=tests/test_multi_tenant.py \
--ignore=tests/test_fresh_install_e2e.py
๐ License
SalmAlm = ์ถ(Life) + ์(Knowledge)
Your life, understood by AI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file salmalm-0.21.2.tar.gz.
File metadata
- Download URL: salmalm-0.21.2.tar.gz
- Upload date:
- Size: 799.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77b33c82c502984f37074dbbcbbe3b9b8bfa2ef60e638b12977ded042912661b
|
|
| MD5 |
32c1b0166edc48ee05d25ca622737dd2
|
|
| BLAKE2b-256 |
34d2d24697ce52dd71b179e750bc3649f16f5da5f0afbea8c7c82093ae78f413
|
File details
Details for the file salmalm-0.21.2-py3-none-any.whl.
File metadata
- Download URL: salmalm-0.21.2-py3-none-any.whl
- Upload date:
- Size: 781.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66c658d92b776dbc400459a5843b731aed992b8b741c1b5de12f84d29a14c446
|
|
| MD5 |
87b99798ca01c1b2bdce63c1570cbc03
|
|
| BLAKE2b-256 |
579f941d8984645d46676a4e0d1bfb3347365dbe37e5e774c953bc21861a5749
|