Personal AI Gateway โ Pure Python, minimal dependencies
Project description
๐ ์ถ์ (SalmAlm) v0.11.1
Personal AI Gateway โ Pure Python
๊ฐ์ธ AI ๊ฒ์ดํธ์จ์ด. ์์ Python stdlib ๊ธฐ๋ฐ, ์ธ๋ถ ๋ฐํ์ ์์กด์ฑ ์์ด ๊ตฌ์ถ.
์ํธํ(cryptography)๋ง ์ ํ์ ์์กด์ฑ์ผ๋ก, ์ค์น ์ AES-256-GCM์ ์ฌ์ฉํ๊ณ ์์ผ๋ฉด HMAC-CTR ํด๋ฐฑ.
โจ Features
| Feature | Description |
|---|---|
| ๐ง Intelligence Engine | 7๋จ๊ณ ์๋ ๋ถ๋ฅ โ ์ ์ํ ๋ชจ๋ธ ์ ํ โ ๊ณํ โ ๋ณ๋ ฌ ๋๊ตฌ ์คํ โ ์๊ธฐ ํ๊ฐ |
| ๐ RAG Engine | BM25 ๊ธฐ๋ฐ ๋ก์ปฌ ๊ฒ์, SQLite ์์ํ, ๋ฐ์ด๊ทธ๋จ, ์๋ ๋ฆฌ์ธ๋ฑ์ฑ |
| โก WebSocket | RFC 6455 ์ง์ ๊ตฌํ, ์ค์๊ฐ ์คํธ๋ฆฌ๋ฐ, ๋๊ตฌ ํธ์ถ ์๋ฆผ |
| ๐ MCP | Model Context Protocol ์๋ฒ + ํด๋ผ์ด์ธํธ, Cursor/VS Code ์ฐ๋ |
| ๐ Browser | Chrome DevTools Protocol (CDP), ์คํฌ๋ฆฐ์ท/JS์คํ/ํผ์๋ํ |
| ๐ Gateway-Node | ๋ฉํฐ๋จธ์ ๋๊ตฌ ๋์คํจ์น โ ๊ฒ์ดํธ์จ์ด์์ ์๊ฒฉ ๋ ธ๋๋ก ์๋ ์์ |
| ๐ฅ Stability | Circuit Breaker, 8๊ฐ ์ปดํฌ๋ํธ ํฌ์ค์ฒดํฌ, ์๋ ๋ณต๊ตฌ, ์ ํํ ์คํธ |
| ๐ฌ Telegram | ๋น๋๊ธฐ long-polling, ์ด๋ฏธ์ง/ํ์ผ ์ฒ๋ฆฌ |
| ๐ Web UI | ๋คํฌ/๋ผ์ดํธ ํ ๋ง, ๋งํฌ๋ค์ด ๋ ๋๋ง, ํ์ผ ์ ๋ก๋, SSE ์คํธ๋ฆฌ๋ฐ, EN/KO ์ ํ |
| ๐ Security | AES-256-GCM ๋ณผํธ, JWT ์ธ์ฆ, RBAC, CORS ํ์ดํธ๋ฆฌ์คํธ, ๋ ์ดํธ ๋ฆฌ๋ฐ, PBKDF2 |
| ๐ Cost Tracking | ๋ชจ๋ธ๋ณ ํ ํฐ/๋น์ฉ ์ค์๊ฐ ์ถ์ (27๊ฐ ๋ชจ๋ธ) |
| โฐ Cron | LLM ๊ธฐ๋ฐ ์ค์ผ์ค ์์ , cron ํํ์/์ธํฐ๋ฒ/์์ท ์ง์ |
| ๐ง 30 Tools | exec, ํ์ผ CRUD, ์น ๊ฒ์, RAG, MCP, ๋ธ๋ผ์ฐ์ , ๋ ธ๋, ํฌ์ค์ฒดํฌ ๋ฑ |
| ๐งฉ Plugins | plugins/ ํด๋์ .py ๋๋กญ โ ์๋ ๋๊ตฌ ๋ก๋ฉ |
| ๐ .env ์ง์ | vault ๋์ .env ํ์ผ๋ก API ํค ๊ด๋ฆฌ ๊ฐ๋ฅ (vault ํด๋ฐฑ) |
๐ Stats
- 25 modules / ~10,400 lines of Python
- 30 built-in tools + plugin extensibility
- 27+ LLM models (Anthropic, OpenAI, xAI, Google, DeepSeek, Meta, Ollama)
- 85 unit tests + 21/21 self-test on startup
- 1 optional dependency (
cryptographyfor AES-256-GCM โ graceful fallback without it)
๐๏ธ Architecture
salmalm/
โโโ __init__.py โ logging setup
โโโ __main__.py โ entry point + .env loader
โโโ constants.py โ paths, costs, model registry, thresholds
โโโ crypto.py โ AES-256-GCM vault (+ HMAC-CTR fallback)
โโโ core.py โ audit, cache, router, cron, sessions
โโโ agents.py โ SubAgent, SkillLoader, PluginLoader
โโโ llm.py โ LLM API calls (6 providers + auto-fallback)
โโโ tools.py โ 32 tool definitions
โโโ tool_handlers.py โ tool execution + gateway dispatch
โโโ prompt.py โ system prompt builder
โโโ engine.py โ Intelligence Engine (ClassifyโPlanโExecuteโReflect)
โโโ templates.py โ HTML templates (Web UI)
โโโ telegram.py โ Telegram bot (async long-polling)
โโโ discord_bot.py โ Discord Gateway (raw WebSocket)
โโโ web.py โ Web UI + HTTP API + CORS + CSRF + auth middleware
โโโ ws.py โ WebSocket server (RFC 6455)
โโโ rag.py โ BM25 RAG engine (SQLite-backed)
โโโ mcp.py โ MCP server + client
โโโ browser.py โ Chrome CDP automation
โโโ nodes.py โ Gateway-Node architecture (registry + remote dispatch)
โโโ stability.py โ Health monitor + Circuit Breaker + auto-recovery
โโโ auth.py โ JWT auth, RBAC, rate limiter, PBKDF2
โโโ tls.py โ Self-signed TLS cert generation
โโโ container.py โ lightweight DI container
โโโ logging_ext.py โ JSON structured logging
โโโ docs.py โ Auto-generated API docs
โโโ plugins/ โ Drop-in tool plugins
๐ Quick Start
pip (๊ถ์ฅ)
python -m pip install salmalm && python -m salmalm
์ค์น ์๋ฃ โ ์๋ฒ ์์ โ ๋ธ๋ผ์ฐ์ ์๋ ์คํ โ ๋ฐํํ๋ฉด์ SalmAlm.bat ์์ฑ (๋ค์๋ถํฐ ๋๋ธํด๋ฆญ)
.env ํ์ผ (๊ฐํธ ์ค์ )
cp .env.example .env
# .env ํธ์ง โ API ํค ์
๋ ฅ
python -m salmalm
Docker
docker run -p 18800:18800 -p 18801:18801 \
-e SALMALM_VAULT_PW=changeme \
-v salmalm_data:/app \
$(docker build -q .)
Docker Compose
git clone https://github.com/hyunjun6928-netizen/salmalm.git
cd salmalm
# docker-compose.yml ํธ์ง โ SALMALM_VAULT_PW์ API ํค ์ค์
docker compose up -d
๐ Gateway-Node (๋ฉํฐ๋จธ์ )
# ๋ฉ์ธ ์๋ฒ (๊ฒ์ดํธ์จ์ด)
python -m salmalm
# ์๊ฒฉ ์์ปค (๋
ธ๋)
python -m salmalm --node --gateway-url http://gateway:18800
๋ ธ๋๋ ๊ฒ์ดํธ์จ์ด์ ์๋ ๋ฑ๋ก๋๊ณ , ๋๊ตฌ ํธ์ถ ์ capability ๊ธฐ๋ฐ์ผ๋ก ์๊ฒฉ ๋ ธ๋์ ์๋ ์์๋ฉ๋๋ค. ์คํจ ์ ๋ก์ปฌ ํด๋ฐฑ.
๐ฆ Ollama (๋ก์ปฌ LLM, API ํค ๋ถํ์)
# Ollama ์ค์น ํ
ollama pull llama3.2
python -m salmalm
# ์จ๋ณด๋ฉ์์ Ollama URL ์
๋ ฅ: http://localhost:11434/v1
# /model ollama/llama3.2 ๋ก ์ฌ์ฉ
๐ API Keys
Store in .env file or encrypted vault via Web UI:
ANTHROPIC_API_KEYโ Claude (Opus, Sonnet, Haiku)OPENAI_API_KEYโ GPT-5, o3, o4XAI_API_KEYโ Grok-4, Grok-3GOOGLE_API_KEYโ Gemini 3 Pro/FlashBRAVE_API_KEYโ Web searchTELEGRAM_TOKEN+TELEGRAM_OWNER_IDโ Telegram bot
๐ Security
- CORS: Same-origin whitelist only (127.0.0.1/localhost)
- Auth: JWT tokens (HMAC-SHA256) + API keys + RBAC (admin/user/readonly)
- Vault: AES-256-GCM encrypted key storage (PBKDF2 200K iterations)
- Rate Limiting: Token bucket per user/IP (configurable per role)
- Upload: Filename sanitization, 50MB limit, path traversal prevention
- Exec: Command blocklist + pattern matching + subprocess isolation
- Passwords: PBKDF2-HMAC-SHA256, random default admin password
๐ก API Endpoints
| Endpoint | Auth | Description |
|---|---|---|
GET /api/status |
โ | Version, usage, model |
GET /api/health |
โ | Health check (8 components) |
POST /api/auth/login |
โ | Get JWT token |
POST /api/unlock |
โ | Unlock vault |
POST /api/chat |
โ | Send message |
POST /api/chat/stream |
โ | SSE streaming chat |
POST /api/vault |
๐ | Vault CRUD (admin/loopback) |
GET /api/dashboard |
โ | Sessions, usage, cron |
GET /api/rag/search?q=... |
โ | BM25 search |
GET /api/nodes |
โ | List connected nodes |
GET /docs |
โ | Auto-generated API docs |
ws://127.0.0.1:18801 |
โ | WebSocket real-time |
๐ Documentation
- FAQ (์์ฃผ ๋ฌป๋ ์ง๋ฌธ)
- Use Cases (ํ์ฉ ์ฌ๋ก)
- Contributing
- Changelog
- API Docs (์๋ฒ ์คํ ํ)
๐ v0.11.1 Changelog
- ๐ฌ ๋ฉํฐ์ธ์ UI: ์ฌ์ด๋๋ฐ ๋ํ ๋ชฉ๋ก โ ์์ฑ/์ ํ/์ญ์ , ์๋ ์ ๋ชฉ ์์ฑ
- ๐ ๋์๋ณด๋:
/dashboardโ Chart.js ๋๊ตฌ ์ฌ์ฉ๋ ์ฐจํธ + ๋ชจ๋ธ๋ณ ๋น์ฉ ๋๋ + ํ ์ด๋ธ - ๐ค STT (์์ฑโํ ์คํธ): Whisper API ์ฐ๋ + ๋ง์ดํฌ ๋ฒํผ โ ๋ น์โ๋ณํโ์ ๋ ฅ์ฐฝ ์ฝ์
- ๐ฑ PWA: manifest.json + ์๋น์ค์์ปค + ์ฑ ์์ด์ฝ โ ํฐ์์ ํํ๋ฉด ์ฑ์ผ๋ก ์ค์น
- 32๊ฐ ๋๊ตฌ (stt ์ถ๊ฐ)
v0.11.0
- ๐๏ธ image_analyze ๋น์ ๋๊ตฌ: ์ด๋ฏธ์ง ๋ถ์ (URL/base64/ํ์ผ ๊ฒฝ๋ก)
- ๐ง ํ๋กฌํํธ v0.5.0: ์๋ ๋ถ๋ฅ + ๋๊ตฌ ์ ํ ์ ํ๋ ํฅ์
- ๐ก SSE ์ฒญํฌ ์คํธ๋ฆฌ๋ฐ: ์ค์๊ฐ ์๋ต ์คํธ๋ฆฌ๋ฐ ์ง์
- ๐ CI/CD: GitHub Actions ๋งคํธ๋ฆญ์ค (Ubuntu/macOS/Windows ร Python 3.10-3.13)
- ๐ ๋ฐฐ์ง: PyPI + CI + License + Python ๋ฒ์ ๋ฐฐ์ง
- ๐ CONTRIBUTING + CHANGELOG + FAQ(ํ/์) + use-cases(ํ/์) + issue templates
v0.10.9
- ๐ P0 ๋ณด์ ํจ์น:
/api/do-update,/api/restart์ admin ์ธ์ฆ + loopback ๊ฐ์ - ๐ ์ ๋ณด API ์ธ์ฆ: dashboard/cron/plugins/mcp/rag ์ ๋ถ ์ธ์ฆ ์ ์ฉ
- ๐ ๊ฒฝ๋ก ํ์ ๋ฐฉ์ด:
/uploads/basename ์ ๊ทํ + resolve ์ด์ค ๋ฐฉ์ด - ๐ Setup Wizard: ์ฒซ ์คํ ์ ๋น๋ฐ๋ฒํธ ์ค์ /์คํต ์ ํ ํ๋ฉด
- ๐ ๋น๋ฐ๋ฒํธ ๊ด๋ฆฌ: Settings์์ ๋ณ๊ฒฝ/ํด์ /์ฌ์ค์ ๊ฐ๋ฅ
- โพ๏ธ ๋ฌด์ ํ ๋๊ตฌ ๋ฃจํ: max_tools ์ ํ ์ ๊ฑฐ (OpenClaw ์คํ์ผ)
- ๐ ๋ฌธ์ ๊ฐ๊ฒฉ ์ถ์: docs ํ์ด์ง ๋ง์ง/ํจ๋ฉ 30~40% ์์ถ
- ๐ Unlock ๊ฐ์ด๋: ๋น๋ฐ๋ฒํธ ๋ถ์ค ์ ์๋ด ๋ฌธ๊ตฌ ์ถ๊ฐ
๐ License
MIT
๐ Credits
Built by ์ ๋ชฝ์ ๋์ (Nightmare Dolsoe) ๐ โ an Awakened 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.11.5.tar.gz.
File metadata
- Download URL: salmalm-0.11.5.tar.gz
- Upload date:
- Size: 162.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d0e3f8f9b1e5077ee56a32d313a79d2b7b0d31ab3a4851388b9567441ec0883
|
|
| MD5 |
1d096e5c34b8833fef5e60c6a7d27124
|
|
| BLAKE2b-256 |
939792757264b501df4ccf767066559e260e5abe6ec7de314014ed51ecc5d613
|
File details
Details for the file salmalm-0.11.5-py3-none-any.whl.
File metadata
- Download URL: salmalm-0.11.5-py3-none-any.whl
- Upload date:
- Size: 151.1 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 |
e66da823bf2fe2a3d4a21e0c010edd3bba042c6318c2fad68afcf192a458e86a
|
|
| MD5 |
d4c37bf7cf81def2545de24ce8ebb424
|
|
| BLAKE2b-256 |
66bcbe4618c47eeda448c89b6db07909d224192909ba8e41baaa9ea5fe4a5f2a
|