Skip to main content

Personal AI Gateway โ€” Pure Python, zero-dependency AI assistant with multi-model routing, web UI, and 67 built-in tools

Project description

๐Ÿ˜ˆ SalmAlm (์‚ถ์•Ž)

Your Entire AI Life in One pip install

PyPI Python License: MIT CI Tests Tools

ํ•œ๊ตญ์–ด README ยท Documentation


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
Google 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

MIT


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

salmalm-0.21.2.tar.gz (799.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

salmalm-0.21.2-py3-none-any.whl (781.5 kB view details)

Uploaded Python 3

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

Hashes for salmalm-0.21.2.tar.gz
Algorithm Hash digest
SHA256 77b33c82c502984f37074dbbcbbe3b9b8bfa2ef60e638b12977ded042912661b
MD5 32c1b0166edc48ee05d25ca622737dd2
BLAKE2b-256 34d2d24697ce52dd71b179e750bc3649f16f5da5f0afbea8c7c82093ae78f413

See more details on using hashes here.

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

Hashes for salmalm-0.21.2-py3-none-any.whl
Algorithm Hash digest
SHA256 66c658d92b776dbc400459a5843b731aed992b8b741c1b5de12f84d29a14c446
MD5 87b99798ca01c1b2bdce63c1570cbc03
BLAKE2b-256 579f941d8984645d46676a4e0d1bfb3347365dbe37e5e774c953bc21861a5749

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page