HUB
Sign inSign up

varad177/slir-app

By varad177

•Updated 39 minutes ago

Self-hosted AI gateway & runtime LLM switcher for Ollama, OpenAI, and Anthropic.

Image
Developer tools
0

174

varad177/slir-app repository overview

SLIR — Switch LLM In Runtime

⁠SLIR — Switch LLM In Runtime

One API. Any LLM. No Restart.

SLIR is a self-hosted AI gateway, runtime model switcher, latency X-ray profiler, and observability dashboard bundled in a single container.

Point your app once to http://localhost:4101/v1 with model: "active-model", switch between local models (Ollama, LM Studio, vLLM) and cloud APIs (OpenAI, Anthropic, Groq, DeepSeek) from the browser without restarting your code, and inspect latency breakdown, token costs, and failover attempt logs.


⁠Supported Tags

  • latest — Latest stable unified container
  • v1.0.0 — Release v1.0.0

⁠Quick Start

docker run -d --name slir \
  -p 4100:4101 -p 4101:4101 \
  --add-host=host.docker.internal:host-gateway \
  -e OLLAMA_URL=http://host.docker.internal:11434 \
  -v slir_data:/app/data \
  varad177/slir-app:latest
  • Dashboard UI: http://localhost:4100
  • AI Gateway: http://localhost:4101/v1 (OpenAI) or http://localhost:4101/v1/messages (Anthropic)
⁠Docker Compose
services:
  app:
    image: varad177/slir-app:latest
    container_name: ai_monitor_app
    restart: unless-stopped
    ports:
      - "4100:4101"
      - "4101:4101"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      - OLLAMA_URL=http://host.docker.internal:11434
      - DATABASE_PATH=/app/data/monitor.db
    volumes:
      - ai_monitor_sqlite_data:/app/data

volumes:
  ai_monitor_sqlite_data:

⁠Key Features

  • 1-Click Runtime Model Switching: Keep code on model: "active-model" or pin models per app (mp_live_ keys). Changes apply immediately on the next request.
  • OpenAI & Anthropic Support: Exposes POST /v1/chat/completions and native POST /v1/messages (x-api-key) with streaming SSE, tool calling, vision, cache_control, and json_schema.
  • Latency X-Ray Profiler: Separates Model Load (VRAM), Prompt Eval (TTFT), and Generation speed (tok/s), with live num_ctx and temperature defaults.
  • Automatic Per-App Failover Logs: Ordered fallback chains (up to 5 models) recover from 429, 5xx, timeouts, or network errors and record step-by-step error traces.
  • Budgets & Alerts: Custom-model and versioned pricing rules, hard 429 budget blocks, and Slack/Discord webhooks.
  • Privacy-First SQLite (WAL): Runs offline with zero prompt retention—only anonymous telemetry is stored.

⁠Endpoints & Environment Variables

EndpointPurpose
POST /v1/chat/completionsOpenAI Chat Completions gateway
POST /v1/messagesNative Anthropic Messages API gateway
GET /v1/modelsLocal Ollama + registered cloud models
GET /api/healthLiveness check (?deep=1 checks Ollama)
GET /api/metricsPrometheus metrics endpoint
VariableDefaultDescription
PORT4101Internal listener for UI, API, and gateway
OLLAMA_URLhttp://host.docker.internal:11434Local Ollama endpoint(s)
DATABASE_PATH/app/data/monitor.dbSQLite WAL database path
RETENTION_DAYS0Retention window in days (0 = keep forever)
SLIR_PUBLIC_BASE_URL(auto)Fixed base URL behind reverse proxies

Tag summary

Content type

Image

Digest

sha256:f38677abb…

Size

81.3 MB

Last updated

7 days ago

docker pull varad177/slir-app