gateway: let member keys reach the Metis pass-through route

LiteLLM gates auth=true pass-through routes behind allowed_passthrough_routes,
a LiteLLM Enterprise field: on this community-edition proxy the management API
refuses to set it, so no member key can ever be granted access, and auth:false
would instead expose the route (and our GreenPT key) to anonymous callers.

Add patch_passthrough_key_access.py (house style: build-time, non-fatal,
idempotent, compile-checked) so routes the operator names in
general_settings.coop_passthrough_open_to_keys are callable by ANY
authenticated key. Authentication itself is unchanged: auth=true still installs
Depends(user_api_key_auth), so unauthenticated requests are still rejected.

Validated locally against LiteLLM 1.103.2: a plain generated key gets 200 with
real Metis answers; an unauthenticated POST gets 401.
This commit is contained in:
inference-bot committed 2026-11-03 18:30:22 +00:00
1 parent e4e70962ec
commit 557999a16f
3 files changed
+127

No files matched your search

+10
View File
@@ -251,6 +251,16 @@ general_settings:
# per-token billing (reading usage.input_tokens from the Metis response) would
# need a patch in the house style of the existing patch_*.py files; until then
# treat the spend figure for this route as an approximation, not an invoice.
# Routes here (matched by prefix) may be called by ANY authenticated member
# key. LiteLLM's own gate for auth=true pass-through routes
# (`allowed_passthrough_routes`) is an Enterprise-only field, so on this
# community-edition proxy it can never be granted to member keys — the only
# other option, auth:false, would expose the route publicly and forward the
# co-op's GreenPT key to anonymous callers. This list is consumed at build
# time by patch_passthrough_key_access.py; authentication is unchanged (the
# endpoint still requires a valid key).
coop_passthrough_open_to_keys:
- "/v1/systemone"
pass_through_endpoints:
- path: "/v1/systemone"
target: "https://api.greenpt.ai/v1/systemone"