Files
llm-router/deploy/install-service.sh
T
Joseph CostaandClaude Opus 4.8 9938d46a67 Initial commit: llm-router — smart OpenAI/Anthropic/Ollama router
A stdlib pre-router in front of Ollama with LiteLLM backend:
- auto model selection by content/tools/modality, with fallbacks
- OpenAI /v1, Anthropic /v1/messages, and Ollama-native /api/* endpoints
- Whisper-shaped /v1/audio/transcriptions + in-chat audio
- key-based fleet policies (e.g. force a client onto uncensored models)
- optional Bearer auth; launchd/systemd service install
- benchmark harnesses (speed, quality, agentic tool use) with sample results

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 02:05:16 -05:00

35 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install llm-router as a boot service: launchd on macOS, systemd (user) on Linux.
# Run from the repo root: ./deploy/install-service.sh
set -euo pipefail
cd "$(dirname "$0")/.."
INSTALL_DIR="$(pwd)"
PATH_VAL="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
fill() { sed -e "s|__INSTALL_DIR__|$INSTALL_DIR|g" -e "s|__PATH__|$PATH_VAL|g" "$1"; }
case "$(uname -s)" in
Darwin)
PLIST="$HOME/Library/LaunchAgents/com.llm-router.plist"
fill deploy/com.llm-router.plist.template > "$PLIST"
launchctl bootout "gui/$(id -u)/com.llm-router" 2>/dev/null || true
launchctl bootstrap "gui/$(id -u)" "$PLIST"
echo ">> installed launchd agent: $PLIST"
echo " status: launchctl print gui/$(id -u)/com.llm-router | grep state"
echo " logs: tail -f $INSTALL_DIR/launchd.out.log"
echo " remove: launchctl bootout gui/$(id -u)/com.llm-router && rm $PLIST"
;;
Linux)
UNIT_DIR="$HOME/.config/systemd/user"; mkdir -p "$UNIT_DIR"
fill deploy/llm-router.service.template > "$UNIT_DIR/llm-router.service"
systemctl --user daemon-reload
systemctl --user enable --now llm-router.service
echo ">> installed systemd user service"
echo " status: systemctl --user status llm-router"
echo " logs: journalctl --user -u llm-router -f"
echo " remove: systemctl --user disable --now llm-router && rm $UNIT_DIR/llm-router.service"
echo " (tip: 'loginctl enable-linger $USER' to run without being logged in)"
;;
*) echo "Unsupported OS: $(uname -s). Run ./run.sh manually or add your own unit."; exit 1 ;;
esac