agentleFS
zad111ak-aizad111ak-ai/hermes-agent-skills/skills/productivity/self-hosted-ai/SKILL.md

self-hosted-ai

Skill7 starsChanged 4 months agoMITView on GitHub

Запуск AI локально: Ollama, Llama 3, подключение к Telegram-ботам, n8n. Полный гайд от установки до продакшна.

  • Pipes a download into a shell

The file

Files
SKILL.md

Self-Hosted AI — Локальный AI

Активировать: когда нужно запустить AI без облака и платных API.

Цель: Иметь своего AI-агента, который работает 24/7 на твоём компьютере.


Зачем

Из РФ заблокированы OpenAI, Anthropic, Google. Даже через прокси — дорого и ненадёжно. Локальный AI:

  • Бесплатен
  • Не зависит от блокировок
  • Работает офлайн
  • Данные не уходят на серверы

Установка Ollama

Windows

  1. Скачай с ollama.com
  2. Установи
  3. Запусти

Linux (WSL2)

curl -fsSL https://ollama.com/install.sh | sh

Проверка

ollama --version
ollama list

Модели

Какую модель выбрать

МодельРазмерОЗУКачествоСкорость
Llama 3.1 8B4.7 GB8 GBСреднееБыстро
Llama 3.1 70B40 GB48 GBВысокоеМедленно
Mistral 7B4 GB8 GBСреднееБыстро
DeepSeek V316 GB24 GBВысокоеСредне

Для начинающих: Llama 3.1 8B — баланс качество/скорость.

Скачивание

ollama pull llama3.1:8b
ollama pull mistral:7b

Запуск

# Интерактивный режим
ollama run llama3.1:8b

# API (для ботов)
ollama serve
# Доступен на http://localhost:11434

Подключение к Telegram-боту

Через aiogram 3

import httpx
from aiogram import Bot, Router, F
from aiogram.types import Message

bot = Bot(token="YOUR_TOKEN")
router = Router()

async def ask_ollama(prompt: str) -> str:
    async with httpx.AsyncClient() as client:
        response = await client.post(
            "http://localhost:11434/api/generate",
            json={
                "model": "llama3.1:8b",
                "prompt": prompt,
                "stream": False
            }
        )
        return response.json()["response"]

@router.message(F.text)
async def handle(message: Message):
    answer = await ask_ollama(message.text)
    await message.answer(answer)

Подключение к Hermes Agent

Конфигурация

# ~/.hermes/config.yaml
model:
  default: ollama/llama3.1:8b
  provider: ollama
  base_url: http://localhost:11434/v1

Запуск

hermes chat

Docker Compose (продакшн)

version: "3.8"
services:
  ollama:
    image: ollama/ollama
    ports:
      - "11434:11434"
    volumes:
      - ollama_data:/root/.ollama
    restart: unless-stopped
  
  n8n:
    image: n8nio/n8n
    ports:
      - "5678:5678"
    environment:
      - OLLAMA_API=http://ollama:11434
    restart: unless-stopped

volumes:
  ollama_data:
docker-compose up -d

Автоматизация (n8n)

n8n — визуальный конструктор автоматизаций. Работает с Ollama.

Установка

docker run -d --name n8n -p 5678:5678 n8nio/n8n

Пример workflow

  1. Telegram Trigger → получено сообщение
  2. HTTP Request → Ollama API
  3. Telegram Send → ответ пользователю

Правила

  1. ВСЕГДА используй stream: False для API-вызовов
  2. ВСЕГДА проверяй доступную ОЗУ перед скачиванием модели
  3. НИКОГДА не запускай больше одной модели одновременно (без GPU)
  4. НИКОГДА не используй модели больше 8B без GPU
  5. Если тормозит — уменьши контекст или используй более мелкую модель

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.