Skip to content

fix(decisions): support the litellm_proxy provider (#51611, #53195) [lts/1.108.x] - #53196

Merged
mateo-berri merged 12 commits into
BerriAI:lts/1.108.xfrom
zoveki:litellm_backport_51611_lts_1_108_x
Nov 21, 2026
Merged

mateo-berri merged 12 commits into
BerriAI:lts/1.108.xfrom
zoveki:litellm_backport_51611_lts_1_108_x

Conversation

@zoveki

@zoveki zoveki commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #51611 and its follow-up #53195 to the 1.108 LTS line. Decision calls from an SDK app that sends its traffic through a LiteLLM proxy failed or went to OpenAI. Now they reach the proxy's /v1/decisions, a litellm.asystemone call goes to its /v1/systemone, and each call bills the cost the proxy reports

Original

TLDR

Problem this solves:

  • Decision calls fail when litellm.use_litellm_proxy is on
  • So do calls to a litellm_proxy/... model
  • A Router deployment flagged use_litellm_proxy: true sends decisions to OpenAI

How it solves it:

  • A new litellm_proxy decisions config sends decisions to the proxy's /v1/decisions with its URL and key
  • A keyless proxy works too
  • The per-call and per-deployment use_litellm_proxy flag counts
  • Audio, video and box questions go through, and the proxy decides support
  • litellm.systemone calls go to the proxy's own /v1/systemone unchanged
  • The call bills the proxy's x-litellm-response-cost
  • On the proxy, a request body cannot set use_litellm_proxy, fallback targets included
  • A caller's per-call drop_params goes to the proxy too
  • A proxied choice or score answer with no confidence reaches the caller

User Flow

Before: an SDK app that sends all its calls through a LiteLLM proxy cannot make decision calls

  1. The app sets litellm.use_litellm_proxy = True, LITELLM_PROXY_API_BASE and LITELLM_PROXY_API_KEY
  2. litellm.acompletion(model="openai/gpt-6-luna", ...) reaches the proxy and answers
  3. litellm.adecisions(model="openai/gpt-6-luna", ...) raises BadRequestError: Unknown Decisions provider 'litellm_proxy', and so does a litellm_proxy/... model
  4. A Router deployment with use_litellm_proxy: true sends its decision call to api.openai.com instead, which answers 401

After: the same decision calls go through the proxy

  1. The app sets litellm.use_litellm_proxy = True, LITELLM_PROXY_API_BASE and LITELLM_PROXY_API_KEY
  2. litellm.adecisions(model="openai/gpt-6-luna", ...) sends POST <LITELLM_PROXY_API_BASE>/v1/decisions with the proxy key and returns the proxy's answers, and so does a litellm_proxy/... model
  3. The Router deployment sends its decision call to the proxy and gets its answers
  4. litellm.asystemone(model="litellm_proxy/gemini/gemini-decision-1", ...) sends POST <LITELLM_PROXY_API_BASE>/v1/systemone and returns the proxy's answers with their confidence
  5. response._hidden_params["response_cost"] matches the x-litellm-response-cost the proxy billed

Relevant issues

Backport of #51611 and #53195, the fixes #51611 merged without, each picked with git cherry-pick -x. Five trailers name local copies that were never pushed, so the table maps each to its main commit. bbbb829, 20f7864 and 0f67db8 only merge main

Main commit On this line Trailer names
8f651ba c4d9e4f none
db2afb5 11ca520 db2afb5
abcbd7a 370e7ca, 4641a68 (adapted) d1fa55b1ac, abcbd7a
57fb1db 7eaeba7 (adapted) c6f2379abe
e078741 c0a4c2f 787aa1cc33
0040ed5 d53d40b 7c0892dbd2
43da8f6 0f4d1f3 (adapted) 43da8f6
f86f2e2 ba799a9 (adapted) e84aac682f
ecc0180 bfa7e74 (adapted) ecc0180
be5486c 96524be be5486c
f09d530 b020078 f09d530
How the picks differ from main

The db2afb5 pick adds and removes the same lines as on main. The 8f651ba pick registers the new config in this line's tuple-and-map lazy import registry and resolves it with the line's per-provider if, and its test file gains main's single-answer predicate fixture. Main's abcbd7a maps to two commits here. 370e7ca picks d1fa55b1ac, the fix abcbd7a replaced on main, and forwards box questions, audio and videos to the proxy. 4641a68 picks abcbd7a and keeps only its keyless proxy, because this line's supports_audio_input and supports_video_input take no per-deployment flag. So the litellm_proxy config always forwards audio and videos, only box questions can be turned off per deployment, and the refusal test covers box questions only. The 57fb1db pick is adapted because this line has no extra-field passthrough for decisions responses, so it leaves out main's evidence fields, and because this line's cost lookup keeps any float a provider reports. So the pick drops a negative, NaN or infinite cost header itself and the call bills the model price, which main's cost lookup already does. Its audio and video support checks keep this line's signature. The 43da8f6 pick is adapted because this line's answer types required confidence. 0f4d1f3 also brings main's optional-confidence check from #49188, so only the litellm_proxy config passes on a choice or score answer with no confidence, which a newer proxy that routes to Parallel AI sends, and every other decisions provider still answers 500 on one. The complexity router's own TypeSafe classifier takes an answer with no confidence, as on main. The f86f2e2 pick is adapted only because this line's _request_data takes no api_name and its endpoint has no extraction route. The ecc0180 pick is adapted only because this line's decisions call has no prompt cache breakpoint step for the flag to pass through. Main's b828c1b has no pick, because this line has no Gemini decisions config, so there is no Gemini systemone answer to name the model on

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Last updated: 0f4d1f3

SDK cases through a live far proxy at b828c1b. Before, each one fails without reaching the hop

SDK case Before 5f1b6e4cca After 0f4d1f3f5b
flag fails answered
prefix fails answered
router-flag fails answered
audio fails answered, 1 audio sent
video fails answered, 1 video sent
box fails answered, box sent
systemone fails answered
systemone-safety fails answered, safety_identifier sent
parallel fails answered
parallel-predicate not run answered, no confidence field
cost fails cost billed
priced fails cost billed
drop fails answered, drop_params sent
global-drop fails Gemini 400, see Caveats
keyless-prefix fails answered, no auth
keyless-flag fails answered, no auth

client.py, parallel_predicate.py and the transcripts are in the gist, for GitHub's size cap

Full SDK table, config, scripts and commands

The rig ran on a local macOS laptop, with one FAR proxy at main PR #53195's head b828c1b63b and a keyless FAR2 from the same tree, each on --num_workers 2 --reload with two workers serving (no "workers" flag is ignored warning, both worker PIDs on the listener) and one shared Redis with no database, recorders in front of OpenAI, Gemini, TypeSafe and both proxies, and every SDK leg on the AFTER tree's venv with PYTHONPATH set to its own tree

Case BEFORE 5f1b6e4cca AFTER 0f4d1f3f5b PRE-PORT b020078055
flag Unknown provider, no hop Answered via hop not run
prefix Unknown provider, no hop Answered via hop not run
router-flag OpenAI 401, no hop Answered via hop not run
audio Unknown provider, no hop Answered, hop has 1 audio not run
video Unknown provider, no hop Answered, hop has 1 video not run
box Unknown provider, no hop Answered, hop type box not run
systemone Unknown provider, no hop Answered via hop not run
systemone-safety Unknown provider, no hop Answered, hop has safety_identifier not run
parallel Unknown provider, no hop Answered, has confidence Answered, has confidence
parallel-predicate not run Answered, no confidence field Answered, no confidence field
cost Unknown provider, no hop Cost 1.71e-05 on both calls not run
priced Unknown provider, no hop Cost 0.0171 not run
drop Unknown provider, no hop Answered, hop drop_params: true not run
global-drop Unknown provider, no hop Hop has no drop_params, Gemini call 400 not run
keyless-prefix Unknown provider, no hop Answered, no auth header not run
keyless-flag Unknown provider, no hop Answered, no auth header not run

Every BEFORE case failed before any request reached HOP_WIRE or a provider recorder, and its recorder lines are empty. Every AFTER case reached HOP_WIRE (HOP2_WIRE for the keyless cases) with the body the caller sent, and the hop lines show the audio, video, box, safety_identifier and drop_params values listed above. The four GET /v1/models lines with a 401 inside keyless-flag come from the proxies themselves, since the SDK has no OPENAI_WIRE address

Three rows did not match what this run expected. The parallel rows answer with a confidence on both AFTER and PRE-PORT because Parallel's API now returns confidence on choice answers, so the no-confidence answer that 0f4d1f3f5b handles never came up and this run does not exercise it live. Called directly, Parallel also returns a confidence on a score answer but none on a predicate (noul) answer (last block). The parallel-predicate row sent that predicate through the hop, and PRE-PORT answered it with no 500. The predicate answer type has no confidence field, and the check 0f4d1f3f5b adds covers only choice and score answers, so a predicate never reached it on either commit. In global-drop the SDK left the global litellm.drop_params out of the hop body as designed, and the FAR proxy, which sets no drop_params of its own, answered the Gemini systemone call with a 400 because Gemini does not take safety_identifier. The OpenAI decision call in that case answered. Both results were the same on an earlier full boot, so they are not flakes

Everything here comes from the second full boot. On the first, FAR2 still had LITELLM_MASTER_KEY in its environment and the proxy reads that variable as its master key, so both keyless calls got a 401. Main also refuses to boot with no master key unless LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY=true is set, so FAR2 now runs with that variable and without LITELLM_MASTER_KEY. Every other row matched across both boots. The parallel-predicate row ran later on its own fresh boot of the same rig, and PRE-PORT gave the same answer on one more fresh boot

  • Parallel API now returns choice and score confidence, not this PR
  • Parallel predicate answers carry no confidence and pass on both commits
  • Keyless main proxy needs the dangerous opt-in, not this PR
  • Global drop_params stays local by this PR's design
config.yaml (FAR) and config-keyless.yaml (FAR2)

config.yaml is the earlier proof's config with the cloudflare/clairic entry dropped. config-keyless.yaml is the same file without the general_settings.master_key line

model_list:
  - model_name: openai/gpt-6-luna
    litellm_params:
      model: openai/gpt-6-luna
      api_key: os.environ/OPENAI_API_KEY
      api_base: os.environ/OPENAI_WIRE
  - model_name: gemini/gemini-decision-1
    litellm_params:
      model: gemini/gemini-decision-1
      api_key: os.environ/GEMINI_API_KEY
      api_base: os.environ/GEMINI_WIRE
  - model_name: chained-luna
    litellm_params:
      model: litellm_proxy/openai/gpt-6-luna
      api_base: os.environ/HOP_WIRE
      api_key: os.environ/LITELLM_MASTER_KEY
  - model_name: chained-gemini
    litellm_params:
      model: litellm_proxy/gemini/gemini-decision-1
      api_base: os.environ/HOP_WIRE
      api_key: os.environ/LITELLM_MASTER_KEY
    model_info:
      mode: decisions
  - model_name: chained-typesafe
    litellm_params:
      model: litellm_proxy/typesafe/jev-1.14.0
      api_base: os.environ/HOP_WIRE
      api_key: os.environ/LITELLM_MASTER_KEY
  - model_name: chained-priced
    litellm_params:
      model: litellm_proxy/priced-luna
      api_base: os.environ/HOP_WIRE
      api_key: os.environ/LITELLM_MASTER_KEY
  - model_name: chained-custom-priced
    litellm_params:
      model: litellm_proxy/openai/gpt-6-luna
      api_base: os.environ/HOP_WIRE
      api_key: os.environ/LITELLM_MASTER_KEY
      input_cost_per_token: 0.00002
      output_cost_per_token: 0.00008
  - model_name: openai-as-proxy
    litellm_params:
      model: litellm_proxy/gpt-6-luna
      api_base: os.environ/OPENAI_WIRE
      api_key: os.environ/OPENAI_API_KEY
  - model_name: typesafe/jev-1.14.0
    litellm_params:
      model: typesafe/jev-1.14.0
      api_key: os.environ/TYPESAFE_API_KEY
      api_base: os.environ/TYPESAFE_WIRE
      extra_headers:
        typesafe-danger-zone-images: "true"
  - model_name: parallel_ai/decision
    litellm_params:
      model: parallel_ai/decision
      api_key: os.environ/PARALLEL_API_KEY
  - model_name: broken-luna
    litellm_params:
      model: openai/gpt-6-luna
      api_key: sk-not-a-real-openai-key
      api_base: os.environ/OPENAI_WIRE
  - model_name: priced-luna
    litellm_params:
      model: openai/gpt-6-luna
      api_key: os.environ/OPENAI_API_KEY
      api_base: os.environ/OPENAI_WIRE
      input_cost_per_token: 0.0001
      output_cost_per_token: 0.0004
router_settings:
  redis_host: os.environ/REDIS_HOST
  redis_port: os.environ/REDIS_PORT
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
  coordination_redis:
    host: os.environ/REDIS_HOST
    port: os.environ/REDIS_PORT
keyless.py and recorder.py

keyless.py is client.py's prefix and flag cases with the LITELLM_PROXY_API_KEY read removed

import asyncio
import sys

import litellm

INPUT = "The package arrived today and the screen is cracked down the middle."
QUESTIONS = [{"type": "predicate", "name": "is_defect", "instructions": "Does the customer report a defective or damaged product?"}]


def show(label: str, response: object) -> None:
    hidden = getattr(response, "_hidden_params", {}) or {}
    print(
        f"{label} OK model={getattr(response, 'model', None)} answers={getattr(response, 'answers', None)}"
        f" decision_id={getattr(response, 'decision_id', None)} response_cost={hidden.get('response_cost')}"
    )


def fail(label: str, error: Exception) -> None:
    print(f"{label} {type(error).__name__}: {str(error)[:260]}")


async def run(label: str, call, **params: object) -> None:
    try:
        show(label, await call(**params))
    except Exception as error:
        fail(label, error)


async def main(case: str) -> None:
    if case == "keyless-flag":
        litellm.use_litellm_proxy = True
        await run("decision", litellm.adecisions, model="openai/gpt-6-luna", input=INPUT, questions=QUESTIONS)
    elif case == "keyless-prefix":
        await run("decision", litellm.adecisions, model="litellm_proxy/openai/gpt-6-luna", input=INPUT, questions=QUESTIONS)
    else:
        raise SystemExit(f"unknown case {case}")


if __name__ == "__main__":
    asyncio.run(main(sys.argv[1]))
import json
import sys
import urllib.error
import urllib.request
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

LISTEN_PORT = int(sys.argv[1])
TARGET = sys.argv[2].rstrip("/")
LOG_PATH = sys.argv[3]
WIRE_NAME = sys.argv[4]
LOG_AUTH_PRESENCE = "--log-auth-presence" in sys.argv[5:]
HOP_BY_HOP = frozenset({"connection", "keep-alive", "transfer-encoding", "te", "trailer", "upgrade", "host", "content-length"})


def item_count(value: object) -> int:
    return len(value) if isinstance(value, list) else 0


def question_types(questions: object) -> list:
    if isinstance(questions, list):
        return [q.get("type") for q in questions if isinstance(q, dict)]
    if isinstance(questions, dict):
        return [q.get("type") for q in questions.values() if isinstance(q, dict)]
    return []


def body_summary(raw: bytes) -> dict:
    try:
        parsed = json.loads(raw) if raw else None
    except ValueError:
        return {"keys": "non-json"}
    if not isinstance(parsed, dict):
        return {"keys": "no-body" if parsed is None else "non-object"}
    return {
        "keys": sorted(parsed),
        "drop_params": parsed.get("drop_params", "absent"),
        "safety_identifier": parsed.get("safety_identifier", "absent"),
        "audio": item_count(parsed.get("audio")),
        "videos": item_count(parsed.get("videos")),
        "question_types": question_types(parsed.get("questions")),
    }


class Forwarder(BaseHTTPRequestHandler):
    protocol_version = "HTTP/1.1"

    def _forward(self) -> None:
        length = int(self.headers.get("Content-Length") or 0)
        raw = self.rfile.read(length) if length else b""
        upstream_headers = {k: v for k, v in self.headers.items() if k.lower() not in HOP_BY_HOP}
        request = urllib.request.Request(TARGET + self.path, data=raw or None, headers=upstream_headers, method=self.command)
        try:
            response = urllib.request.urlopen(request, timeout=300)
        except urllib.error.HTTPError as error:
            response = error
        except (urllib.error.URLError, TimeoutError) as error:
            with open(LOG_PATH, "a") as log:
                log.write(json.dumps({"wire": WIRE_NAME, "method": self.command, "path": self.path, "status": f"unreachable: {error}", **body_summary(raw)}) + "\n")
            self.send_error(502)
            return
        payload = response.read()
        code = response.status if hasattr(response, "status") else response.code
        auth = {"authorization": "authorization" in {k.lower() for k in self.headers}} if LOG_AUTH_PRESENCE else {}
        line = {"wire": WIRE_NAME, "method": self.command, "path": self.path, "status": code, **auth, **body_summary(raw)}
        with open(LOG_PATH, "a") as log:
            log.write(json.dumps(line) + "\n")
        self.send_response(code)
        for key, value in response.headers.items():
            if key.lower() not in HOP_BY_HOP:
                self.send_header(key, value)
        self.send_header("Content-Length", str(len(payload)))
        self.end_headers()
        self.wfile.write(payload)

    do_GET = _forward
    do_POST = _forward
    do_PUT = _forward
    do_DELETE = _forward
    do_PATCH = _forward

    def log_message(self, format: str, *args: object) -> None:
        return


ThreadingHTTPServer(("127.0.0.1", LISTEN_PORT), Forwarder).serve_forever()
Rig commands and env var names, as run

The proxies get only the variables named after clean_exec, which unsets every other exported variable except HOME and PATH. PYTHON_DOTENV_DISABLED=1 keeps every process from loading a tree's .env, so the SDK legs see only LITELLM_PROXY_API_BASE, LITELLM_PROXY_API_KEY and the fake OPENAI_API_KEY, and the keyless legs see no LITELLM_PROXY_API_KEY at all. Every port came from a random pick in 20000-32767 checked free with lsof -nP -iTCP:<port> -sTCP:LISTEN

clean_exec() {
  local keep=" HOME PATH "
  while [ "$1" != "--" ]; do keep="$keep$1 "; shift; done
  shift
  for v in $(compgen -e); do
    case "$keep" in *" $v "*) ;; *) unset "$v" 2>/dev/null ;; esac
  done
  exec "$@"
}
RUN_TAG=run3
R=/private/tmp/claude-501/-Users-mateo-Development-litellm/f4395883-219e-468b-9f18-15defa9964a8/scratchpad/work-b79598dd/reproof
OUT="$R/$RUN_TAG"
WIRE_LOG="$OUT/wire.jsonl"
OPENAI_API_KEY="$(~/.claude/bin/dotenv-get OPENAI_API_KEY --file /Users/mateo/Development/litellm/.env)"
GEMINI_API_KEY="$(~/.claude/bin/dotenv-get GEMINI_API_KEY --file /Users/mateo/Development/litellm/.env)"
TYPESAFE_API_KEY="$(~/.claude/bin/dotenv-get TYPESAFE_API_KEY --file /Users/mateo/Development/litellm/.env)"
PARALLEL_API_KEY="$(~/.claude/bin/dotenv-get PARALLEL_API_KEY --file /Users/mateo/Development/litellm/.env)"
LITELLM_MASTER_KEY="sk-$(openssl rand -hex 24)"
OPENAI_WIRE="http://127.0.0.1:$OPENAI_WIRE_PORT"
GEMINI_WIRE="http://127.0.0.1:$GEMINI_WIRE_PORT"
TYPESAFE_WIRE="http://127.0.0.1:$TYPESAFE_WIRE_PORT"
HOP_WIRE="http://127.0.0.1:$HOP_WIRE_PORT"
HOP2_WIRE="http://127.0.0.1:$HOP2_WIRE_PORT"
REDIS_HOST=127.0.0.1
PYTHON_DOTENV_DISABLED=1
export OPENAI_API_KEY GEMINI_API_KEY TYPESAFE_API_KEY PARALLEL_API_KEY LITELLM_MASTER_KEY
export OPENAI_WIRE GEMINI_WIRE TYPESAFE_WIRE HOP_WIRE REDIS_HOST REDIS_PORT PYTHON_DOTENV_DISABLED
FAR_ENV="PYTHON_DOTENV_DISABLED OPENAI_API_KEY GEMINI_API_KEY TYPESAFE_API_KEY PARALLEL_API_KEY LITELLM_MASTER_KEY OPENAI_WIRE GEMINI_WIRE TYPESAFE_WIRE HOP_WIRE REDIS_HOST REDIS_PORT"
LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY=true
export LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY
FAR2_ENV="LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY PYTHON_DOTENV_DISABLED OPENAI_API_KEY GEMINI_API_KEY TYPESAFE_API_KEY PARALLEL_API_KEY OPENAI_WIRE GEMINI_WIRE TYPESAFE_WIRE HOP_WIRE REDIS_HOST REDIS_PORT"
clean_exec -- redis-server --port "$REDIS_PORT" --save '' --appendonly no --dir "$OUT/redis" > "$OUT/redis.log" 2>&1 &
clean_exec -- python3 -I "$R/recorder.py" "$OPENAI_WIRE_PORT" https://api.openai.com "$WIRE_LOG" OPENAI_WIRE &
clean_exec -- python3 -I "$R/recorder.py" "$GEMINI_WIRE_PORT" https://generativelanguage.googleapis.com "$WIRE_LOG" GEMINI_WIRE &
clean_exec -- python3 -I "$R/recorder.py" "$TYPESAFE_WIRE_PORT" https://api.typesafe.ai "$WIRE_LOG" TYPESAFE_WIRE &
clean_exec -- python3 -I "$R/recorder.py" "$HOP_WIRE_PORT" "http://127.0.0.1:$FAR_PORT" "$WIRE_LOG" HOP_WIRE &
clean_exec -- python3 -I "$R/recorder.py" "$HOP2_WIRE_PORT" "http://127.0.0.1:$FAR2_PORT" "$WIRE_LOG" HOP2_WIRE --log-auth-presence &
ports: redis=32571 far=20664 far2=30695 openai_wire=22943 gemini_wire=21551 typesafe_wire=29256 hop_wire=23757 hop2_wire=21977
== FAR proxy (cwd /Users/mateo/Development/litellm-worktrees/work-b79598dd-head)
$ clean_exec PYTHON_DOTENV_DISABLED OPENAI_API_KEY GEMINI_API_KEY TYPESAFE_API_KEY PARALLEL_API_KEY LITELLM_MASTER_KEY OPENAI_WIRE GEMINI_WIRE TYPESAFE_WIRE HOP_WIRE REDIS_HOST REDIS_PORT -- /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python litellm/proxy/proxy_cli.py --config /private/tmp/claude-501/-Users-mateo-Development-litellm/f4395883-219e-468b-9f18-15defa9964a8/scratchpad/work-b79598dd/reproof/config.yaml --port 20664 --num_workers 2 --detailed_debug --reload --use_v2_migration_resolver
== FAR2 proxy (cwd /Users/mateo/Development/litellm-worktrees/work-b79598dd-head)
$ clean_exec LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY PYTHON_DOTENV_DISABLED OPENAI_API_KEY GEMINI_API_KEY TYPESAFE_API_KEY PARALLEL_API_KEY OPENAI_WIRE GEMINI_WIRE TYPESAFE_WIRE HOP_WIRE REDIS_HOST REDIS_PORT -- /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python litellm/proxy/proxy_cli.py --config /private/tmp/claude-501/-Users-mateo-Development-litellm/f4395883-219e-468b-9f18-15defa9964a8/scratchpad/work-b79598dd/reproof/config-keyless.yaml --port 30695 --num_workers 2 --detailed_debug --reload --use_v2_migration_resolver
== worker check
far reloader pid 40910, descendants: 45479 45480 46115 46116 
  PID  PPID COMMAND
