Skip to content

feat(infra): LiteLLM gateway for task-based model routing + observability (#478, PR1)#490

Open
adi-devv wants to merge 2 commits into
beenuar:mainfrom
adi-devv:feat/litellm-gateway
Open

feat(infra): LiteLLM gateway for task-based model routing + observability (#478, PR1)#490
adi-devv wants to merge 2 commits into
beenuar:mainfrom
adi-devv:feat/litellm-gateway

Conversation

@adi-devv

Copy link
Copy Markdown
Contributor

Addresses #478PR1 of 2 (gateway + observability). Additive and non-breaking.

What this adds

A LiteLLM proxy as the single entry point for live LLM calls. AiSOC requests a logical task alias; the alias → real-model mapping lives entirely in infra/litellm/config.yaml, so operators assign different local or hosted models per task — and swap them — without any AiSOC code change.

Aliases mirror AiSOC's distinct workloads: aisoc-triage, aisoc-recon, aisoc-investigation, aisoc-copilot, aisoc-summary, aisoc-report, aisoc-nl.

Observability: per-task latency, tokens, cost, errors, retries and fallbacks are exported on /metrics and scraped by the bundled Prometheus (new aisoc-litellm job). The third-party image is allowlisted in scripts/audit_prometheus_targets.py so the CI target audit stays green.

Contents

  • infra/litellm/config.yaml — 7 aliases, prometheus callback, unauthenticated /metrics for scraping, env-based keys, commented Ollama/vLLM/Anthropic alternatives
  • docker-compose.ymllitellm service + LLM_GATEWAY_URL on agents/api
  • infra/docker/prometheus.yml + scripts/audit_prometheus_targets.py — scrape job + third-party allowlist
  • .env.example, apps/docs/docs/operations/llm-gateway.md (+ sidebar), CHANGELOG.md
  • services/agents/tests/test_litellm_config.py — 6 config contract tests

Verification

  • Static: 6 new config tests + existing llmops/model_pins tests pass; audit_prometheus_targets.py --check exits 0; compose + config YAML parse.
  • Live (ran the LiteLLM proxy against the config): boots clean, /health/liveliness 200, /v1/models lists all 7 aliases, aisoc-triage routes to the provider, /metrics serves per-alias counters. (Surfaced and fixed a real gap: /metrics needs require_auth_for_metrics_endpoint: false or unauthenticated Prometheus scrapes 401.)

Follow-up

PR2 (feat/litellm-alias-routing) wires the in-code callsites to request these aliases and removes the hardcoded gpt-4o-mini default, closing #478.

🤖 Generated with Claude Code

…lity (beenuar#478)

Adds a LiteLLM proxy as the single entry point for live LLM calls. AiSOC
requests a logical task alias (aisoc-triage / recon / investigation / copilot /
summary / report / nl); the alias -> real-model mapping lives entirely in
infra/litellm/config.yaml, so operators assign local or hosted models per task
and swap them without any AiSOC code change. Per-task latency, tokens, cost,
errors, retries and fallbacks are exported on /metrics and scraped by the
bundled Prometheus (new aisoc-litellm job; the third-party image is allowlisted
in the target audit so CI stays green).

Opt-in and non-breaking: unset OPENAI_BASE_URL keeps calls going direct to the
provider, and the deterministic offline path is unaffected.

PR1 of 2 for beenuar#478 (gateway + observability). A follow-up wires the ~10 in-code
callsites to request these aliases via model_pins and removes the hardcoded
gpt-4o-mini default, which closes beenuar#478.

Contents:
- infra/litellm/config.yaml: 7 task aliases, prometheus callback, env-based
  master key + provider keys, unauthenticated /metrics for scraping, commented
  Ollama/vLLM/Anthropic alternatives
- docker-compose.yml: litellm service + LLM_GATEWAY_URL on agents/api
- infra/docker/prometheus.yml + scripts/audit_prometheus_targets.py: scrape job
  + third-party allowlist
- .env.example, apps/docs/docs/operations/llm-gateway.md (+ sidebar), CHANGELOG
- services/agents/tests/test_litellm_config.py: 6 config contract tests

Live-verified: the proxy boots against the config, all 7 aliases load, alias
routing reaches the provider, and /metrics serves per-alias counters.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@adi-devv
adi-devv requested a review from beenuar as a code owner July 18, 2026 16:32
Fix the I001 import-order the CI ruff check gate flagged; no behavioural change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant