diff --git a/.circleci/config.yml b/.circleci/config.yml index d2c4906ef6b..3019fabd6ff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1475,7 +1475,7 @@ jobs: - run: name: Run tests command: | - uv run --no-sync python -m pytest -v tests/otel_tests -x --junitxml=test-results/junit.xml --durations=5 + uv run --no-sync python -m pytest -v tests/otel_tests --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 15m # Clean up first container - run: @@ -1935,7 +1935,7 @@ jobs: name: Run Vertex AI, Google AI Studio Node.js tests command: | cd tests/pass_through_tests - npx jest . --verbose + NODE_OPTIONS=--experimental-vm-modules npx jest . --verbose no_output_timeout: 30m - run: name: Run tests @@ -2138,17 +2138,23 @@ jobs: - ~/.cache/uv - restore_cache: keys: - - ui-e2e-node-deps-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + - ui-e2e-node-deps-v2-{{ checksum "ui/litellm-dashboard/package-lock.json" }} - run: name: Install Node dependencies and Playwright + # The cimg/python:3.12-browsers image already ships the Chromium system + # libraries Playwright needs (libnss3, libatk-bridge2.0-0, libcups2, etc.). + # `--with-deps` triggers a redundant apt-get update + install that adds + # 5-10 minutes to the job and frequently stalls on flaky Ubuntu mirrors, + # so we install just the browser binary. command: | cd ui/litellm-dashboard npm ci - npx playwright install chromium --with-deps + npx playwright install chromium - save_cache: - key: ui-e2e-node-deps-v1-{{ checksum "ui/litellm-dashboard/package-lock.json" }} + key: ui-e2e-node-deps-v2-{{ checksum "ui/litellm-dashboard/package-lock.json" }} paths: - ui/litellm-dashboard/node_modules + - ~/.cache/ms-playwright - run: name: Build UI from source # Prior version used `cp -r out/ ../../litellm/proxy/_experimental/out/`. diff --git a/docker/Dockerfile.non_root b/docker/Dockerfile.non_root index ab40ee138e3..3fa73f42437 100644 --- a/docker/Dockerfile.non_root +++ b/docker/Dockerfile.non_root @@ -32,7 +32,6 @@ ENV UV_PROJECT_ENVIRONMENT=/app/.venv \ PATH="/app/.venv/bin:${PATH}" \ LITELLM_NON_ROOT=true \ PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \ - PRISMA_CLI_BINARY_TARGETS="debian-openssl-3.0.x" \ XDG_CACHE_HOME=/app/.cache # Copy dependency metadata first for layer caching @@ -114,7 +113,6 @@ COPY --from=builder /app/docker/supervisord.conf /etc/supervisord.conf ENV PATH="/app/.venv/bin:${PATH}" \ PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \ - PRISMA_CLI_BINARY_TARGETS="debian-openssl-3.0.x" \ HOME=/app \ LITELLM_NON_ROOT=true \ XDG_CACHE_HOME=/app/.cache \ diff --git a/litellm/llms/azure/azure.py b/litellm/llms/azure/azure.py index c0e070b6c1f..9291269d153 100644 --- a/litellm/llms/azure/azure.py +++ b/litellm/llms/azure/azure.py @@ -44,6 +44,7 @@ from .common_utils import ( select_azure_base_url_or_endpoint, ) from .image_generation import get_azure_image_generation_config +from .image_generation.http_utils import azure_deployment_image_generation_json_body class AzureOpenAIAssistantsAPIConfig: @@ -966,9 +967,10 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): content=json.dumps(result).encode("utf-8"), request=httpx.Request(method="POST", url="https://api.openai.com/v1"), ) + request_json = azure_deployment_image_generation_json_body(api_base, data) return await async_handler.post( url=api_base, - json=data, + json=request_json, headers=headers, ) @@ -1085,9 +1087,10 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): content=json.dumps(result).encode("utf-8"), request=httpx.Request(method="POST", url="https://api.openai.com/v1"), ) + request_json = azure_deployment_image_generation_json_body(api_base, data) return sync_handler.post( url=api_base, - json=data, + json=request_json, headers=headers, ) diff --git a/litellm/llms/azure/image_edit/transformation.py b/litellm/llms/azure/image_edit/transformation.py index dffa1c9eea5..0b6ecfb0767 100644 --- a/litellm/llms/azure/image_edit/transformation.py +++ b/litellm/llms/azure/image_edit/transformation.py @@ -9,6 +9,19 @@ from litellm.utils import _add_path_to_api_base class AzureImageEditConfig(OpenAIImageEditConfig): + @staticmethod + def azure_deployment_image_edit_form_data(data: dict, request_url: str) -> dict: + """ + Azure OpenAI ``.../openai/deployments/{deployment}/images/edits`` routes by + deployment in the URL; including ``model`` in multipart fields can break + the same way as image generations (LiteLLM #26316). + + Non-deployment edit URLs keep ``model`` when present. + """ + if "images/edits" in request_url and "/openai/deployments/" in request_url: + return {k: v for k, v in data.items() if k != "model"} + return data + def validate_environment( self, headers: dict, @@ -83,3 +96,8 @@ class AzureImageEditConfig(OpenAIImageEditConfig): final_url = httpx.URL(new_url).copy_with(params=query_params) return str(final_url) + + def finalize_image_edit_request_data( + self, data: dict, resolved_request_url: str + ) -> dict: + return self.azure_deployment_image_edit_form_data(data, resolved_request_url) diff --git a/litellm/llms/azure/image_generation/__init__.py b/litellm/llms/azure/image_generation/__init__.py index a9cf151464b..f60e446f0c4 100644 --- a/litellm/llms/azure/image_generation/__init__.py +++ b/litellm/llms/azure/image_generation/__init__.py @@ -6,11 +6,13 @@ from litellm.llms.base_llm.image_generation.transformation import ( from .dall_e_2_transformation import AzureDallE2ImageGenerationConfig from .dall_e_3_transformation import AzureDallE3ImageGenerationConfig from .gpt_transformation import AzureGPTImageGenerationConfig +from .http_utils import azure_deployment_image_generation_json_body __all__ = [ "AzureDallE2ImageGenerationConfig", "AzureDallE3ImageGenerationConfig", "AzureGPTImageGenerationConfig", + "azure_deployment_image_generation_json_body", ] diff --git a/litellm/llms/azure/image_generation/http_utils.py b/litellm/llms/azure/image_generation/http_utils.py new file mode 100644 index 00000000000..03c425eeffc --- /dev/null +++ b/litellm/llms/azure/image_generation/http_utils.py @@ -0,0 +1,17 @@ +"""HTTP helpers for Azure OpenAI image generation (REST, not SDK).""" + + +def azure_deployment_image_generation_json_body(api_base: str, data: dict) -> dict: + """ + Build the JSON body for Azure OpenAI image generation POSTs. + + For ``.../openai/deployments/{deployment}/images/generations``, routing uses the + deployment in the URL only; sending ``model`` in the body (especially the deployment + name) breaks some models (e.g. gpt-image-2). See LiteLLM #26316. + + Provider-style URLs (e.g. ``/providers/...`` for FLUX on Azure AI) keep all keys + so non–OpenAI-deployment payloads still work. + """ + if "images/generations" in api_base and "/openai/deployments/" in api_base: + return {k: v for k, v in data.items() if k != "model"} + return data diff --git a/litellm/llms/base_llm/image_edit/transformation.py b/litellm/llms/base_llm/image_edit/transformation.py index cea96bde74d..92429573ff8 100644 --- a/litellm/llms/base_llm/image_edit/transformation.py +++ b/litellm/llms/base_llm/image_edit/transformation.py @@ -102,6 +102,18 @@ class BaseImageEditConfig(ABC): ) -> Tuple[Dict, RequestFiles]: pass + def finalize_image_edit_request_data( + self, data: dict, resolved_request_url: str + ) -> dict: + """ + Last pass on the request dict after ``transform_image_edit_request``, using the + exact URL string used for the HTTP POST (same as ``get_complete_url`` output). + + The handler sends this dict as ``data=`` for multipart providers or ``json=`` + for JSON-only providers; default implementation returns ``data`` unchanged. + """ + return data + @abstractmethod def transform_image_edit_response( self, diff --git a/litellm/llms/base_llm/managed_resources/isolation.py b/litellm/llms/base_llm/managed_resources/isolation.py index 4298d044627..62027f4272c 100644 --- a/litellm/llms/base_llm/managed_resources/isolation.py +++ b/litellm/llms/base_llm/managed_resources/isolation.py @@ -11,8 +11,10 @@ unscoped query. from typing import Any, Dict, List, Optional -from litellm.proxy._types import UserAPIKeyAuth -from litellm.proxy.management_endpoints.common_utils import _user_has_admin_view +from litellm.proxy._types import ( + UserAPIKeyAuth, + user_api_key_has_admin_view as _user_has_admin_view, +) def build_list_page(items: List[Any], has_more: bool = False) -> Dict[str, Any]: diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index 0c4816fcda2..2ffc7acbfb1 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -5579,6 +5579,9 @@ class BaseLLMHTTPHandler: litellm_params=litellm_params, headers=headers, ) + data = image_edit_provider_config.finalize_image_edit_request_data( + data, api_base + ) ## LOGGING logging_obj.pre_call( @@ -5677,6 +5680,9 @@ class BaseLLMHTTPHandler: litellm_params=litellm_params, headers=headers, ) + data = image_edit_provider_config.finalize_image_edit_request_data( + data, api_base + ) ## LOGGING logging_obj.pre_call( diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.html index 7271449e128..1ad9a6e249e 100644 --- a/litellm/proxy/_experimental/out/404.html +++ b/litellm/proxy/_experimental/out/404.html @@ -1 +1 @@ -