40910 40622 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python litellm/proxy/proxy_cli.py --config /private/tmp/claude-501/-Users-mateo-Develo
45479 40910 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.resource_tracker import main;main(4)
45480 40910 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_
46115 45480 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_
46116 45480 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_
5:INFO:     Started reloader process [40910] using StatReload
7:INFO:     Started server process [46116]
9:INFO:     Started server process [46115]
far TIMEOUT_WORKER_HEALTHCHECK in env: 0
far DATABASE_URL in env: 0
far LITELLM_MASTER_KEY in env: 1
far2 reloader pid 40911, descendants: 45626 45630 46138 46140 
  PID  PPID COMMAND
40911 40622 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python litellm/proxy/proxy_cli.py --config /private/tmp/claude-501/-Users-mateo-Develo
45626 40911 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.resource_tracker import main;main(4)
45630 40911 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_
46138 45630 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_
46140 45630 /Users/mateo/Development/litellm-worktrees/work-b79598dd-head/.venv/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_
5:INFO:     Started reloader process [40911] using StatReload
7:INFO:     Started server process [46140]
35:INFO:     Started server process [46138]
far2 TIMEOUT_WORKER_HEALTHCHECK in env: 0
far2 DATABASE_URL in env: 0
far2 LITELLM_MASTER_KEY in env: 0
$ lsof -nP -iTCP:20664 -sTCP:LISTEN
COMMAND     PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
python3.1 40910 mateo    3u  IPv4 0xb95705993183202a      0t0  TCP *:20664 (LISTEN)
python3.1 45480 mateo    3u  IPv4 0xb95705993183202a      0t0  TCP *:20664 (LISTEN)
python3.1 46115 mateo    3u  IPv4 0xb95705993183202a      0t0  TCP *:20664 (LISTEN)
python3.1 46116 mateo    3u  IPv4 0xb95705993183202a      0t0  TCP *:20664 (LISTEN)
$ lsof -nP -iTCP:30695 -sTCP:LISTEN
COMMAND     PID  USER   FD   TYPE            DEVICE SIZE/OFF NODE NAME
python3.1 40911 mateo    3u  IPv4 0x76fad93494ba4bd      0t0  TCP *:30695 (LISTEN)
python3.1 45630 mateo    3u  IPv4 0x76fad93494ba4bd      0t0  TCP *:30695 (LISTEN)
python3.1 46138 mateo    3u  IPv4 0x76fad93494ba4bd      0t0  TCP *:30695 (LISTEN)
python3.1 46140 mateo    3u  IPv4 0x76fad93494ba4bd      0t0  TCP *:30695 (LISTEN)
redis ping: PONG
133:17:39:48 - LiteLLM Proxy:DEBUG: utils.py:2462 - Skipping proxy hook autorouter_baseline_cache: it requires a database and no prisma client is configured
134:17:39:48 - LiteLLM Proxy:DEBUG: utils.py:2462 - Skipping proxy hook autorouter_baseline_cache: it requires a database and no prisma client is configured
135:17:39:48 - LiteLLM Proxy:DEBUG: utils.py:2462 - Skipping proxy hook managed_files: it requires a database and no prisma client is configured
PRE-PORT transcript, commit b020078
$ git -C /Users/mateo/Development/litellm-worktrees/work-b79598dd-ltsprev rev-parse --short=10 HEAD
b020078055
$ env -i HOME="$HOME" PATH="$PATH" PYTHONPATH=/Users/mateo/Development/litellm-worktrees/work-b79598dd-ltsprev PYTHON_DOTENV_DISABLED=1 /Users/mateo/Development/litellm-worktrees/work-b79598dd-lts/.venv/bin/python -c 'import litellm; print(litellm.__file__)'
/Users/mateo/Development/litellm-worktrees/work-b79598dd-ltsprev/litellm/__init__.py

