AI Gateway (LiteLLM) lokalt oppsett + collect-docs script

- LiteLLM container i docker-compose.dev.yml med healthcheck
- Config med sidelinja/rutine (Gemini 2.5 Flash Lite) og
  sidelinja/resonering (Gemini 2.5 Flash) — flere leverandører
  legges til når API-nøkler er klare
- collect-docs.sh samler all dokumentasjon til én fil for deling
- Gitignore: server_context.md (generert output)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
vegard 2026-03-13 16:16:59 +01:00
parent 2100184f4e
commit 747244d078
4 changed files with 87 additions and 0 deletions

3
.gitignore vendored
View file

@ -4,6 +4,9 @@
# Scratch (testfiler, notater, midlertidig) # Scratch (testfiler, notater, midlertidig)
.scratch/ .scratch/
# Generert kontekstfil
scripts/server_context.md
# Miljovariabler # Miljovariabler
.env.local .env.local
.env .env

View file

@ -0,0 +1,25 @@
model_list:
# === sidelinja/rutine — billig, høyt volum ===
- model_name: "sidelinja/rutine"
litellm_params:
model: "gemini/gemini-2.5-flash-lite"
api_key: "os.environ/GEMINI_API_KEY"
- model_name: "sidelinja/rutine"
litellm_params:
model: "gemini/gemini-2.5-flash"
api_key: "os.environ/GEMINI_API_KEY"
# === sidelinja/resonering — presis, lav volum ===
# 2.5 Flash brukes til resonering inntil vi legger til Anthropic/OpenRouter
- model_name: "sidelinja/resonering"
litellm_params:
model: "gemini/gemini-2.5-flash"
api_key: "os.environ/GEMINI_API_KEY"
router_settings:
routing_strategy: "simple-shuffle"
num_retries: 2
timeout: 60
general_settings:
master_key: "os.environ/LITELLM_MASTER_KEY"

View file

@ -41,6 +41,27 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
# === AI Gateway ===
ai-gateway:
image: ghcr.io/berriai/litellm:main-stable
restart: unless-stopped
command: --config /etc/litellm/config.yaml
environment:
LITELLM_MASTER_KEY: ${LITELLM_MASTER_KEY}
GEMINI_API_KEY: ${GEMINI_API_KEY}
volumes:
- ./config/litellm/config.yaml:/etc/litellm/config.yaml:ro
ports:
- "127.0.0.1:4000:4000"
networks:
- sidelinja-dev
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:4000/health/liveliness || exit 1"]
interval: 15s
timeout: 5s
retries: 3
# === Whisper: Transkripsjon === # === Whisper: Transkripsjon ===
whisper: whisper:

38
scripts/collect-docs.sh Executable file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Samler all prosjektdokumentasjon til én fil for deling med AI-er etc.
# Bruk: ./collect-docs.sh → skriver scripts/server_context.md
# ./collect-docs.sh - → skriver til stdout (for piping)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
OUT="$SCRIPT_DIR/server_context.md"
files=(
"$ROOT/ARCHITECTURE.md"
"$ROOT/CLAUDE.md"
"$ROOT"/docs/features/*.md
"$ROOT"/migrations/*.sql
)
collect() {
for f in "${files[@]}"; do
[[ -f "$f" ]] || continue
rel="${f#"$ROOT/"}"
echo "================================================================"
echo "FILE: $rel"
echo "================================================================"
echo ""
cat "$f"
echo ""
echo ""
done
}
if [[ "${1:-}" == "-" ]]; then
collect
else
collect > "$OUT"
echo "Wrote $OUT ($(wc -l < "$OUT") lines)"
fi