安全公告 — 恶意 litellm 版本 1.82.7 与 1.82.8 已从 PyPI 移除(存在 API 密钥外泄风险)。请卸载、轮换已暴露凭据,并升级至安全版本(如 1.82.9+)。运行 pip show litellm 以确认。 PyPI · README

Gateway Plugin Runtime

request → auth → policy → wasm hooks → channel relay → wasm stream/response hooks → audit

Gateway Plugin Runtime

架构

1request → auth → policy → wasm hooks → channel relay → wasm stream/response hooks → audit

internal/wasmhost/ 负责:

  • manifest 发现与加载(loader.go
  • 内置插件(builtin.gowasm.binary: builtin:*
  • wazero 外部 wasm 占位(runtime.go + WazeroPlugin
  • fsnotify 热加载(manager.go

ABI 子集

Hook说明
OnRequestHeaders请求头阶段
OnRequestBody请求体(含 WAF)
OnResponseBody非流式响应改写
OnStreamChunkSSE chunk 改写

返回 ActionContinue / ActionStop;Stop 时网关直接回写 StopBody

Manifest

yaml
1runtime: wasm
2enabled: true
3priority: 100
4scope:
5 tenant_ids: ["*"]
6 routes: ["/v1/*"]
7wasm:
8 binary: builtin:keyword-rewrite
9 host_capabilities: [audit_log, metrics_inc]
10config:
11 replacements:
12 secret-keyword: "[REDACTED]"

运维 API(internal)

  • GET /internal/plugins
  • POST /internal/plugins/reload
  • POST /internal/plugins/upload
  • GET /internal/errors — 24h 错误指纹聚类
  • POST /internal/channels/{id}/probe — Channel 自检
  • GET /internal/perf — Pyroscope 配置

Made-with: Damon Li