# case parallel
$ env -i HOME="$HOME" PATH="$PATH" PYTHONPATH=/Users/mateo/Development/litellm-worktrees/work-b79598dd-ltsprev PYTHON_DOTENV_DISABLED=1 LITELLM_PROXY_API_BASE=http://127.0.0.1:23757 LITELLM_PROXY_API_KEY="$LITELLM_MASTER_KEY" OPENAI_API_KEY=sk-not-a-real-openai-key gtimeout 400 /Users/mateo/Development/litellm-worktrees/work-b79598dd-lts/.venv/bin/python client.py parallel
decision OK model=decision answers=(OpenAIChoiceAnswer(type='choice', name='tone', choice='upset', probabilities=(OpenAIChoiceProbability(value='calm', probability=0.04007572680702925), OpenAIChoiceProbability(value='upset', probability=0.9599242731929708)), confidence=0.9198485463859416),) decision_id=None response_cost=0.001
# recorder lines
{"wire": "HOP_WIRE", "method": "POST", "path": "/v1/decisions", "status": 200, "keys": ["input", "model", "questions"], "drop_params": "absent", "safety_identifier": "absent", "audio": 0, "videos": 0, "question_types": ["choice"]}
Parallel called directly with choice, score and predicate questions
== choice
BODY={"mode":"fast","state":"The package arrived today and the screen is cracked down the middle.","questions":{"tone":{"type":"choice","instructions":"What is the customer's tone?","criteria":{"calm":"relaxed or neutral","upset":"angry or frustrated"}}}}
$ curl -sS https://api.parallel.ai/v1/decisions -H "x-api-key: $PARALLEL_API_KEY" -H 'Content-Type: application/json' -d "$BODY" | python3 -c 'import sys,json; print(json.dumps(json.load(sys.stdin)["answers"]))'
{"tone": {"type": "choice", "choice": "upset", "probabilities": {"calm": 0.04007572680702925, "upset": 0.9599242731929708}, "confidence": 0.9198485463859416}}
== score
BODY={"mode":"fast","state":"The package arrived today and the screen is cracked down the middle.","questions":{"severity":{"type":"score","instructions":"How severe is the problem the customer reports?","criteria":["minor: cosmetic or no real problem","moderate: works but needs a fix","severe: unusable or broken"]}}}
$ curl -sS https://api.parallel.ai/v1/decisions -H "x-api-key: $PARALLEL_API_KEY" -H 'Content-Type: application/json' -d "$BODY" | python3 -c 'import sys,json; print(json.dumps(json.load(sys.stdin)["answers"]))'
{"severity": {"type": "score", "score": 1.5934581295430383, "legend": {"0": "minor: cosmetic or no real problem", "1": "moderate: works but needs a fix", "2": "severe: unusable or broken"}, "probabilities": {"0": 0.08203870775439524, "1": 0.242464454948171, "2": 0.6754968372974337}, "confidence": 0.39018719431455773}}
== predicate
BODY={"mode":"fast","state":"The package arrived today and the screen is cracked down the middle.","questions":{"is_defect":{"type":"noul","instructions":"Does the customer report a defective or damaged product?"}}}
$ curl -sS https://api.parallel.ai/v1/decisions -H "x-api-key: $PARALLEL_API_KEY" -H 'Content-Type: application/json' -d "$BODY" | python3 -c 'import sys,json; print(json.dumps(json.load(sys.stdin)["answers"]))'
{"is_defect": {"type": "noul", "noul": 0.9904551180372425}}

