litellm/litellm/types
Mateo Wang 0e1ff6ac23
fix: stop use_chat_completions_api flag from leaking into provider request body (#29447)
* fix: stop use_chat_completions_api flag from leaking into provider request body

use_chat_completions_api is a LiteLLM control flag that forces the
/responses -> /chat/completions bridge. It was missing from
all_litellm_params, so get_non_default_completion_params treated it as a
model-specific param and forwarded it to the upstream provider. A
model-level "use_chat_completions_api: true" in the proxy config therefore
reached the chat-completions path and was rejected by strict providers
(OpenAI/Anthropic) with HTTP 400 for an unknown body field.

Register it as a known internal param so it is stripped on every path
(completion, the responses bridge that calls litellm.completion, and
filter_out_litellm_params).

Adds a regression test driving litellm.completion() with a mocked OpenAI
client that asserts the flag never reaches the request body.

* test: clarify extra_body assertion in use_chat_completions_api leak test

Replace the misleading 'not in ... or {}' precedence idiom with an explicit
parenthesized guard that also handles extra_body being None.

(cherry picked from commit acbbfe9cae)
2026-06-02 16:34:11 -07:00
..
containers feat(containers): Azure routing, managed container IDs, delete response parsing (#25287) 2026-04-11 09:21:01 -07:00
google_genai fix(mypy): fix scattered 1-off type errors across 14 files 2026-03-13 00:08:57 +00:00
images merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
integrations style: apply black formatting 2026-04-20 16:02:21 -07:00
interactions build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
litellm_core_utils include server_tool_use in streaming usage (#16826) 2025-11-25 14:50:17 -08:00
llms fix(vertex_ai): omit function_call id on Vertex Gemini 3.5+ tool turns (#28324) 2026-06-02 16:34:11 -07:00
management_endpoints feat: routing groups ui 2026-05-04 18:09:14 -07:00
mcp_server feat(mcp): add delegate_auth_to_upstream flag for PKCE passthrough (#27834) 2026-05-13 12:06:13 -07:00
passthrough_endpoints refactor: define pass-through custom body state key in types module 2026-04-11 15:26:44 -07:00
prompts style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
proxy [Feat] Add endpoint for bulk key updates for team (#26468) 2026-05-09 19:32:16 +00:00
responses refactor: extract duplicated stdout/stderr → logs logic to shared helper 2026-03-18 22:05:27 -03:00
secret_managers style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
videos style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
access_group.py allow editing of access group names 2026-02-13 17:03:41 -08:00
adapter.py
agents.py fix(agents.tsx): support granting agents access to subagents 2026-03-10 21:03:20 -07:00
caching.py fix(caching): preserve prompt_tokens_details through embedding cache round-trip (#26653) 2026-04-28 08:25:11 -07:00
completion.py fix: correct CompletionRequest messages type to match OpenAI API spec (#12980) 2025-07-28 16:47:20 -07:00
compression.py Prompt Compression - add it to the proxy (#25729) 2026-04-20 15:08:00 -07:00
embedding.py
files.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
fine_tuning.py (feat) POST /fine_tuning/jobs support passing vertex specific hyper params (#7490) 2025-01-01 07:44:48 -08:00
guardrails.py feat: add ability to auth to azure with token (#27556) 2026-05-09 22:34:09 +00:00
mcp.py feat(mcp): add OBO MCP Auth (#27421) 2026-05-07 15:35:21 -07:00
memory_management.py feat(proxy): add /v1/memory CRUD endpoints (#26218) 2026-04-24 18:38:07 -07:00
policy_engine.py [Feat] New LiteLLM Policy engine - create policies to manage guardrails, conditions - permissions per Key, Team (#19612) 2026-01-22 19:49:53 -08:00
rag.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
realtime.py address greptile review feedback (greploop iteration 2) 2026-03-12 18:53:22 +05:30
rerank.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
router.py feat: selectively apply routing strategy according to model name 2026-05-04 13:27:32 -07:00
scheduler.py Squashed commit of the following: (#9709) 2025-04-02 21:24:54 -07:00
search.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
services.py [Fix] CI/CD - mypy & check_code_and_doc_quality & mcp_testing (#17920) 2025-12-13 08:18:43 -08:00
tag_management.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
tool_management.py Bug Fix: auto-inject prompt caching support for Gemini models (#21881) 2026-03-03 20:25:35 -08:00
utils.py fix: stop use_chat_completions_api flag from leaking into provider request body (#29447) 2026-06-02 16:34:11 -07:00
vector_store_files.py Vector store files Stable Release (#16643) 2025-11-15 13:00:33 -08:00
vector_stores.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00