initial commit
This commit is contained in:
parent
7708a836f2
commit
0fe508c120
5 changed files with 415 additions and 1 deletions
18
.env.example
Normal file
18
.env.example
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# =============================================================================
|
||||
# LiteLLM Proxy Environment
|
||||
# =============================================================================
|
||||
|
||||
# External FQDN served by Traefik (e.g., litellm.aido.livtec.cloud)
|
||||
LITELLM_FQDN=litellm.localhost
|
||||
|
||||
# Infomaniak AI API endpoint and key
|
||||
INFOMANIAK_BASE=https://api.infomaniak.com/2/ai/XYZ/openai/v1
|
||||
INFOMANIAK_API_KEY=CHANGEME
|
||||
|
||||
# LiteLLM master key (generate: openssl rand -hex 32, prefix with sk-)
|
||||
LITELLM_MASTER_KEY=sk-CHANGEME
|
||||
# LiteLLM salt key for encryption (generate: openssl rand -hex 32)
|
||||
LITELLM_SALT_KEY=CHANGEME
|
||||
|
||||
# Internal database password (generate: openssl rand -hex 16)
|
||||
LITELLM_POSTGRES_PASSWORD=CHANGEME
|
||||
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Local secrets
|
||||
.env
|
||||
|
||||
# Runtime data (legacy bind mounts or local dirs)
|
||||
litellm_postgres_data/
|
||||
litellm_redis_data/
|
||||
|
||||
# OS / editor noise
|
||||
.DS_Store
|
||||
*.log
|
||||
37
README.md
37
README.md
|
|
@ -40,4 +40,39 @@ curl http://localhost:4000/health/liveliness
|
|||
|
||||
## Onyx integration
|
||||
|
||||
In the AIDO / Onyx admin panel, add an OpenAI-compatible provider pointing to:
|
||||
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.
|
||||
119
compose.yml
Normal file
119
compose.yml
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
name: litellm
|
||||
services:
|
||||
proxy:
|
||||
image: docker.litellm.ai/berriai/litellm:main-stable
|
||||
container_name: litellm-proxy
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./litellm-config.yaml:/app/config.yaml:ro
|
||||
command: >
|
||||
--config /app/config.yaml
|
||||
--port 4000
|
||||
--num_workers 2
|
||||
--max_requests_before_restart 10000
|
||||
--max_requests_before_restart_jitter 1000
|
||||
--run_gunicorn
|
||||
networks:
|
||||
- litellm-network
|
||||
- aido-llm
|
||||
expose:
|
||||
- 4000
|
||||
environment:
|
||||
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY}
|
||||
- LITELLM_SALT_KEY=${LITELLM_SALT_KEY}
|
||||
- DATABASE_URL=postgresql://llmproxy:${LITELLM_POSTGRES_PASSWORD}@litellm-db:5432/litellm
|
||||
- REDIS_HOST=litellm-redis
|
||||
- REDIS_PORT=6379
|
||||
- LITELLM_MODE=PRODUCTION
|
||||
- LITELLM_LOG=ERROR
|
||||
- NUM_WORKERS=2
|
||||
- MAX_REQUESTS_BEFORE_RESTART=10000
|
||||
- MAX_REQUESTS_BEFORE_RESTART_JITTER=1000
|
||||
- GUNICORN_TIMEOUT=120
|
||||
- UVICORN_TIMEOUT=120
|
||||
- INFOMANIAK_BASE=${INFOMANIAK_BASE}
|
||||
- INFOMANIAK_API_KEY=${INFOMANIAK_API_KEY}
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:4000/health/liveliness')"
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 120s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 4G
|
||||
reservations:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
memswap_limit: 4G
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.litellm.rule=Host(`${LITELLM_FQDN}`)
|
||||
- traefik.http.routers.litellm.entrypoints=web,websecure
|
||||
- traefik.http.routers.litellm.service=litellm
|
||||
- traefik.http.services.litellm.loadbalancer.server.port=4000
|
||||
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
container_name: litellm-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: litellm
|
||||
POSTGRES_USER: llmproxy
|
||||
POSTGRES_PASSWORD: ${LITELLM_POSTGRES_PASSWORD}
|
||||
command: -c 'max_connections=200'
|
||||
networks:
|
||||
- litellm-network
|
||||
volumes:
|
||||
- litellm_postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- pg_isready -d litellm -U llmproxy
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: litellm-redis
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- litellm-network
|
||||
volumes:
|
||||
- litellm_redis_data:/data
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- redis-cli
|
||||
- ping
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
command: >
|
||||
redis-server
|
||||
--appendonly yes
|
||||
--maxmemory 256mb
|
||||
--maxmemory-policy allkeys-lru
|
||||
|
||||
volumes:
|
||||
litellm_postgres_data:
|
||||
litellm_redis_data:
|
||||
|
||||
networks:
|
||||
litellm-network:
|
||||
driver: bridge
|
||||
aido-llm:
|
||||
name: aido-llm
|
||||
external: true
|
||||
232
litellm-config.yaml
Normal file
232
litellm-config.yaml
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
general_settings:
|
||||
master_key: os.environ/LITELLM_MASTER_KEY
|
||||
database_url: os.environ/DATABASE_URL
|
||||
store_model_in_db: true
|
||||
store_prompts_in_spend_logs: false
|
||||
use_redis_transaction_buffer: false
|
||||
user_api_key_cache_ttl: 300
|
||||
enable_redis_auth_cache: false
|
||||
allow_requests_on_db_unavailable: true
|
||||
json_logs: true
|
||||
health_check_interval: 60
|
||||
health_check_timeout: 10
|
||||
|
||||
litellm_settings:
|
||||
drop_params: false
|
||||
set_verbose: false
|
||||
request_timeout: 600
|
||||
num_retries: 2
|
||||
cache: false
|
||||
redact_user_api_key_info: true
|
||||
turn_off_message_logging: true
|
||||
|
||||
model_list:
|
||||
- model_name: LivQwenMax
|
||||
litellm_params:
|
||||
model: Qwen/Qwen3.5-397B-A17B-FP8
|
||||
custom_llm_provider: openai
|
||||
api_base: os.environ/INFOMANIAK_BASE
|
||||
api_key: os.environ/INFOMANIAK_API_KEY
|
||||
rpm: 50
|
||||
tpm: 500000
|
||||
model_info:
|
||||
id: "infomaniak-qwen397-1"
|
||||
base_model: "Qwen/Qwen3.5-397B-A17B-FP8"
|
||||
input_cost_per_token: 0.0000008
|
||||
output_cost_per_token: 0.0000036
|
||||
supports_vision: true
|
||||
supports_reasoning: true
|
||||
supports_function_calling: true
|
||||
supports_parallel_function_calling: true
|
||||
supports_response_schema: true
|
||||
supports_system_messages: true
|
||||
supports_tool_choice: true
|
||||
supports_web_search: false
|
||||
supports_prompt_caching: false
|
||||
supports_embedding: false
|
||||
supports_audio_input: false
|
||||
supports_audio_output: false
|
||||
supports_computer_use: false
|
||||
mode: "chat"
|
||||
model_group: "qwen-family"
|
||||
region: "ch-gva"
|
||||
|
||||
- model_name: LivQwen
|
||||
litellm_params:
|
||||
model: Qwen/Qwen3.5-122B-A10B-FP8
|
||||
custom_llm_provider: openai
|
||||
api_base: os.environ/INFOMANIAK_BASE
|
||||
api_key: os.environ/INFOMANIAK_API_KEY
|
||||
rpm: 50
|
||||
tpm: 500000
|
||||
model_info:
|
||||
id: "infomaniak-qwen122-1"
|
||||
base_model: "Qwen/Qwen3.5-122B-A10B-FP8"
|
||||
input_cost_per_token: 0.0000004
|
||||
output_cost_per_token: 0.0000032
|
||||
supports_vision: true
|
||||
supports_reasoning: true
|
||||
supports_function_calling: true
|
||||
supports_parallel_function_calling: true
|
||||
supports_response_schema: true
|
||||
supports_system_messages: true
|
||||
supports_tool_choice: true
|
||||
supports_web_search: false
|
||||
supports_prompt_caching: false
|
||||
supports_embedding: false
|
||||
supports_audio_input: false
|
||||
supports_audio_output: false
|
||||
supports_computer_use: false
|
||||
mode: "chat"
|
||||
model_group: "qwen-family"
|
||||
region: "ch-gva"
|
||||
|
||||
- model_name: LivKimi
|
||||
litellm_params:
|
||||
model: moonshotai/Kimi-K2.6
|
||||
custom_llm_provider: openai
|
||||
api_base: os.environ/INFOMANIAK_BASE
|
||||
api_key: os.environ/INFOMANIAK_API_KEY
|
||||
rpm: 50
|
||||
tpm: 500000
|
||||
model_info:
|
||||
id: "infomaniak-kimi-1"
|
||||
base_model: "moonshotai/Kimi-K2.6"
|
||||
input_cost_per_token: 0.0000006
|
||||
output_cost_per_token: 0.000003
|
||||
supports_vision: true
|
||||
supports_reasoning: true
|
||||
supports_function_calling: true
|
||||
supports_parallel_function_calling: true
|
||||
supports_response_schema: true
|
||||
supports_system_messages: true
|
||||
supports_tool_choice: true
|
||||
supports_web_search: false
|
||||
supports_prompt_caching: false
|
||||
supports_embedding: false
|
||||
supports_audio_input: false
|
||||
supports_audio_output: false
|
||||
supports_computer_use: false
|
||||
mode: "chat"
|
||||
model_group: "kimi-family"
|
||||
region: "ch-gva"
|
||||
|
||||
- model_name: LivMinistral
|
||||
litellm_params:
|
||||
model: mistralai/Ministral-3-14B-Instruct-2512
|
||||
custom_llm_provider: openai
|
||||
api_base: os.environ/INFOMANIAK_BASE
|
||||
api_key: os.environ/INFOMANIAK_API_KEY
|
||||
rpm: 50
|
||||
tpm: 500000
|
||||
model_info:
|
||||
id: "infomaniak-ministral-3-14b-1"
|
||||
base_model: "mistralai/Ministral-3-14B-Instruct-2512"
|
||||
input_cost_per_token: 0.0000003
|
||||
output_cost_per_token: 0.0000004
|
||||
supports_vision: true
|
||||
supports_reasoning: false
|
||||
supports_function_calling: true
|
||||
supports_parallel_function_calling: true
|
||||
supports_response_schema: true
|
||||
supports_system_messages: true
|
||||
supports_tool_choice: true
|
||||
supports_web_search: false
|
||||
supports_prompt_caching: false
|
||||
supports_embedding: false
|
||||
supports_audio_input: false
|
||||
supports_audio_output: false
|
||||
supports_computer_use: false
|
||||
mode: "chat"
|
||||
model_group: "mistral-family"
|
||||
region: "ch-gva"
|
||||
|
||||
- model_name: LivNemotron
|
||||
litellm_params:
|
||||
model: nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8
|
||||
custom_llm_provider: openai
|
||||
api_base: os.environ/INFOMANIAK_BASE
|
||||
api_key: os.environ/INFOMANIAK_API_KEY
|
||||
rpm: 50
|
||||
tpm: 500000
|
||||
model_info:
|
||||
id: "infomaniak-nemotron-nano-1"
|
||||
base_model: "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8"
|
||||
input_cost_per_token: 0.00000005
|
||||
output_cost_per_token: 0.0000002
|
||||
supports_vision: false
|
||||
supports_reasoning: false
|
||||
supports_function_calling: true
|
||||
supports_parallel_function_calling: false
|
||||
supports_response_schema: true
|
||||
supports_system_messages: true
|
||||
supports_tool_choice: true
|
||||
supports_web_search: false
|
||||
supports_prompt_caching: false
|
||||
supports_embedding: false
|
||||
supports_audio_input: false
|
||||
supports_audio_output: false
|
||||
supports_computer_use: false
|
||||
mode: "chat"
|
||||
model_group: "nemotron-family"
|
||||
region: "ch-gva"
|
||||
|
||||
- model_name: LivQwenEmbed
|
||||
litellm_params:
|
||||
model: Qwen/Qwen3-Embedding-8B
|
||||
custom_llm_provider: openai
|
||||
api_base: os.environ/INFOMANIAK_BASE
|
||||
api_key: os.environ/INFOMANIAK_API_KEY
|
||||
rpm: 50
|
||||
tpm: 500000
|
||||
model_info:
|
||||
id: "infomaniak-qwen-embed-1"
|
||||
base_model: "Qwen/Qwen3-Embedding-8B"
|
||||
input_cost_per_token: 0.00000007
|
||||
supports_vision: false
|
||||
supports_reasoning: false
|
||||
supports_function_calling: false
|
||||
supports_parallel_function_calling: false
|
||||
supports_response_schema: false
|
||||
supports_system_messages: false
|
||||
supports_tool_choice: false
|
||||
supports_web_search: false
|
||||
supports_prompt_caching: false
|
||||
supports_embedding: true
|
||||
supports_audio_input: false
|
||||
supports_audio_output: false
|
||||
supports_computer_use: false
|
||||
mode: "embedding"
|
||||
model_group: "qwen-family"
|
||||
region: "ch-gva"
|
||||
|
||||
router_settings:
|
||||
redis_host: litellm-redis
|
||||
redis_port: 6379
|
||||
routing_strategy: simple-shuffle
|
||||
retry_after: 5
|
||||
allowed_fails: 3
|
||||
cooldown_time: 30
|
||||
client_ttl: 3600
|
||||
enable_pre_call_checks: true
|
||||
|
||||
retry_policy:
|
||||
RateLimitErrorRetries: 2
|
||||
TimeoutErrorRetries: 3
|
||||
AuthenticationErrorRetries: 0
|
||||
BadRequestErrorRetries: 1
|
||||
InternalServerErrorRetries: 4
|
||||
ContentPolicyViolationErrorRetries: 1
|
||||
|
||||
allowed_fails_policy:
|
||||
BadRequestErrorAllowedFails: 3
|
||||
AuthenticationErrorAllowedFails: 1
|
||||
TimeoutErrorAllowedFails: 5
|
||||
RateLimitErrorAllowedFails: 3
|
||||
InternalServerErrorAllowedFails: 5
|
||||
ContentPolicyViolationErrorAllowedFails: 1
|
||||
|
||||
fallbacks:
|
||||
- LivQwenMax: [LivQwen, LivKimi]
|
||||
- LivQwen: [LivQwenMax, LivKimi]
|
||||
- LivKimi: [LivQwen, LivQwenMax]
|
||||
Loading…
Add table
Reference in a new issue