In the b020078 smoke, a proxy-wide drop_params reached the hop and OpenAI answered 400 before, and 200 after

Smoke table, config and commands

Live smoke on lts/1.108.x for /v1/decisions and /v1/systemone

Both legs ran at the same time on a macOS laptop (18 cores), each with its own Redis, proxy and two forwarding recorders, and each proxy printed "workers" flag is ignored when reloading is enabled, so each leg served from one uvicorn worker and the two-worker check was dropped.

# Request Before 96524beb69 After b020078055
1 decisions status, proxy-wide setting 400 from OpenAI 200 from OpenAI
1 drop_params at OpenAI true absent
2 systemone drop_params at hop, proxy-wide setting true absent
2 systemone status via Gemini hop 400 at hop 400 at hop
2b systemone drop_params at hop, proxy-wide setting true absent
2b systemone status via OpenAI hop 200 200
3 systemone drop_params at hop, per-call setting true true
3 systemone status via Gemini hop 400 at hop 400 at hop
3b systemone drop_params at hop, per-call setting true true
3b systemone status via OpenAI hop 200 200

Requests 2 and 3 end in a 400 on both legs because this LTS line has no Gemini decisions provider, so the hop proxy answers Unknown Decisions provider 'gemini'. Requests 2b and 3b send the same calls through a hop to OpenAI gpt-6-luna and answer 200 on both legs. The before leg's 2b still answers 200 because the hop is a LiteLLM proxy, which accepts drop_params, so only an upstream that is not a LiteLLM proxy (request 1) refuses it. Requests 2b and 3b ran on a second fresh boot of both legs, with the chained-luna and openai/gpt-6-luna entries added to the config.

