Skip to main content

Personal AI Gateway โ€” Pure Python, minimal dependencies

Project description

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

Tests PyPI Python License

Personal AI Gateway โ€” Pure Python

๐Ÿ‡บ๐Ÿ‡ธ English

๊ฐœ์ธ 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 (cryptography for 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, o4
  • XAI_API_KEY โ€” Grok-4, Grok-3
  • GOOGLE_API_KEY โ€” Gemini 3 Pro/Flash
  • BRAVE_API_KEY โ€” Web search
  • TELEGRAM_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

๐Ÿ“ 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

salmalm-0.11.5.tar.gz (162.3 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.11.5-py3-none-any.whl (151.1 kB view details)

Uploaded Python 3

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

Hashes for salmalm-0.11.5.tar.gz
Algorithm Hash digest
SHA256 4d0e3f8f9b1e5077ee56a32d313a79d2b7b0d31ab3a4851388b9567441ec0883
MD5 1d096e5c34b8833fef5e60c6a7d27124
BLAKE2b-256 939792757264b501df4ccf767066559e260e5abe6ec7de314014ed51ecc5d613

See more details on using hashes here.

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

Hashes for salmalm-0.11.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e66da823bf2fe2a3d4a21e0c010edd3bba042c6318c2fad68afcf192a458e86a
MD5 d4c37bf7cf81def2545de24ce8ebb424
BLAKE2b-256 66bcbe4618c47eeda448c89b6db07909d224192909ba8e41baaa9ea5fe4a5f2a

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