Skip to content

fix(proxy)!: return provider-matching 4xx for the LIT-8062 status code follow-ups - #45537

Merged
yucheng-berri merged 27 commits into
mainfrom
litellm_lit8062_status_code_followups
Oct 13, 2026
Merged

yucheng-berri merged 27 commits into
mainfrom
litellm_lit8062_status_code_followups

Conversation

@yucheng-berri

@yucheng-berri yucheng-berri commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

  • OCR request parse errors raise a 400 invalid_request_error
  • Router defaults stop satisfying params the Router binds positionally
  • Invalid max_output_tokens, date ranges and attributes reach the 400 path

Intentional product change: reversed daily-activity date ranges, max_output_tokens <= 0 on /v1/responses, and more than 16 vector store file attributes now return 400 where they used to return 200 with a silently changed request

User Flow

Before: a developer who sends a bad request gets a 500 and assumes the gateway is down, or gets a 200 for a request the provider would reject

  1. They send POST https://litellm-domain/v1/ocr as multipart with no file part, or with an empty file
  2. They get a 500 internal_server_error and retry
  3. On a proxy with router_settings.default_litellm_params.prompt set, POST /v1/images/generations with no prompt also returns 500 (missing 1 required positional argument), and so do speech, text completions and moderations
  4. POST /v1/responses with max_output_tokens: 0 returns 200 because the gateway quietly raised it to 16, and GET /team/daily/activity with end_date before start_date returns an empty 200

After: the same requests come back as client errors that say what to fix

  1. They send the same POST https://litellm-domain/v1/ocr with no file part, or an empty file
  2. They get a 400 invalid_request_error with param: "file" and the same message
  3. The image, speech, text completion and moderation requests return 400 Missing required parameter naming the param
  4. /v1/responses returns OpenAI's own 400 (Expected a value >= 16, but got 0), and the daily activity call returns 400 end_date must be on or after start_date

Linear ticket

Resolves LIT-8062

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
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

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

Real OpenAI and Anthropic calls, no mocks. Three proxy configs, all with master_key: sk-lit8062:

  • the default config: gpt-4o (openai/gpt-4o-mini), azure/doc-intel (an Azure Document Intelligence OCR deployment), plus a real OpenAI vector store and file
  • the router-defaults config: gpt-image-1, gpt-4o-mini-tts, instruct (openai/gpt-3.5-turbo-instruct) and anthropic.claude-haiku-4-5, with router_settings.default_litellm_params: {prompt: "a red square", input: "router default input", max_tokens: 32} and allow_client_side_credentials: true

The /usage/ai/chat cases run on the default config with gpt-4o as the chat model and real spend rows in Postgres; the model is asked to quote the tool's result verbatim, and only the tool event and the model's answer are shown from the stream

Bodies are cut at about 230 characters where they run long

Before (9e2aae8, the merge base)

OCR multipart with no file

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/ocr -H 'Authorization: Bearer sk-lit8062' -F model=azure/doc-intel
  1. Observe
{"error":{"message":"Multipart OCR request must include a 'file' field with the document to process","type":"internal_server_error","param":null,"code":"500"}}
500

OCR multipart with an empty file

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/ocr -H 'Authorization: Bearer sk-lit8062' -F model=azure/doc-intel -F 'file=@empty.pdf'
  1. Observe
{"error":{"message":"Uploaded file is empty","type":"internal_server_error","param":null,"code":"500"}}
500