Headline, request 1 (/v1/decisions through a litellm_proxy/ deployment that points at OpenAI)

Before, at 96524beb69

$ curl -sS -w 'status=%{http_code}' http://127.0.0.1:30757/v1/decisions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d "{\"model\":\"openai-as-proxy\",$Q}"
status=400
{"error":{"message":"litellm.BadRequestError: Litellm_proxyException - {\"error\":{\"message\":\"Unknown parameter: 'drop_params'.\",\"type\":\"invalid_request_error\",\"param\":\"drop_params\",\"code\":\"unknown_parameter\"}}...
OPENAI_WIRE {"path": "/v1/decisions", "keys": ["drop_params", "input", "model", "questions"], "drop_params": true}

After, at b020078055

$ curl -sS -w 'status=%{http_code}' http://127.0.0.1:28021/v1/decisions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d "{\"model\":\"openai-as-proxy\",$Q}"
status=200
{"model":"gpt-6-luna","answers":[{"type":"predicate","name":"is_defect","probability":1.0}],"usage":{"input_tokens":171,...,"total_tokens":171}}
OPENAI_WIRE {"path": "/v1/decisions", "keys": ["input", "model", "questions"], "drop_params": "absent"}

Rig

Each leg ran the proxy from its own tree with the after tree's .venv/bin/python and PYTHONPATH set to that tree, and each leg printed litellm.__file__ from its own tree. Both trees were clean (git status --porcelain empty) and at the stated commit before boot. The after tree has a bootstrap .env that carries a database URL, so both legs set PYTHON_DOTENV_DISABLED=1 and took every value from the shell, and both boot logs show prisma_client: None.

Leg Commit Redis Proxy OPENAI_WIRE HOP_WIRE
Before 96524beb69 25406 30757 32532 23387
After b020078055 21048 28021 22193 24080

The env var names are the same on both legs. OPENAI_API_KEY and GEMINI_API_KEY come from the main checkout's .env through dotenv-get, LITELLM_MASTER_KEY is a random sk- value per boot, and OPENAI_WIRE and HOP_WIRE point at the leg's recorders. The rest are PYTHON_DOTENV_DISABLED=1, LITELLM_LOCAL_MODEL_COST_MAP=True and PYTHONPATH=<leg tree>, with DATABASE_URL, OPENAI_BASE_URL and TIMEOUT_WORKER_HEALTHCHECK unset.

Commands per leg, the proxy run from the leg's tree

redis-server --port <leg redis port> --save '' --appendonly no --dir <scratch>
python3 -I recorder.py <OPENAI_WIRE port> https://api.openai.com wire.jsonl OPENAI_WIRE
python3 -I recorder.py <HOP_WIRE port> http://127.0.0.1:<leg proxy port> wire.jsonl HOP_WIRE
python litellm/proxy/proxy_cli.py --config <leg config.yaml> --port <leg proxy port> --num_workers 2 --detailed_debug --reload --use_v2_migration_resolver

Config, the same on both legs apart from the Redis port. The chained-luna and openai/gpt-6-luna entries were added for the second boot that ran 2b and 3b

model_list:
  - model_name: openai-as-proxy
    litellm_params: {model: litellm_proxy/gpt-6-luna, api_base: os.environ/OPENAI_WIRE, api_key: os.environ/OPENAI_API_KEY}
  - model_name: chained-gemini
    litellm_params: {model: litellm_proxy/gemini/gemini-decision-1, api_base: os.environ/HOP_WIRE, api_key: os.environ/LITELLM_MASTER_KEY}
    model_info: {mode: decisions}
  - model_name: gemini/gemini-decision-1
    litellm_params: {model: gemini/gemini-decision-1, api_key: os.environ/GEMINI_API_KEY}
  - model_name: chained-luna
    litellm_params: {model: litellm_proxy/openai/gpt-6-luna, api_base: os.environ/HOP_WIRE, api_key: os.environ/LITELLM_MASTER_KEY}
  - model_name: openai/gpt-6-luna
    litellm_params: {model: openai/gpt-6-luna, api_key: os.environ/OPENAI_API_KEY}
litellm_settings: {drop_params: true}
router_settings: {redis_host: 127.0.0.1, redis_port: <leg redis port>}
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
  coordination_redis: {host: 127.0.0.1, port: <leg redis port>}

Requests, sent 8 seconds apart on each leg

S='"state":"The package arrived today and the screen is cracked down the middle.","questions":{"is_defect":{"type":"noul","instructions":"Does the customer report a defective or damaged product?"}}'
Q='"input":"The package arrived today and the screen is cracked down the middle.","questions":[{"type":"predicate","name":"is_defect","instructions":"Does the customer report a defective or damaged product?"}]'
curl -sS -w 'status=%{http_code}' http://127.0.0.1:<leg proxy port>/v1/decisions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d "{\"model\":\"openai-as-proxy\",$Q}"
curl -sS -w 'status=%{http_code}' http://127.0.0.1:<leg proxy port>/v1/systemone -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d "{\"model\":\"chained-gemini\",$S}"
curl -sS -w 'status=%{http_code}' http://127.0.0.1:<leg proxy port>/v1/systemone -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d "{\"model\":\"chained-gemini\",$S,\"drop_params\":true}"
curl -sS -w 'status=%{http_code}' http://127.0.0.1:<leg proxy port>/v1/systemone -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d "{\"model\":\"chained-luna\",$S}"
curl -sS -w 'status=%{http_code}' http://127.0.0.1:<leg proxy port>/v1/systemone -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d "{\"model\":\"chained-luna\",$S,\"drop_params\":true}"
Recorder script, which forwards each request unchanged and logs the path, sorted body keys and drop_params, never headers
import json
import sys
import urllib.error
import urllib.request
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

LISTEN_PORT = int(sys.argv[1])
TARGET = sys.argv[2].rstrip("/")
LOG_PATH = sys.argv[3]
WIRE_NAME = sys.argv[4]
HOP_BY_HOP = {"connection", "keep-alive", "transfer-encoding", "te", "trailer", "upgrade", "host", "content-length"}

def body_summary(raw: bytes) -> dict:
    try:
        parsed = json.loads(raw) if raw else None
    except ValueError:
        return {"keys": "non-json", "drop_params": "absent"}
    if not isinstance(parsed, dict):
        return {"keys": "non-object", "drop_params": "absent"}
    return {"keys": sorted(parsed), "drop_params": parsed.get("drop_params", "absent")}

class Forwarder(BaseHTTPRequestHandler):
    protocol_version = "HTTP/1.1"

    def _forward(self) -> None:
        length = int(self.headers.get("Content-Length") or 0)
        raw = self.rfile.read(length) if length else b""
        with open(LOG_PATH, "a") as log:
            log.write(json.dumps({"wire": WIRE_NAME, "method": self.command, "path": self.path, **body_summary(raw)}) + "\n")
        upstream_headers = {k: v for k, v in self.headers.items() if k.lower() not in HOP_BY_HOP}
        request = urllib.request.Request(
            TARGET + self.path, data=raw if raw else None, headers=upstream_headers, method=self.command
        )
        try:
            response = urllib.request.urlopen(request, timeout=300)
        except urllib.error.HTTPError as error:
            response = error
        payload = response.read()
        self.send_response(response.status if hasattr(response, "status") else response.code)
        for key, value in response.headers.items():
            if key.lower() not in HOP_BY_HOP:
                self.send_header(key, value)
        self.send_header("Content-Length", str(len(payload)))
        self.end_headers()
        self.wfile.write(payload)

    do_GET = _forward
    do_POST = _forward
    do_PUT = _forward
    do_DELETE = _forward
    do_PATCH = _forward

    def log_message(self, format: str, *args: object) -> None:
        return

ThreadingHTTPServer(("127.0.0.1", LISTEN_PORT), Forwarder).serve_forever()
Leg runner script, exactly as run
#!/bin/bash
set -u
LEG="$1"
TREE="$2"
REDIS_PORT="$3"
PROXY_PORT="$4"
OPENAI_WIRE_PORT="$5"
HOP_WIRE_PORT="$6"
REQS="${7:-1 2 3}"
SCR=/private/tmp/claude-501/-Users-mateo-Development-litellm/f4395883-219e-468b-9f18-15defa9964a8/scratchpad/work-b79598dd/ltssmoke
LEGDIR="$SCR/$LEG"
RUN_TAG="${RUN_TAG:-run1}"
PY=/Users/mateo/Development/litellm-worktrees/work-b79598dd-lts/.venv/bin/python
WIRE_LOG="$LEGDIR/wire-$RUN_TAG.jsonl"
PROXY_LOG="$LEGDIR/litellm-$RUN_TAG.log"
PIDS_FILE="$LEGDIR/pids-$RUN_TAG"
: > "$WIRE_LOG"
: > "$PIDS_FILE"

OPENAI_API_KEY="$(~/.claude/bin/dotenv-get OPENAI_API_KEY --file /Users/mateo/Development/litellm/.env)"
GEMINI_API_KEY="$(~/.claude/bin/dotenv-get GEMINI_API_KEY --file /Users/mateo/Development/litellm/.env)"
LITELLM_MASTER_KEY="sk-$(openssl rand -hex 24)"
OPENAI_WIRE="http://127.0.0.1:$OPENAI_WIRE_PORT"
HOP_WIRE="http://127.0.0.1:$HOP_WIRE_PORT"
PYTHON_DOTENV_DISABLED=1
LITELLM_LOCAL_MODEL_COST_MAP=True
PYTHONPATH="$TREE"
export OPENAI_API_KEY GEMINI_API_KEY LITELLM_MASTER_KEY OPENAI_WIRE HOP_WIRE PYTHON_DOTENV_DISABLED LITELLM_LOCAL_MODEL_COST_MAP PYTHONPATH
unset DATABASE_URL OPENAI_BASE_URL TIMEOUT_WORKER_HEALTHCHECK

descendants() {
  local kids
  kids=$(pgrep -P "$1")
  for k in $kids; do
    echo "$k"
    descendants "$k"
  done
}

teardown() {
  echo "== teardown ($LEG $RUN_TAG)"
  local all
  all=$(cat "$PIDS_FILE")
  for p in $PROXY_PID; do all="$all $(descendants "$p")"; done
  for p in $all; do kill -TERM "$p" 2>/dev/null; done
  sleep 3
  for p in $all; do kill -0 "$p" 2>/dev/null && kill -KILL "$p" 2>/dev/null; done
  for p in $all; do kill -0 "$p" 2>/dev/null && echo "still alive: $p" || echo "stopped: $p"; done
  "$PY" -I - "$PROXY_LOG" <<'EOF'
import os, sys
path = sys.argv[1]
secrets = [os.environ[k] for k in ("OPENAI_API_KEY", "GEMINI_API_KEY", "LITELLM_MASTER_KEY") if os.environ.get(k)]
text = open(path, errors="replace").read()
hits = sum(text.count(s) for s in secrets)
for s in secrets:
    text = text.replace(s, "<redacted>")
open(path, "w").write(text)
print(f"proxy log secret occurrences redacted: {hits}")
EOF
}

cd "$TREE" || exit 1
echo "== leg $LEG ($RUN_TAG) tree $TREE"
echo "\$ git rev-parse --short=10 HEAD"
git rev-parse --short=10 HEAD
echo "\$ git --no-optional-locks status --porcelain | wc -l"
git --no-optional-locks status --porcelain | wc -l | tr -d ' '
echo "\$ python -c 'import litellm; print(litellm.__file__)'"
"$PY" -c 'import litellm; print(litellm.__file__)'

redis-server --port "$REDIS_PORT" --save '' --appendonly no --dir "$LEGDIR/redis" > "$LEGDIR/redis-$RUN_TAG.log" 2>&1 &
echo $! >> "$PIDS_FILE"
python3 -I "$SCR/recorder.py" "$OPENAI_WIRE_PORT" https://api.openai.com "$WIRE_LOG" OPENAI_WIRE &
echo $! >> "$PIDS_FILE"
python3 -I "$SCR/recorder.py" "$HOP_WIRE_PORT" "http://127.0.0.1:$PROXY_PORT" "$WIRE_LOG" HOP_WIRE &
echo $! >> "$PIDS_FILE"
"$PY" litellm/proxy/proxy_cli.py --config "$LEGDIR/config.yaml" --port "$PROXY_PORT" --num_workers 2 --detailed_debug --reload --use_v2_migration_resolver > "$PROXY_LOG" 2>&1 &
PROXY_PID=$!
echo "$PROXY_PID" >> "$PIDS_FILE"
trap teardown EXIT
echo "pids (redis, openai_wire, hop_wire, proxy): $(tr '\n' ' ' < "$PIDS_FILE")"

ready=0
for _ in $(seq 1 150); do
  if [ "$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:$PROXY_PORT/health/liveliness")" = "200" ]; then ready=1; break; fi
  sleep 2
done
echo "liveliness ready: $ready"
[ "$ready" = 1 ] || { tail -40 "$PROXY_LOG"; exit 1; }
sleep 3

echo "== worker check"
echo "proxy (reloader) pid $PROXY_PID, descendants: $(descendants "$PROXY_PID" | tr '\n' ' ')"
ps -o pid,ppid,command -p "$PROXY_PID,$(descendants "$PROXY_PID" | paste -sd, -)" | cut -c1-160
grep -n -i '"workers" flag is ignored\|workers.*ignored' "$PROXY_LOG" | head -3
grep -n 'Started server process\|Started reloader process' "$PROXY_LOG" | head -6
echo "redis ping: $(redis-cli -p "$REDIS_PORT" ping)"
grep -n -i 'prisma_client\|DATABASE_URL' "$PROXY_LOG" | head -3

S='"state":"The package arrived today and the screen is cracked down the middle.","questions":{"is_defect":{"type":"noul","instructions":"Does the customer report a defective or damaged product?"}}'
Q='"input":"The package arrived today and the screen is cracked down the middle.","questions":[{"type":"predicate","name":"is_defect","instructions":"Does the customer report a defective or damaged product?"}]'

req_cmd() {
  case "$1" in
    1) echo "curl -sS -w 'status=%{http_code}' http://127.0.0.1:$PROXY_PORT/v1/decisions -H \"Authorization: Bearer \$LITELLM_MASTER_KEY\" -H 'Content-Type: application/json' -d \"{\\\"model\\\":\\\"openai-as-proxy\\\",\$Q}\"" ;;
    2) echo "curl -sS -w 'status=%{http_code}' http://127.0.0.1:$PROXY_PORT/v1/systemone -H \"Authorization: Bearer \$LITELLM_MASTER_KEY\" -H 'Content-Type: application/json' -d \"{\\\"model\\\":\\\"chained-gemini\\\",\$S}\"" ;;
    3) echo "curl -sS -w 'status=%{http_code}' http://127.0.0.1:$PROXY_PORT/v1/systemone -H \"Authorization: Bearer \$LITELLM_MASTER_KEY\" -H 'Content-Type: application/json' -d \"{\\\"model\\\":\\\"chained-gemini\\\",\$S,\\\"drop_params\\\":true}\"" ;;
    2b) echo "curl -sS -w 'status=%{http_code}' http://127.0.0.1:$PROXY_PORT/v1/systemone -H \"Authorization: Bearer \$LITELLM_MASTER_KEY\" -H 'Content-Type: application/json' -d \"{\\\"model\\\":\\\"chained-luna\\\",\$S}\"" ;;
    3b) echo "curl -sS -w 'status=%{http_code}' http://127.0.0.1:$PROXY_PORT/v1/systemone -H \"Authorization: Bearer \$LITELLM_MASTER_KEY\" -H 'Content-Type: application/json' -d \"{\\\"model\\\":\\\"chained-luna\\\",\$S,\\\"drop_params\\\":true}\"" ;;
  esac
}

