litellm/tests/test_litellm/proxy/openai_files_endpoint
Sameer Kankute 41801d65bd
feat(proxy): add require_managed_files setting for file uploads (#30186)
* feat(proxy): add require_managed_files setting for file uploads

Add an opt-in litellm_settings flag that rejects POST /v1/files without target_model_names, and parse target_model_names[] from OpenAI SDK list extra_body.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(proxy): return clean require_managed_files error message

Use a plain HTTPException detail string so create_file does not stringify a dict, and import UploadFile at module scope.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(proxy): preserve repeated target_model_names[] form fields

Read target_model_names from the raw multipart form instead of the
dict(form_data)-collapsed request body so repeated target_model_names[]
fields (how the OpenAI SDK serialises a list extra_body) keep every
value rather than truncating to the last one. Drops the now-unreachable
list branch in the value parser.

* fix(proxy): reject model param to close require_managed_files bypass

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-06-12 07:25:28 -07:00
..
test_files_endpoint.py feat(proxy): add require_managed_files setting for file uploads (#30186) 2026-06-12 07:25:28 -07:00