aido-litellm/README.md
2026-09-30 23:24:43 +02:00

78 lines
No EOL
2.2 KiB
Markdown

# aido-litellm
Standalone LiteLLM proxy stack for the AIDO / Onyx ecosystem.
## Architecture
- `proxy` — LiteLLM main-stable image, config-mounted read-only.
- `db` — Postgres 16 Alpine for spend logs, user keys and model config persistence.
- `redis` — LRU-bounded Redis for router caching and cooldown state.
Cross-stack connectivity is provided by the external Docker network `aido-llm`.
AIDO's `api_server` and `background` services attach to the same network so
Onyx can reach the proxy internally at `http://litellm-proxy:4000`.
## Prerequisites
- Docker Engine >= 24.x with Compose v2
- Traefik (or another reverse proxy) on the `web` network if you intend to use
the FQDN labels
- The `aido-llm` Docker network must exist before the first start:
```bash
make setup-network
```
## Quick start
```bash
# 1. Prepare environment
cp .env.example .env
# Edit .env: set LITELLM_FQDN, INFOMANIAK_API_KEY, and generate secrets.
# 2. Start the stack
make up
# 3. Verify health
curl http://localhost:4000/health/liveliness
```
## Onyx integration
In the AIDO / Onyx admin panel, add an OpenAI-compatible provider pointing to:
Base URL:http://litellm-proxy:4000 API Key:>any value> # LiteLLM master key or a generated virtual key
```
Because both stacks share the `aido-llm` network, the hostname `litellm-proxy`
resolves from every AIDO backend container.
## Operations
| Command | Purpose |
|---------|---------|
| `make up` | Start proxy, db and redis |
| `make down` | Stop and remove containers |
| `make restart` | Recreate the proxy container (config reload) |
| `make logs` | Follow proxy logs |
| `make ps` | Show stack status |
## Data persistence
Postgres and Redis data are stored in named Compose volumes:
- `litellm_postgres_data`
- `litellm_redis_data`
Back up Postgres before major changes:
```bash
docker exec -it litellm-db pg_dump -U llmproxy litellm > litellm-backup.sql
```
## Security notes
- The proxy container does not run as root.
- Config is mounted read-only (`:ro`).
- Redis has no exposed ports; it is reachable only inside `litellm-network`.
- Postgres has no exposed ports; it is reachable only inside `litellm-network`
and from the proxy service.