first=1
for n in $REQS; do
  [ "$first" = 1 ] || sleep 8
  first=0
  before_lines=$(wc -l < "$WIRE_LOG" | tr -d ' ')
  cmd=$(req_cmd "$n")
  echo "== request $n"
  printf '$ %s\n' "$cmd"
  resp=$(eval "$cmd" 2>&1)
  code="${resp##*status=}"
  body="${resp%status=*}"
  echo "status=$code"
  echo "body[:400]=${body:0:400}"
  sleep 1
  echo "recorder lines:"
  tail -n +"$((before_lines + 1))" "$WIRE_LOG"
done
echo "== all recorder lines"
cat "$WIRE_LOG"

Observations

  • Gemini hop answers 400 on both legs, no provider
  • This PR leaves that alone, the LTS line lacks it
  • OpenAI hop answers 200 on both legs
  • Uvicorn ignores --num_workers 2 under --reload, one worker served

The ba799a9 proxy flag cases still hold, as its proxy file is unchanged

Proxy flag cases
Proxy case Before (5f1b6e4) After (ba799a9)
body-flag Flag ignored Flag ignored
fallback-flag Backup answers Backup answers

The proxy flag cases boot this line's proxy itself, once per tree, with --num_workers 2 and no database. body-flag sends use_litellm_proxy: true at the top level of a /v1/decisions body, and fallback-flag puts it in a request-body fallback target of a deployment with a bad OpenAI key. Both calls reach real OpenAI