/v1/responses with max_output_tokens 0

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/responses -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","input":"Say pong","store":false,"max_output_tokens":0}'
  1. Observe
{"id":"resp_t3h9vWDQrZU6pBHJOQE9Jro9lJtVTbQYEsWIdgytoMpn7hBWZ-TN6JXNkZXI7Ot5k-u1OWiSGBa_YiTTau15T6mGaUBMNfsp5TewcJbL46NlZyKWYCdbuNld3JR5QH24ew1x2Suszl5KMBVwQ5PNe-r-bDBchi_KFm7fU5SZdceFXagIeWXN-tQ_TsamiJcwTt4DN6KRcS6MKzO02mxPKrCTKw ...
200

/v1/responses with max_output_tokens -1

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/responses -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","input":"Say pong","store":false,"max_output_tokens":-1}'
  1. Observe
{"id":"resp_1e_PGleoNmtUK0XjyLlYXpVLHYQ55OH-gG0xAuBSLrgFBkccm0gYqGK341RLs4JYbuB58mxFiP8zZz18Nqcp4ZQPt8otcAi0iDtm33-C32H1DA2I4d8Rc6VK4YRN3Nl8VhUIXj_1q8ikJdu_dZU-YWw85kt-cfpwGR_BckTH8S7e-F6_zkpEmVFV0MqONGsz_b2VT1qIt_kdsmrydGSx97EpUk ...
200

/team/daily/activity with end_date before start_date

  1. Run the request
curl -s -w '\n%{http_code}' 'localhost:4000/team/daily/activity?start_date=2026-10-01&end_date=2026-09-24&page=1' -H 'Authorization: Bearer sk-lit8062'
  1. Observe
{"results":[],"metadata":{"total_spend":0.0,"total_flat_cost":0.0,"total_prompt_tokens":0,"total_completion_tokens":0,"total_tokens":0,"total_api_requests":0,"total_successful_requests":0,"total_failed_requests":0,"total_cache_rea ...
200

Vector store file update with 17 attributes

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/vector_stores/vs_6acd31d92b2c8191b55eeab5c493813b/files/file-JWZRC1Ubai1NLwvRZzVfEz -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"attributes":{"key_00": "v", "key_01": "v", "key_02": "v", "key_03": "v", "key_04": "v", "key_05": "v", "key_06": "v", "key_07": "v", "key_08": "v", "key_09": "v", "key_10": "v", "key_11": "v", "key_12": "v", "key_13": "v", "key_14": "v", "key_15": "v", "key_16": "v"}}'
  1. Observe
{"id":"file-JWZRC1Ubai1NLwvRZzVfEz","object":"vector_store.file","usage_bytes":1111,"created_at":1791832538,"vector_store_id":"vs_6acd31d92b2c8191b55eeab5c493813b","status":"completed","last_error":null,"chunking_strategy":{"type" ...
200

/v1/images/generations with no prompt, router default prompt set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/images/generations -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-image-1","quality":"low"}'
  1. Observe
{"error":{"message":"Router.aimage_generation() missing 1 required positional argument: 'prompt'","type":"internal_server_error","param":null,"code":"500"}}
500

/v1/audio/speech with no input, router default input set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/audio/speech -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o-mini-tts","voice":"alloy"}'
  1. Observe
{"error":{"message":"Router.aspeech() missing 1 required positional argument: 'input'","type":"None","param":"None","code":"500"}}
500

/v1/completions with no prompt, router default prompt set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/completions -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"instruct","max_tokens":5}'
  1. Observe
{"error":{"message":"Router.atext_completion() missing 1 required positional argument: 'prompt'","type":"None","param":"None","code":"500"}}
500

/v1/moderations with no input on an unlisted model, router default input set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/moderations -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"omni-moderation-2024-09-26"}'
  1. Observe
{"error":{"message":"'input'","type":"None","param":"None","code":"500"}}
500

/v1/messages with user_config: null

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/messages -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"anthropic.claude-haiku-4-5","messages":[{"role":"user","content":"Say hi"}],"user_config":null}'
  1. Observe
{"type":"error","error":{"type":"api_error","message":"'NoneType' object has no attribute 'items'"}}
500

/usage/ai/chat, team usage tool called with end_date before start_date

  1. Run the request
curl -sN -w '\n%{http_code}' localhost:4000/usage/ai/chat -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Call get_team_usage_data once with start_date 2026-10-12 and end_date 2026-10-01 exactly as written, then reply with only the exact text the tool returned, verbatim, in double quotes."}]}'
  1. Observe
data: {"type": "tool_call", "tool_name": "get_team_usage_data", "tool_label": "team usage data", "arguments": {"start_date": "2026-10-12", "end_date": "2026-10-01"}, "status": "complete"}
(the model's answer, chunk events joined) "No Team usage data found for the given date range."
200

/usage/ai/chat, team usage tool called with a date that is not YYYY-MM-DD

  1. Run the request
curl -sN -w '\n%{http_code}' localhost:4000/usage/ai/chat -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Call get_team_usage_data once with start_date 2026-13-01 and end_date 2026-13-05 exactly as written, then reply with only the exact text the tool returned, verbatim, in double quotes."}]}'
  1. Observe
data: {"type": "tool_call", "tool_name": "get_team_usage_data", "tool_label": "team usage data", "arguments": {"start_date": "2026-13-01", "end_date": "2026-13-05"}, "status": "error"}
(the model's answer, chunk events joined) "Error fetching team usage data. Please try again."
200

/usage/ai/chat, team usage tool called with a valid range (control)

  1. Run the request
curl -sN -w '\n%{http_code}' localhost:4000/usage/ai/chat -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Call get_team_usage_data once with start_date 2026-10-01 and end_date 2026-10-12 exactly as written, then reply with only the exact text the tool returned, verbatim, in double quotes."}]}'
  1. Observe
data: {"type": "tool_call", "tool_name": "get_team_usage_data", "tool_label": "team usage data", "arguments": {"start_date": "2026-10-01", "end_date": "2026-10-12"}, "status": "complete"}
(the model's answer, chunk events joined) "Team Usage (1 teams):

- Unassigned (ID: Unassigned): $0.0002 | 61 reqs | 525 tokens"
200

After (4ec07c5, the PR tip)

OCR multipart with no file

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/ocr -H 'Authorization: Bearer sk-lit8062' -F model=azure/doc-intel
  1. Observe
{"error":{"message":"Multipart OCR request must include a 'file' field with the document to process","type":"invalid_request_error","param":"file","code":"400"}}
400

OCR multipart with an empty file

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/ocr -H 'Authorization: Bearer sk-lit8062' -F model=azure/doc-intel -F 'file=@empty.pdf'
  1. Observe
{"error":{"message":"Uploaded file is empty","type":"invalid_request_error","param":"file","code":"400"}}
400

/v1/responses with max_output_tokens 0

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/responses -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","input":"Say pong","store":false,"max_output_tokens":0}'
  1. Observe
{"error":{"message":"litellm.BadRequestError: OpenAIException - {\n  \"error\": {\n    \"message\": \"Invalid 'max_output_tokens': integer below minimum value. Expected a value >= 16, but got 0 instead.\",\n    \"type\": \"invalid ...
400

/v1/responses with max_output_tokens -1

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/responses -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","input":"Say pong","store":false,"max_output_tokens":-1}'
  1. Observe
{"error":{"message":"litellm.BadRequestError: OpenAIException - {\n  \"error\": {\n    \"message\": \"Invalid 'max_output_tokens': integer below minimum value. Expected a value >= 16, but got -1 instead.\",\n    \"type\": \"invali ...
400

/team/daily/activity with end_date before start_date

  1. Run the request
curl -s -w '\n%{http_code}' 'localhost:4000/team/daily/activity?start_date=2026-10-01&end_date=2026-09-24&page=1' -H 'Authorization: Bearer sk-lit8062'
  1. Observe
{"detail":{"error":"end_date must be on or after start_date"}}
400

Vector store file update with 17 attributes

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/vector_stores/vs_6acd31d92b2c8191b55eeab5c493813b/files/file-JWZRC1Ubai1NLwvRZzVfEz -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"attributes":{"key_00": "v", "key_01": "v", "key_02": "v", "key_03": "v", "key_04": "v", "key_05": "v", "key_06": "v", "key_07": "v", "key_08": "v", "key_09": "v", "key_10": "v", "key_11": "v", "key_12": "v", "key_13": "v", "key_14": "v", "key_15": "v", "key_16": "v"}}'
  1. Observe
{"error":{"message":"litellm.BadRequestError: OpenAIException - {\n  \"error\": {\n    \"message\": \"Invalid 'attributes': too many properties. Expected an object with at most 16 properties, but got an object with 17 properties i ...
400

/v1/images/generations with no prompt, router default prompt set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/images/generations -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-image-1","quality":"low"}'
  1. Observe
{"error":{"message":"/image/generations: Missing required parameter: 'prompt'.","type":"invalid_request_error","param":"prompt","code":"400"}}
400

/v1/audio/speech with no input, router default input set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/audio/speech -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o-mini-tts","voice":"alloy"}'
  1. Observe
{"error":{"message":"/audio/speech: Missing required parameter: 'input'.","type":"invalid_request_error","param":"input","code":"400"}}
400

/v1/completions with no prompt, router default prompt set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/completions -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"instruct","max_tokens":5}'
  1. Observe
{"error":{"message":"/completions: Missing required parameter: 'prompt'.","type":"invalid_request_error","param":"prompt","code":"400"}}
400

/v1/moderations with no input on an unlisted model, router default input set

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/moderations -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"omni-moderation-2024-09-26"}'
  1. Observe
{"error":{"message":"/moderations: Missing required parameter: 'input'.","type":"invalid_request_error","param":"input","code":"400"}}
400

/v1/messages with user_config: null

  1. Run the request
curl -s -w '\n%{http_code}' localhost:4000/v1/messages -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"anthropic.claude-haiku-4-5","messages":[{"role":"user","content":"Say hi"}],"user_config":null}'
  1. Observe
{"model":"anthropic.claude-haiku-4-5","id":"msg_011Cfxt3ESiAox5QR1WTA2sS","type":"message","role":"assistant","content":[{"type":"text","text":"Hi! 👋 How can I help you today?"}],"container":null,"stop_reason":"end_turn","stop_seq ...
200

/usage/ai/chat, team usage tool called with end_date before start_date

  1. Run the request
curl -sN -w '\n%{http_code}' localhost:4000/usage/ai/chat -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Call get_team_usage_data once with start_date 2026-10-12 and end_date 2026-10-01 exactly as written, then reply with only the exact text the tool returned, verbatim, in double quotes."}]}'
  1. Observe
data: {"type": "tool_call", "tool_name": "get_team_usage_data", "tool_label": "team usage data", "arguments": {"start_date": "2026-10-12", "end_date": "2026-10-01"}, "status": "complete"}
(the model's answer, chunk events joined) "Invalid date range: end_date must be on or after start_date"
200

/usage/ai/chat, team usage tool called with a date that is not YYYY-MM-DD

  1. Run the request
curl -sN -w '\n%{http_code}' localhost:4000/usage/ai/chat -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Call get_team_usage_data once with start_date 2026-13-01 and end_date 2026-13-05 exactly as written, then reply with only the exact text the tool returned, verbatim, in double quotes."}]}'
  1. Observe
data: {"type": "tool_call", "tool_name": "get_team_usage_data", "tool_label": "team usage data", "arguments": {"start_date": "2026-13-01", "end_date": "2026-13-05"}, "status": "complete"}
(the model's answer, chunk events joined) "Invalid date range: start_date and end_date must be valid YYYY-MM-DD dates"
200

/usage/ai/chat, team usage tool called with a valid range (control)

  1. Run the request
curl -sN -w '\n%{http_code}' localhost:4000/usage/ai/chat -H 'Authorization: Bearer sk-lit8062' -H 'Content-Type: application/json' -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Call get_team_usage_data once with start_date 2026-10-01 and end_date 2026-10-12 exactly as written, then reply with only the exact text the tool returned, verbatim, in double quotes."}]}'
  1. Observe
data: {"type": "tool_call", "tool_name": "get_team_usage_data", "tool_label": "team usage data", "arguments": {"start_date": "2026-10-01", "end_date": "2026-10-12"}, "status": "complete"}
(the model's answer, chunk events joined) "Team Usage (1 teams):

- Unassigned (ID: Unassigned): $0.0002 | 71 reqs | 543 tokens"
200

Dashboard (Logs page, head)

Each failed request below was found on the Logs page by its request id and its detail panel opened. OCR errors now write a failed-request row with the 400 instead of a 500

case row detail
OCR document.type: file over JSON
OCR empty file
image, no prompt, router default set
speech, no input, router default set
text completion, no prompt, router default set
Responses max_output_tokens: 0, OpenAI's 400
vector store file with 17 attributes, OpenAI's 400

Walkthrough of the same flow:

Audit run (4ec07c5 vs the merge base 9e2aae8)

The 5 tests/integration/compatibility/test_status_code_followups*.py files (208 cells) ran on a real proxy, Postgres, Redis and the scripted upstream:

  • head, run 1 and run 2: 200 passed, identical per-cell results, no retries. 8 cells are skipped as pre-existing bugs (see Caveats)
  • base: 56 cells fail, each one a change listed under Behavior changes. Nothing that passes on base fails on head
  • chaos, proxy at 2 workers: a provider outage mid burst on chat, messages and responses (JSON and stream) gives each call a 200 or a 500 with an error body, other keys and the health check keep serving, and after recovery every call succeeds with exactly one provider call and one spend row. A killed worker does not stop the other one, and the respawned worker serves
  • live cells against real OpenAI on both trees: max_output_tokens 0 and -1 and 17 vector store attributes give 200 on base and OpenAI's 400 on head; values 1 and 15, 16 attributes and model-less requests behind * -> openai/* match base (OpenAI's own 400/404 for None/None and "")

Breaking change

Callers who relied on the gateway quietly fixing these requests now get a 400 and need to send valid values: daily-activity routes with end_date before start_date, /v1/responses with max_output_tokens of 0 or less, and OpenAI vector store files with more than 16 attributes. Fix the request (swap the dates, send max_output_tokens >= 16, send at most 16 attributes); nothing else changes for requests that were already valid.

Behavior changes

Removed / renamed

None

Intentional contract changes

  • Daily activity routes (/{user,team,tag,organization,customer,end_user,agent}/daily/activity and /user/daily/activity/aggregated) with end_date before start_date: 200 with empty results -> 400 end_date must be on or after start_date. The date check runs before the permission check, as it already did for malformed dates, so a service-account key sending reversed dates to /user/daily/activity/aggregated now gets this 400 instead of the 403
  • /v1/responses with max_output_tokens of 0 or less: the gateway used to raise it to 16 and return 200. It now sends the value as-is, so OpenAI returns its 400. This includes chat requests bridged to Responses with max_tokens 0 or -1, /v1/messages to an OpenAI model with max_tokens: -1, and max_output_tokens: false (sent as-is, so OpenAI rejects the boolean). Values 1 to 15 (and true) are still raised to 16
  • OpenAI vector store file create/update with more than 16 attributes: used to be silently cut to 16 keys with a 200. All keys are now sent and OpenAI returns its 400
  • OCR request parse errors (no file, empty file, file over the size limit, empty or invalid JSON body, type: file, reducto:// ids): 500 -> 400 invalid_request_error, with param: "file" where it applies. These now also fire the failure callbacks and write a failed-request row to the Logs page, like other proxy-side 4xx errors
  • router_settings.default_litellm_params (and user_config defaults, and deployment-level params) no longer count as supplying prompt/input/file on image generation, speech, text completion and transcription, where the Router takes them positionally. Those requests used to 500 with a TypeError and now return 400
  • /v1/moderations only counts router defaults for models get_model_list lists, matching where the Router merges them. Requests to an unlisted moderation model that used to 500 with KeyError: 'input' now return 400. Every other route counts router defaults for any named model, as on main. A moderation request without input for another team's internal model name was already a 400 and now says Missing required parameter: 'input' instead of There are no healthy deployments for this model
  • user_config: null (with client-side credentials allowed) is treated as absent instead of returning 400/500
  • The /usage/ai/chat team and tag tools share the daily-activity date check, so when the model picks reversed dates or dates that are not YYYY-MM-DD, the tool now tells it Invalid date range: <reason> instead of an empty dataset (reversed) or Error fetching ... Please try again. (not YYYY-MM-DD). The global usage tool, whose query takes its dates without that check, answers exactly as on main

Silent regressions to watch

None. Earlier heads also added a proxy-side model check in front of * -> openai/* wildcards and a "does the router serve this model" check for router defaults. Each review round found requests that main served and those checks blocked (fallback chains, aliases, prompt managers, deployment hooks, Claude Code session routers), because the proxy was guessing what the router would do. f894ecb removes both checks, so those requests behave exactly as on main: a model-less request behind a forwarding wildcard reaches the provider and gets its own status (OpenAI's 404 for None/None), and router defaults count for any named model except on moderation

Regression tests

  • tests/integration/compatibility/test_status_code_followups.py runs every case above against a real proxy and scripted upstream, and checks the outbound body or that no provider call was made
  • test_status_code_followups_usage_chat.py drives /usage/ai/chat with a scripted model that picks reversed, invalid-month, slash-separated and valid dates
  • tests/integration/compatibility/test_status_code_followups_{defaults,requests,chaos}.py are the audit matrix: every mode the fix branches on, through raw HTTP and the OpenAI and Anthropic SDKs, sync and async, plus the outage and killed-worker chaos cells
  • tests/unit/proxy/test_route_llm_request.py pins the router-default check for each positional route, user_config and deployment-level params, unlisted moderation models, and a null user_config
  • Unit cases in the mapped OCR, daily activity, responses and vector store file test files. Every new behavioral unit test fails on main
  • Mutations run against route_llm_request.py, all killed by the unit file: ignore the positional set for deployment params, drop the positional set from the no-merge routes, drop the moderation listed-model check, keep a null user_config

Type

Bug Fix
Test

Caveats (if any)

Medium

  • Three cases from the ticket are left unchanged by product decision:
    • Configure Sweep #27 temperature: null on /v1/messages returns 200 (Anthropic returns 400). The gateway drops null params on purpose, so forwarding them would turn today's 200s into 400s
    • Add testing for sentry breadcrumbs #21 GET /v1/responses/{unknown id} with a virtual key returns 403 from the response-id security hook (OpenAI returns 404). This is the hook working as designed; allow_unmanaged_response_ids: true turns it off
    • Code clean up #23 POST /v1/files with no file/purpose returns FastAPI's 422 (OpenAI returns 400). Every FastAPI-validated form route answers 422 today
  • update docs on new way of calling llm_client #25 (max_tokens: 0 on /v1/messages) and updating version #31 (empty vector store search query) are not gateway bugs: the providers themselves return 200

Low

  • With a router default set, an image, speech, text completion or transcription request to an unknown model without the param now says Missing required parameter instead of Invalid model name. Both are 400, and this matches main without a router default
  • A missing or null model behind a forwarding wildcard (* -> openai/*) still sends None/None to the provider and returns its status, and "" is still forwarded as sent, both as on main. Not in the ticket's list of mismatches
  • Vector store file attributes still drop number and boolean values, as on main
  • Pre-existing on main, unchanged here, and pinned as skipped BUG cells in the audit files: a router-wide default prompt/input replaces the caller's own value on image, text completion and speech; a JSON array body returns 500 on every route from the auth pre-checks; /gateway/daily/activity still returns 200 for a reversed date range
  • Azure and the other providers that reuse the OpenAI Responses config now get max_output_tokens <= 0 as sent. Only the outbound request was checked for them

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

ran /live-pr-risk and found no regressions/backward incompatible risks

REVIEWER MUST KNOW BEFORE APPROVING

  • Three 200s become 400s on purpose (reversed daily-activity dates, max_output_tokens <= 0 on Responses, including /v1/messages to an OpenAI model with max_tokens: -1, and more than 16 vector store file attributes). In each case the gateway used to change the request silently instead of rejecting it
  • The router-default check in route_llm_request.py changes in two places only: positionally bound params never count router, user_config or deployment defaults, and moderation only counts router defaults for listed models. A new Router method that takes a required param positionally has to be added to _ROUTE_TYPES_WITH_POSITIONAL_REQUIRED_PARAM
  • Cases Add testing for sentry breadcrumbs #21, Code clean up #23 and Configure Sweep #27 are left as they are by product decision (see Caveats)

… follow-ups

- OCR multipart errors are 400 invalid_request_error on the file param
- a missing model is a 400 on chat, responses and messages even with a wildcard deployment
- responses max_output_tokens <= 0 reaches the provider instead of being raised to 16
- daily activity rejects end_date before start_date with a 400
- vector store file attributes are sent in full so the provider enforces its key limit
- router-wide defaults no longer satisfy a param the Router takes positionally, or a model the router does not serve
- a JSON null user_config is treated as absent
…lose router-default gaps

- a missing model is rejected only when the wildcard would forward it into the target
- moderation only counts router defaults for models get_model_list lists
- user_config defaults and deployment params never satisfy a positionally bound param

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread litellm/proxy/route_llm_request.py Resolved
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the outstanding session-routing finding is fixed.

Summary

The PR returns clearer client errors for malformed requests instead of silently changing them or returning server errors.

  • Missing request fields and model names now get checked before routing.
  • Malformed OCR uploads and bodies now return request errors.
  • Responses requests keep non-positive token limits for provider validation.
  • Vector-store file requests send all string attributes to OpenAI.
  • Daily activity rejects reversed dates and usage tools explain date errors.

Reviews (18) · Last reviewed commit: "fix(proxy): skip the wildcard model chec..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 2 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 31 untouched benchmarks


Comparing litellm_lit8062_status_code_followups (4ec07c5) with main (ac98cab)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (7af7919) during the generation of this report, so ac98cab was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
litellm/proxy/route_llm_request.py 81.81% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Drives every mode the fix branches on through a real proxy, Postgres, Redis and
the scripted upstream: positional params against router, deployment and
user_config defaults; moderation listed vs unlisted; unknown and a2a models;
every user_config shape on chat, responses and messages, streaming and SDK
clients; forwarding vs fixed-target wildcards for missing, null and empty
models; Responses max_output_tokens edges; OCR parse errors; vector store file
attributes; every daily activity route; and a provider outage mid burst plus a
killed worker on a two-worker proxy. Product gaps found are skipped as BUG.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

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.

Stale Bugbot comment from a previous run.

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

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.

Stale Bugbot comment from a previous run.

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

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.

Stale Bugbot comment from a previous run.

Comment thread litellm/proxy/route_llm_request.py Resolved
Comment thread litellm/proxy/route_llm_request.py Resolved
…e session

Read the session's router binding, as the router does, instead of only
checking that the request could resume one, so a subagent turn without a
model on an unbound session is still rejected before a forwarding
wildcard sends it upstream.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

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.

Stale Bugbot comment from a previous run.

- drop the wildcard missing-model gate: a model-less request behind a forwarding wildcard goes to the router and gets the provider's own status, as on main
- drop the "model the router serves" check: router defaults count for any named model again, except moderation, where the Router merges them only for listed models
- keep the positional-param, moderation and null user_config fixes
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

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.

Stale Bugbot comment from a previous run.

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

/litereview code-review

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

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.

Stale Bugbot comment from a previous run.

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

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 4ec07c5. Configure here.

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@litereview

litereview Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

⚠️ code-review

Scope: full · Full PR review.

Review incomplete.

Merge readiness: BLOCKED

E2E evidence: BLOCKED. One narrow gap remains. The PR shows no real end-to-end run of the /usage/ai/chat invalid-date tool behavior, and that code changed after the live transcripts were captured. The other behavior changes are verified, either by my own run against a real proxy on this head or by live provider transcripts taken on commits whose implementation files match this head.

Score: 4/5. I found no correctness defects. The evidence gap is the only blocker.

Correctness findings

None. I traced each change from its caller to the response the user sees:

  • route_llm_request.py
    • _find_missing_required_body_param runs in _route_request_single_attempt before dispatch.
    • Router.aimage_generation, aspeech, atext_completion and atranscription take prompt/input/file as positional arguments. Router defaults, user_config defaults and deployment params therefore can never supply those params, and the new _ROUTE_TYPES_WITH_POSITIONAL_REQUIRED_PARAM exclusion is correct.
    • For moderation, _pass_through_moderation_endpoint_factory merges deployment params only when get_model_list(model) returns something. The new model_listed gate mirrors that.
    • The code pops user_config: None before the "user_config" in data branch, so it can no longer reach _route_user_config_request and fail on .items().
  • OCR: OCRRequestError is a ProxyException with code=400. It is raised inside the try, so handle_llm_api_exception returns it as a 400 and logs it.
  • Daily activity: the reversed-range check moved into parse_canonical_date_range. That function feeds get_daily_activity and both _date_range_error branches, so the duplicate check removed from aggregated_date_range_error adds no gap.
  • Responses / vector store: 0 &lt; max_output_tokens &lt; 16 still raises values 1–15 to 16. _visible_attributes copies the old filter without the 16-key truncation.

Breaking change

The three new 400s change observable behavior: reversed date ranges, max_output_tokens &lt;= 0, and more than 16 attributes. The title carries fix(proxy)!:, and the description explains the impact and how to migrate. The marker is present and correct.

Standards

I found no documented-standard violations in the source changes.

Judgement calls, not blockers:

  • Possible Shotgun Surgery: anyone adding a new Router method that binds a required param positionally must also update _ROUTE_TYPES_WITH_POSITIONAL_REQUIRED_PARAM. The PR acknowledges this.
  • Redundant import: from litellm.proxy._types import ProxyException sits beside the existing star import in ocr_endpoints/endpoints.py.

Spec

LIT-8062 itself was not accessible. I used the PR description as the spec.

E2E gate details

What I verified myself on head 4ec07c5f: I ran litellm --config with router_settings.default_litellm_params set to prompt, input and max_tokens, then sent real HTTP requests:

Request Result
OCR with no file 400, param: file
OCR with an empty file 400, param: file
OCR with invalid JSON 400
/v1/images/generations with no prompt 400, param: prompt
/v1/audio/speech with no input 400, param: input
/v1/completions with no prompt 400, param: prompt
/v1/moderations on an unlisted model with no input 400, param: input
user_config.default_litellm_params.prompt with no prompt 400
user_config: null with client-side credentials allowed The request routed to real OpenAI and returned its 401 for a fake key, not a 400/500

What I accepted from the PR: live OpenAI transcripts on cb97794cb2 for max_output_tokens 0 and -1 and for 17 attributes, plus the reversed /team/daily/activity range. Through the GitHub API, I confirmed that responses/transformation.py, vector_store_files/transformation.py and common_daily_activity.py last changed in commit 68ef690755, before cb97794cb2. Their implementation matches head.

Still missing:

  • /usage/ai/chat: the PR claims the tool now returns Invalid date range: &lt;reason>. ai_usage_chat.py changed in f894ecbe2a, after the live transcripts. The only evidence is a summary of integration cells that use a scripted model and scripted upstream, with no output attached.
    • What would satisfy it: a captured /usage/ai/chat run on head (or a commit with identical code) against a real model and DB. It should show the tool result for a reversed range and for a non-YYYY-MM-DD date, plus a valid-range control.
  • Audit-run artifacts: the "208 cells, 200 passed" claim has no CI artifacts or logs attached, so I could not inspect it.

Couldn’t complete

  • The required E2E gate is not fully met. The PR has no real, inspectable end-to-end run on current code for the /usage/ai/chat invalid-date tool message (ai_usage_chat.py changed in f894ecbe2a, after the live transcripts). The integration audit claims (208 cells) have no attached artifacts.

  • Mandatory E2E evidence gate: Verified:

  • I ran OCR, router-default/positional, moderation and user_config cases on head against a real local proxy.

  • The PR's live OpenAI transcripts cover Responses max_output_tokens &lt;= 0, 17 vector store attributes and the reversed daily-activity range. They were captured on cb97794cb2, and the implementation files are unchanged from there to head.

Unverified:

  • The /usage/ai/chat invalid-date tool message. ai_usage_chat.py changed after the live transcripts, and the only evidence is a summary of scripted-model integration cells with no attached output.
Checks and execution details
  • Not run · Mandatory E2E evidence gate (required): Verified:

  • I ran OCR, router-default/positional, moderation and user_config cases on head against a real local proxy.

  • The PR's live OpenAI transcripts cover Responses max_output_tokens &lt;= 0, 17 vector store attributes and the reversed daily-activity range. They were captured on cb97794cb2, and the implementation files are unchanged from there to head.

Unverified:

  • The /usage/ai/chat invalid-date tool message. ai_usage_chat.py changed after the live transcripts, and the only evidence is a summary of scripted-model integration cells with no attached output.

  • Passed · Targeted unit tests (optional): uv run --frozen pytest on test_route_llm_request.py, OCR test_endpoints.py, test_common_daily_activity.py, the vector store files and responses transformation tests, and test_ai_usage_chat.py: 465 passed.

  • Passed · Live proxy run on head (no provider needed) (optional): Ran litellm --config with router default_litellm_params and sent curl requests:

  • OCR with no file, empty file and bad JSON returned 400.

  • Image, speech, completions and unlisted-model moderation requests without the required param returned 400 naming the param.

  • A user_config default prompt with no prompt returned 400.

  • user_config: null routed through to OpenAI (401 for a fake key) instead of failing with 400/500.

  • Passed · Commit provenance of PR evidence (optional): GitHub API:

  • cb97794cb2...f894ecbe2a touches only route_llm_request.py and ai_usage_chat.py under litellm/.

  • f894ecbe2a...4ec07c5f34 adds only the main merge and an OCR unit-test commit.

  • The responses, vector store and daily-activity source files last changed in 68ef690755.

  • Not run · Daily activity and real-provider cases rerun locally (optional): No Postgres or OpenAI credentials are available in this sandbox. I relied on the PR's live transcripts for files unchanged since they were captured.


View review · Reviewed 4ec07c5f3430

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@litereview

litereview Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

✅ code-review

Scope: full · Full PR review.

Completed · Some checks not run.

Merge readiness: READY

E2E evidence: VERIFIED. The PR includes before and after curl runs against a live proxy. The before runs use merge base 9e2aae8490 and the after runs use head 4ec07c5f34, which is the reviewed SHA. The runs call real OpenAI, Azure Document Intelligence and Anthropic deployments and record exact commands, status codes and bodies. The PR also links Logs-page screenshots. I downloaded the image-generation detail screenshot and it shows the 400 Missing required parameter: 'prompt' failure row.

Score: 4/5. I found no correctness defects. The score stays below 5 because a few failure branches have no live-run evidence. Those branches share code with the cases that were demonstrated.

Correctness findings

None. I traced each change from caller to observable result:

  • OCR
    • OCRRequestError subclasses ProxyException.
    • The ocr() handler sends it through handle_llm_api_exception, which passes ProxyException through unchanged (common_request_processing.py:3842). The client gets a 400 invalid_request_error.
  • Positional router params
    • Router.aimage_generation(prompt, model, ...), aspeech, atext_completion and atranscription bind the param positionally. The Router merges defaults later, in _update_kwargs_with_default_litellm_params and in _aimage_generation's **data.
    • Router, user_config and deployment defaults therefore never supplied the param. Excluding them from _find_missing_required_body_param matches what dispatch actually does.
  • Moderation
    • _pass_through_moderation_endpoint_factory merges deployment params only when get_model_list(model_name=...) returns a match.
    • The new model_listed gate mirrors that check. Deployment params were already counted only for listed models.
  • user_config: null: the router now pops the key before the "user_config" in data branch, so the request goes through the main router.
  • Date ranges
    • The reversed-range check moved into parse_canonical_date_range. get_daily_activity, _date_range_error and aggregated_date_range_error all pick it up, and raise_public turns it into a 400.
    • In /usage/ai/chat, the tool loop catches only a 400 with a {"error": str} detail. It re-raises every other HTTPException.
  • Responses and vector store
    • 0 &lt; max_output_tokens &lt; 16 still gets clamped to 16. Values of 0 or below go to the provider unchanged.
    • _visible_attributes keeps the old string-only and hidden_params filtering and drops only the truncation to 16 keys.

Breaking change

The PR has three real contract changes: reversed daily-activity ranges, max_output_tokens &lt;= 0 on Responses, and more than 16 vector store attributes now return 400 where they used to return 200. The title carries fix(proxy)!:, and the description has a "Breaking change" section with migration steps. That meets the requirement.

Standards

I checked the diff against AGENTS.md:

  • Pyright suppressions name a rule and give a reason (AGENTS.md:67).
  • Final annotations are used throughout.

Judgement calls, not blockers:

  • ocr_endpoints/endpoints.py adds from litellm.proxy._types import ProxyException right after from litellm.proxy._types import *. This is harmless and keeps the import explicit for type checkers.
  • One new OCR unit test monkeypatches the module constant _MAX_FILE_BYTES. AGENTS.md:83 discourages monkeypatching class attributes. This is a module constant, so it's only a minor smell.

Spec

LIT-8062 isn't attached. I used the PR's own list of ticket cases as the requirements. The diff implements every claimed behavior change. The PR explicitly defers #21, #23 and #27 by product decision, and the description says why. I found no unrequested behavior beyond the documented user_config: null and /usage/ai/chat follow-ons.

Remaining verification gaps (optional)

The PR doesn't show these OCR parse errors live: file over the size limit, invalid or empty JSON body, and reducto:// ids. They use the same OCRRequestError path as the no-file and empty-file cases, which it does show. /v1/audio/transcriptions without file is never reachable over HTTP, because FastAPI's File(...) returns 422 first. That change is defensive.

Checks and execution details
  • Passed · Mandatory E2E evidence gate (required): I inspected the PR's before and after curl transcripts. They use base 9e2aae8490 and head 4ec07c5f34, which matches the reviewed SHA, against a live proxy calling real OpenAI, Azure Doc Intel and Anthropic. Covered cases:

  • OCR with no file and with an empty file

  • max_output_tokens 0 and -1

  • reversed daily-activity range

  • 17 vector store attributes

  • image, speech, completions and moderations with router defaults set

  • user_config: null

  • three /usage/ai/chat tool cases

I downloaded one linked Logs-page screenshot (06_image-missing-prompt-detail) and confirmed it shows the 400 failure row.

  • Passed · Unit tests for changed files (optional): uv run --frozen pytest -n 4 ran on test_route_llm_request.py, OCR test_endpoints.py, test_common_daily_activity.py, test_ai_usage_chat.py, the responses transformation tests and the vector store files transformation tests: 465 passed. The environment was set up with uv sync --frozen --group proxy-dev --extra proxy.

  • Not run · Integration audit suite (tests/integration/compatibility/test_status_code_followups*.py) (optional): These tests need a running proxy, Postgres, Redis and the scripted upstream. I didn't run them here. The live-provider curl evidence already satisfies the E2E gate.

  • Passed · Caller/consumer trace (optional): I traced these paths in the source:

  • Router.aimage_generation and _aimage_generation default merge order

  • _pass_through_moderation_endpoint_factory listed-model gate

  • handle_llm_api_exception's ProxyException passthrough

  • parse_canonical_date_range callers in daily_activity_routes.py, team_endpoints.py and common_daily_activity.py

  • add_openai_metadata compared with _visible_attributes


View review · Reviewed 4ec07c5f3430

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@litereview full

@litereview

litereview Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

✅ full

Scope: full · Full PR review.

Completed · Some checks not run.

Verdict: no actionable defects found

I traced each changed item to its dependents and found no break that the PR doesn't already declare as intentional. The title carries the ! breaking-change marker, which fits the three behavior changes listed below.

What I checked

  • Router-default check for positional params (litellm/proxy/route_llm_request.py)
    • Router.aimage_generation(prompt, model, ...), aspeech(model, input, ...), atext_completion(model, prompt, ...) and atranscription(file, model, ...) all take the required param positionally. Neither router defaults nor deployment litellm_params can satisfy it, so returning {} and ignoring deployment params for _ROUTE_TYPES_WITH_POSITIONAL_REQUIRED_PARAM is correct.
    • The user_config throwaway Router dispatches the same way, so moving the early return ahead of the user_config branch is also correct.
    • For moderation, _pass_through_moderation_endpoint_factory merges defaults only through _update_kwargs_with_deployment, and only when get_model_list(model) returns a deployment. model_listed=bool(candidate_litellm_params) follows that rule.
    • Popping user_config: None happens after the param check, which already treats a non-Mapping value as absent. That keeps the request off the _route_user_config_request branch.
  • OCR (ocr_endpoints/endpoints.py)
    • OCRRequestError subclasses ProxyException.
    • handle_llm_api_exception re-raises a ProxyException unchanged, so the endpoint now returns 400 invalid_request_error.
    • No other code catches the ValueErrors that were replaced (the only except ValueError left is the req_format parser).
  • Daily-activity date ranges
    • The reversed-range check moved into parse_canonical_date_range. That changes behavior for every get_daily_activity caller: team, user, org, tag, customer, agent, and ai_usage_chat.
    • This is the "reversed ranges now 400" change the PR announces. team_endpoints.aggregated_date_range_error keeps the same message through the shared parser.
    • _invalid_date_reason only maps a 400 whose detail is {"error": str}, which is the shape raise_public produces. Anything else is still re-raised.
  • Responses max_output_tokens &lt;= 0
    • This now passes through unchanged for all OpenAIResponsesAPIConfig subclasses, as announced. None and positive values below 16 behave as before.
  • Vector store file attributes
    • Attributes are no longer trimmed to 16, as announced.
    • Dropping non-string values and hidden_params behaves the same as before.
    • The removed pop branch never ran, because add_openai_metadata never returned None for a dict.

Minor note, not a defect: the vector-store attribute filter still drops numeric and boolean values that OpenAI accepts. The old code did the same, so this is not a regression.

Live proxy A/B: not run. I had no Postgres, real provider credentials, or proxy rig in this sandbox. Everything above comes from reading the code plus the unit tests below, not from observing a running proxy.

Checks and execution details
  • Passed · Mapped unit tests at PR head (optional): Installed the environment with uv sync --frozen --all-extras --dev, then ran uv run --no-sync pytest tests/unit/proxy/test_route_llm_request.py tests/unit/proxy/ocr_endpoints/test_endpoints.py tests/unit/proxy/management_endpoints/test_common_daily_activity.py tests/unit/llms/openai/vector_store_files tests/unit/llms/openai/responses/test_openai_responses_transformation.py tests/unit/proxy/management_endpoints/usage_endpoints/test_ai_usage_chat.py. Result: 465 passed.
  • Passed · Dependency trace of changed symbols (required): Traced the callers of parse_canonical_date_range and get_daily_activity across 8 endpoints. Checked the Router positional signatures, the moderation passthrough's default-merge rule, handle_llm_api_exception's handling of ProxyException, the subclasses of OpenAIResponsesAPIConfig, and the vector-store file transform call sites.
  • Not run · Live base-vs-head proxy A/B with real Postgres and real providers (optional): This sandbox had no provider credentials, Postgres, or proxy rig. Not run.

View review · Reviewed 4ec07c5f3430

@yucheng-berri
yucheng-berri merged commit 784581b into main Oct 13, 2026
93 checks passed
@yucheng-berri
yucheng-berri deleted the litellm_lit8062_status_code_followups branch October 13, 2026 18:42
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.

2 participants