From 590142afa6bc1135b40e94b9bf06337cc14e1a10 Mon Sep 17 00:00:00 2001 From: AtsutoNakayama Date: Tue, 8 Sep 2026 00:09:09 +0900 Subject: [PATCH] fix(proxy): correct stale image_generation route label, drop inert type:ignore ROUTE_ENDPOINT_MAPPING has mapped aimage_generation to the singular /image/generations since 2024, but every registered route is plural (/v1/images/generations, /images/generations, .../images/generations). The new missing-prompt guard surfaced this stale label for the first time, so correct it to /images/generations. Also drop two # type: ignore[override] comments added in the new image_generation regression test: basedpyright's enableTypeIgnoreComments is false here, so they suppressed nothing. --- litellm/proxy/route_llm_request.py | 2 +- tests/test_litellm/proxy/image_endpoints/test_endpoints.py | 6 +++--- tests/test_litellm/proxy/test_route_llm_request.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/route_llm_request.py b/litellm/proxy/route_llm_request.py index c90da10f03e..5c96c75d2c8 100644 --- a/litellm/proxy/route_llm_request.py +++ b/litellm/proxy/route_llm_request.py @@ -77,7 +77,7 @@ ROUTE_ENDPOINT_MAPPING: Final = { "acompletion": "/chat/completions", "atext_completion": "/completions", "aembedding": "/embeddings", - "aimage_generation": "/image/generations", + "aimage_generation": "/images/generations", "aspeech": "/audio/speech", "atranscription": "/audio/transcriptions", "amoderation": "/moderations", diff --git a/tests/test_litellm/proxy/image_endpoints/test_endpoints.py b/tests/test_litellm/proxy/image_endpoints/test_endpoints.py index c806b06c019..f3a1fab9a31 100644 --- a/tests/test_litellm/proxy/image_endpoints/test_endpoints.py +++ b/tests/test_litellm/proxy/image_endpoints/test_endpoints.py @@ -129,14 +129,14 @@ async def test_image_generation__missing_required_param_is_400(monkeypatch): async def fake_add_litellm_data_to_request(**kwargs): return kwargs["data"] - async def fake_pre_call_hook(*, user_api_key_dict, data, call_type): # type: ignore[override] + async def fake_pre_call_hook(*, user_api_key_dict, data, call_type): return data async def fake_post_call_failure_hook(**_: Any) -> None: return None - async def fake_route_request(*, data, **kwargs): # type: ignore[override] - raise ProxyMissingRequiredParamError(route="/image/generations", param="prompt") + async def fake_route_request(*, data, **kwargs): + raise ProxyMissingRequiredParamError(route="/images/generations", param="prompt") fake_proxy_logger = SimpleNamespace( pre_call_hook=fake_pre_call_hook, diff --git a/tests/test_litellm/proxy/test_route_llm_request.py b/tests/test_litellm/proxy/test_route_llm_request.py index 343cc6ebc60..31b835107be 100644 --- a/tests/test_litellm/proxy/test_route_llm_request.py +++ b/tests/test_litellm/proxy/test_route_llm_request.py @@ -1048,7 +1048,7 @@ async def test_route_request_override_enable_tag_filtering_beats_body_value(): ("acreate_batch", "input_file_id", "/batches"), ("aspeech", "input", "/audio/speech"), ("amoderation", "input", "/moderations"), - ("aimage_generation", "prompt", "/image/generations"), + ("aimage_generation", "prompt", "/images/generations"), ], ) @pytest.mark.parametrize(