Before (5f1b6e4)

== tree 5f1b6e4cca, git status lines 0, proxy workers 2

body-flag

+ curl -sS http://127.0.0.1:27537/v1/decisions -H @lts-smoke.hdr -H content-type: application/json -d {"model":"openai/gpt-6-luna","input":"The package arrived today and the screen is cracked down the middle.","questions":[{"type":"predicate","name":"is_defect","instructions":"Does the customer report a defective or damaged product?"}],"use_litellm_proxy":true}
{"model":"gpt-6-luna","answers":[{"type":"predicate","name":"is_defect","probability":1.0}],"usage":{"input_tokens":171,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens":0,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":171}}

fallback-flag

+ curl -sS http://127.0.0.1:27537/v1/decisions -H @lts-smoke.hdr -H content-type: application/json -d {"model":"broken-luna","input":"The package arrived today and the screen is cracked down the middle.","questions":[{"type":"predicate","name":"is_defect","instructions":"Does the customer report a defective or damaged product?"}],"fallbacks":[{"model":"openai/gpt-6-luna","use_litellm_proxy":true}]}
{"model":"gpt-6-luna","answers":[{"type":"predicate","name":"is_defect","probability":1.0}],"usage":{"input_tokens":171,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens":0,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":171}}

After (ba799a9)

== tree ba799a98da, git status lines 0, proxy workers 2

body-flag

+ curl -sS http://127.0.0.1:31389/v1/decisions -H @lts-smoke.hdr -H content-type: application/json -d {"model":"openai/gpt-6-luna","input":"The package arrived today and the screen is cracked down the middle.","questions":[{"type":"predicate","name":"is_defect","instructions":"Does the customer report a defective or damaged product?"}],"use_litellm_proxy":true}
{"model":"gpt-6-luna","answers":[{"type":"predicate","name":"is_defect","probability":1.0}],"usage":{"input_tokens":171,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens":0,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":171}}

fallback-flag

+ curl -sS http://127.0.0.1:31389/v1/decisions -H @lts-smoke.hdr -H content-type: application/json -d {"model":"broken-luna","input":"The package arrived today and the screen is cracked down the middle.","questions":[{"type":"predicate","name":"is_defect","instructions":"Does the customer report a defective or damaged product?"}],"fallbacks":[{"model":"openai/gpt-6-luna","use_litellm_proxy":true}]}
{"model":"gpt-6-luna","answers":[{"type":"predicate","name":"is_defect","probability":1.0}],"usage":{"input_tokens":171,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens":0,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":171}}

At 0f4d1f3, 81 decisions test files (15960 tests), the Playground tests (154) and make check pass. Without the picks, the new tests fail

/gauntlet-mini came back PARTIAL, and c0a4c2f and 7eaeba7 fix both findings

grype flags dnspython, filelock, pillow, soupsieve, tornado and diskcache in uv.lock. Main has the first five, and diskcache has no fixed release

Type

🐛 Bug Fix

Caveats (if any)

Copied from #51611 and #53195, re-read against this line

Medium

  • A key limited to /v1/decisions also needs /v1/systemone for proxied systemone calls and decisions health checks
  • A gap shared with main went to security engineering
  • Only unit tests prove a proxied answer with no confidence, since no live provider sends one
    • It reaches the caller as "confidence": null, as on main

Low

  • A proxied systemone call gets what a direct one there gets
    • TypeSafe refuses top-level images unless drop_params is set
  • A proxied call bills the proxy's cost with no margin and forwards its cost header, as chat does
  • litellm.adecisions returns no extra fields like decision_id on this line
  • Only a per-call drop_params reaches the next proxy
    • The proxy's own one for agentic CLI clients counts too
    • So does a deployment's own drop_params
    • No deployment flag turns audio or video off for the hop here
  • A litellm_proxy deployment needs a LiteLLM proxy as its api_base
    • Others answer systemone with 404 and per-call drop_params with 400
  • The next proxy logs systemone calls as asystemone
  • A too-deep body's 400 names another type
  • The complexity router now routes a TypeSafe answer with no confidence instead of failing, as on main
  • A string use_litellm_proxy like "true" passes the router's proxy checks, but the call goes to the provider, as on main
