AI网关LiteLLM那些事儿
近期我们上线了LiteLLM,社区活跃,star最高。主要解决,1简化接入 2计费限流。天有不测风云,上线后被外部脱裤!使用https://www.sysdig.com/blog/cve-2026-42208-targeted-sql-injection-against-litellms-authentication-path-discovered-36-hours-following-vulnerability-disclosure 绕过鉴权,数据库中查看到上游key被拿到,一顿轮转。加白升级版本。
随着使用过程的深入,架构也由单台-多台+数据库-redis,配置也有不少讲究
当前架构
┌───────────┐
│ ALB │
│ (公网入口) │
└─────┬─────┘
╱ ╲
┌────────▼───┐ ┌────▼────────┐
│ gateway01 │ │ gateway02 │
│ 192.168. │ │ 192.168. │
│ 1.126 │ │ 3.108 │
│ Gunicorn │ │ Gunicorn │
│ 4 workers │ │ 4 workers │
└──────┬─────┘ └──────┬──────┘
│ cron 每分钟 │
│ config 同步 │
│ ◄──────────── │
└────────┬───────┘
┌─────▼──────┐
│ Redis 7.0 │
│ 阿里云 │
└─────┬──────┘
┌─────▼──────┐
│ PostgreSQL │
│ 阿里云 RDS │
└────────────┘