82 lines
3.2 KiB
Markdown
82 lines
3.2 KiB
Markdown
# LiteLLM Cloudron App Package
|
|
|
|
A Cloudron app package for [LiteLLM](https://litellm.ai/) — the open-source AI gateway.
|
|
|
|
## What this provides
|
|
|
|
- LiteLLM proxy with OpenAI-compatible API on port 4000
|
|
- Per-user virtual API keys, usage tracking, rate limiting
|
|
- Model routing to Tinfoil (TEE), OpenRouter (frontier fallback), and Ollama (self-hosted)
|
|
- Cloudron PostgreSQL for keys/teams/spend logs
|
|
- Cloudron Redis for rate limiting/caching
|
|
- Cloudron SSO via OIDC (admin UI protected by Cloudron login)
|
|
- Automatic SSL, backups, sandboxing
|
|
- Master key and salt key auto-generated on first start (persisted in /app/data)
|
|
|
|
## Files
|
|
|
|
- `CloudronManifest.json` — Cloudron app manifest (addons, ports, metadata)
|
|
- `Dockerfile` — wraps LiteLLM's official image for Cloudron's environment
|
|
- `start.sh` — startup script that configures LiteLLM with Cloudron addons
|
|
- `config.yaml` — default LiteLLM config with inference.coop model routing
|
|
|
|
## Building and installing
|
|
|
|
```bash
|
|
# Install Cloudron CLI (on your local machine)
|
|
npm install -g cloudron-cli
|
|
|
|
# Login to your Cloudron
|
|
cloudron login
|
|
|
|
# From this directory:
|
|
cloudron build # builds the Docker image
|
|
cloudron install # installs on your Cloudron
|
|
```
|
|
|
|
## Environment variables
|
|
|
|
Set these in Cloudron's app config (Settings → Environment Variables) after installation:
|
|
|
|
- `TINFOIL_API_KEY` — your Tinfoil API key (get at https://tinfoil.sh/)
|
|
- `OPENROUTER_API_KEY` — your OpenRouter API key (get at https://openrouter.ai/)
|
|
- `OLLAMA_API_BASE` — if running Ollama on a different host (default: http://127.0.0.1:11434)
|
|
|
|
The following are auto-generated and should NOT be set manually:
|
|
- `LITELLM_MASTER_KEY` — generated on first start, stored in /app/data/.master_key
|
|
- `LITELLM_SALT_KEY` — generated on first start, stored in /app/data/.salt_key
|
|
- `DATABASE_URL` — set from Cloudron's PostgreSQL addon
|
|
- `REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD` — set from Cloudron's Redis addon
|
|
|
|
## After installation
|
|
|
|
1. Open `https://gateway.inference.coop/ui` (or whatever subdomain you chose)
|
|
2. Log in with username `admin` and the master key as password
|
|
3. To find the master key: `cloudron exec cat /app/data/.master_key`
|
|
4. Add provider API keys in the Admin UI (or set as env vars above)
|
|
5. Create virtual keys for members
|
|
6. Point Open WebUI / LobeChat at `https://gateway.inference.coop/v1`
|
|
|
|
## Connecting Open WebUI
|
|
|
|
In Open WebUI settings:
|
|
- API Base URL: `https://gateway.inference.coop/v1`
|
|
- API Key: a virtual key created in LiteLLM's Admin UI
|
|
|
|
## Model routing
|
|
|
|
The default config routes:
|
|
- `gpt-oss-120b`, `deepseek-v4-flash`, `gemma4-31b`, `llama3-3-70b` → Tinfoil (TEE)
|
|
- `claude-sonnet`, `gpt-4o` → OpenRouter (frontier fallback)
|
|
- `ollama-qwen` → local Ollama (if installed on same Cloudron)
|
|
- Fallback: if Tinfoil is down, `gpt-oss-120b` falls back to `gpt-4o` via OpenRouter
|
|
|
|
## OIDC / SSO
|
|
|
|
The manifest requests the `postgresql`, `redis`, and `localstorage` addons.
|
|
For full OIDC SSO integration (so the admin UI uses Cloudron login instead of
|
|
master key), add the `"oidc": {}` addon to the manifest and configure LiteLLM's
|
|
SSO hooks per https://docs.litellm.ai/docs/proxy/custom_sso.
|
|
|
|
This is a TODO for the next version — the current package uses LiteLLM's
|
|
built-in admin/master-key auth, which is sufficient for the MVP. |