Decisions
  • The proxy key comes only from api_key or LITELLM_PROXY_API_KEY, so an OpenAI key is never sent to another host, and with neither set the call goes out with no authorization header. Chat's fallback to OPENAI_API_KEY and litellm.api_key was the alternative
  • A decisions call goes to the proxy's /v1/decisions and a systemone call to its /v1/systemone, each in the caller's shape. One endpoint for both was the alternative, but /v1/decisions flattens systemone criteria and refuses assets, and a systemone body has no prompt cache fields
  • The per-call use_litellm_proxy counts only when it is the boolean True. Lax coercion was the alternative, but it takes "yes" and raises on other strings mid-call
  • A safety_identifier goes to the proxy even when the client sets drop_params, and the call also sends the caller's drop_params, so the proxy drops it only for a deployment that cannot take it. Dropping it on the client was the alternative, but the client cannot tell which deployment the proxy picks
  • The 43da8f6 pick and the optional confidence it needs stay, so this line takes every answer a newer proxy sends, and the body maps every main commit. Dropping the pick was the alternative, since Parallel AI now sends a confidence, but a proxied Parallel AI answer with none would then fail after the proxy billed it. Optional types on the hop alone was another, but main types it optional for every provider and checks it per provider
  • With no readable x-litellm-response-cost header, the cost comes from the cost map, rather than logging none
  • The caller's drop_params means only the per-call flag. Also sending the global litellm.drop_params or the proxy's own setting was the alternative, but then a litellm_proxy deployment whose api_base is not a LiteLLM proxy failed every call with 400
  • A use_litellm_proxy or model_info in a decisions request body, at the top level or in a fallback target, is dropped, so the call runs as it did before this PR. Answering 400 was the alternative, but it would fail requests that worked

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
Bugbot summary

[!NOTE]
Medium Risk
Touches Decisions routing, credential resolution, proxy request sanitization, and response validation—incorrect behavior could misroute calls or bill wrongly, but scope is mostly additive with broad unit test coverage.

Overview
Adds LiteLLMProxyDecisionsConfig so Decisions and SystemOne traffic can route through a LiteLLM proxy (use_litellm_proxy, litellm_proxy/... models, or router deployments) using proxy base URL/key, separate OpenAI vs SystemOne request shaping, and billing from x-litellm-response-cost when present.

Proxy behavior changes: forwards audio/video/box questions, optional per-call drop_params (not global litellm.drop_params), and allows choice/score answers without confidence only for the proxy provider—other providers still error on missing confidence. Types, OpenAPI, JEV classifier, complexity router, and dashboard schemas/UI treat confidence as optional.

Proxy server: strips use_litellm_proxy from request bodies and nested fallback/router override entries.

Reviewed by Cursor Bugbot for commit 0f4d1f3. Bugbot is set up for automated code reviews on this repo. Configure here.

bofenghuang and others added 11 commits November 19, 2026 01:58
Backport of BerriAI#51611 to lts/1.108.x.
Cherry-picked from 8f651ba (litellm_decisions_litellm_proxy).
Adapted to the line: lts/1.108.x registers lazy imports in its tuple-and-map registry and resolves
decisions configs with per-provider ifs, and the test file gains main's single-answer predicate fixture.
Pass the per-call use_litellm_proxy flag into provider resolution so a router deployment flagged for the proxy sends Decisions to the proxy with its own key, and pin that litellm_proxy never falls back to OpenAI's base or key.

(cherry picked from commit db2afb5)
…uestions to the proxy

The proxy's /v1/decisions accepts audio and videos and checks each model's capabilities itself, so the litellm_proxy config forwards them and box questions instead of refusing them in the SDK. A deployment that sets one of these flags to false is still refused locally.

Adapted for lts/1.108.x, where the audio and video support hooks take no per-deployment flag, so a litellm_proxy call always forwards them and only box questions can be turned off per deployment.

(cherry picked from commit d1fa55b1acfaf8971846560bf5920e9ec6b92e5d)
…ll the proxy's cost

A systemone call now goes to the proxy's /v1/systemone unchanged, assets and
criteria included, and a decisions call keeps going to /v1/decisions. The
call's cost comes from the proxy's x-litellm-response-cost header, and the
missing-key error names LITELLM_PROXY_API_KEY. On the proxy, use_litellm_proxy
stays a deployment setting that a request body cannot set

This line's cost lookup keeps any float a provider reports, so the pick itself
drops a negative, NaN or infinite header and the call falls back to the model
price, as main's cost lookup already does

(cherry picked from commit c6f2379abe53ca80f221aa99abdbb941efd24962)
…calls

The proxy's /v1/systemone accepts safety_identifier, so the systemone hop now sends it instead of refusing the call or dropping the field under drop_params

(cherry picked from commit 787aa1cc33c2ca3b756bdf24d34b7214734061f3)
…images

A proxied call with no usable cost header now has to bill the same model price a direct call bills, a zero cost header has to bill zero, and the systemone call has to forward its images

(cherry picked from commit 7c0892dbd2d5b36d814155531e4e76ab54358f0e)
The decisions endpoints already drop use_litellm_proxy and model_info from the top level of a request body, since both are deployment settings. Fallback targets in the body now drop them too, in fallbacks, context_window_fallbacks, content_policy_fallbacks and the same lists under router_settings_override, so only deployment config turns the flag on

(cherry picked from commit e84aac682fe0920e54d189d2bf3599372cda8952)
…and allow a keyless proxy

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit abcbd7a)
A proxied decisions or systemone call with drop_params still failed when the proxy's deployment could not take safety_identifier, since the flag stayed on the client. The call now sends drop_params: true to the proxy, which drops what the deployment it picks cannot take

(cherry picked from commit ecc0180)
… key message

The hop sets api_key_required to False, which gates the only caller of missing_api_key_message, so the override never ran

(cherry picked from commit be5486c)
… hop

A proxy-wide or SDK-wide drop_params went to the upstream proxy on every hop call, so an upstream that is not a LiteLLM proxy refused the unknown parameter. The hop now gets drop_params only when the caller set it on that call, and the global setting stays on the client the way chat through litellm_proxy keeps it

(cherry picked from commit f09d530)
@zoveki
zoveki requested a review from a team November 20, 2026 21:45
@veria-ai

veria-ai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge

Summary

Adds litellm_proxy support for decisions and sends System One calls to the proxy's /v1/systemone. Calls use proxy credentials and the cost reported by the proxy

The latest change allows proxied choice and score answers without confidence. It also updates routing records, Playground badges and generated response types

  • SDK Decisions and SystemOne calls can travel through a LiteLLM proxy.
  • Decision request bodies no longer set deployment-only routing flags.
  • Choice and score answers can reach callers without confidence.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[SDK or Router call] --> B{Request shape}
  B -->|Decisions| C[Proxy /v1/decisions]
  B -->|System One| D[Proxy /v1/systemone]
  C --> E[Read answers and reported cost]
  D --> E
  E --> F[Return answer with optional confidence]
Loading

Reviews (2) · Last reviewed commit: "fix(decisions): pass on proxied answers ..." · Reviewed by Greptile

Comment thread litellm/decisions/call.py Resolved
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.93496% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...llm/llms/litellm_proxy/decisions/transformation.py 97.10% 2 Missing ⚠️
litellm/proxy/decisions_endpoints/endpoints.py 92.00% 2 Missing ⚠️
litellm/decisions/call.py 87.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

The proxy already checked each answer against its own deployment's provider, so a Parallel AI choice or score answer with no confidence now reaches the caller instead of failing after the proxy billed it

This line also gains main's optional-confidence check from BerriAI#49188, which the pick needs. A choice or score answer may now carry no confidence, every provider other than the litellm_proxy hop still answers 500 when it is missing, and the complexity router and the Playground leave the confidence out instead of failing

(cherry picked from commit 350afdffcfa4d9a4e1b315a5cc56bb0eb962af9c)
(cherry picked from commit 43da8f6)
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor

cursor Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — your team has an unpaid invoice

Bugbot is paused because your team has an unpaid invoice.

Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically.

(requestId: c0a95eb2-295d-4b0c-be77-25d043a44672)

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor

cursor Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — your team has an unpaid invoice

Bugbot is paused because your team has an unpaid invoice.

Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically.

(requestId: 58528733-7e49-4d23-a719-2fa7624e12af)

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor

cursor Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — your team has an unpaid invoice

Bugbot is paused because your team has an unpaid invoice.

Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically.

(requestId: 6cc5edb2-cb09-48f2-ba5a-e290daba4088)

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0f4d1f3. Configure here.

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mateo-berri
mateo-berri merged commit d0bbb3a into BerriAI:lts/1.108.x Nov 21, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants