Commit graph

9 commits

Author SHA1 Message Date
Sameer Kankute
447502b409
fix(image_edit): read vertex_project/location from litellm_params in Imagen get_complete_url
VertexAIImagenImageEditConfig.get_complete_url was resolving vertex_project
and vertex_location only from env vars and global settings, ignoring
litellm_params. Users supplying project/location exclusively via YAML
config would get a ValueError or wrong URL even after auth headers were fixed.

Mirrors the pattern already used by VertexAIGeminiImageEditConfig and
image_generation counterpart (safe_get_vertex_ai_project/location).

Also fixes api_key type hint in MockImageEditConfig (str -> Optional[str])
and adds a test covering get_complete_url credential resolution.

Made-with: Cursor
2026-04-21 15:03:40 +05:30
Sameer Kankute
a7512764af
test(image_edit): add regression tests for credentials forwarding
Adds three test cases to prevent regression of the Vertex AI image_edit
credentials bug:

1. test_validate_environment_signature_includes_litellm_params: ensures
   all image-edit configs accept litellm_params (contract for the handler)
2. test_vertex_gemini_image_edit_reads_credentials_from_litellm_params:
   verifies Gemini config reads from litellm_params first
3. test_vertex_imagen_image_edit_reads_credentials_from_litellm_params:
   verifies Imagen config reads from litellm_params first

These tests catch if the fix is accidentally reverted or if new image-edit
configs are added without the litellm_params parameter.

Made-with: Cursor
2026-04-21 14:58:47 +05:30
Sameer Kankute
dff4bfd735
fix(image_edit): forward litellm_params to validate_environment for Vertex AI credentials
When aimage_edit or image_edit was called with Vertex AI Gemini/Imagen models
via YAML-style config (vertex_project / vertex_credentials in proxy YAML),
the credentials were dropped during handler-to-config plumbing, causing
fallback to Application Default Credentials and DefaultCredentialsError.

Root cause: image_edit_handler and async_image_edit_handler did not pass
litellm_params to validate_environment, unlike image_generation_handler.

Fixes:
1. Widen BaseImageEditConfig.validate_environment signature to accept
   litellm_params and api_base (optional kwargs).
2. Forward dict(litellm_params) and litellm_params.api_base from both
   sync and async image_edit handlers to validate_environment.
3. Update VertexAIImagenImageEditConfig.validate_environment to read
   vertex_ai_project/vertex_ai_credentials from litellm_params first,
   matching Gemini config pattern (secondary latent bug fix).
4. Widen all image-edit config override signatures to match base.

Made-with: Cursor
2026-04-21 14:54:18 +05:30
Ishaan Jaffer
e8461b5b97
style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
Krish Dholakia
ca4329aeb9
Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659)
* fix: Fixes https://github.com/BerriAI/litellm/issues/23185

* fix(responses/main.py): ensure litellm metadata custom cost works

* refactor: move all logging updates to a common function, to have just 1 place to update logging kwarg updates
2026-03-15 23:21:01 -07:00
Cesar Garcia
734655137e
Merge pull request #22307 from Chesars/fix/22244-image-edit-custom-pricing
fix(images): pass model_info/metadata in image_edit for custom pricing
2026-02-27 16:38:34 -03:00
Chesars
727adb0117 fix(images): pass model_info and metadata in image_edit for custom pricing
image_edit was not forwarding model_info/metadata to the logging object,
so custom_pricing was never detected. After PR #20679 stripped custom
pricing fields from the shared backend key, image_edit cost became 0.

Fixes #22244
2026-02-27 16:23:23 -03:00
Chesars
dc4f713c6d fix(images): forward extra_headers on OpenAI code path in image_generation()
Fixes #22285 — extra_headers passed to litellm.image_generation() were
silently dropped on the openai/litellm_proxy/openai_compatible_providers
code path. The azure and azure_ai paths already forwarded them correctly.
2026-02-27 15:17:58 -03:00
Curtis
d1c6eb3a7c
fix(image_edit): add drop_params support and fix Vertex AI config (#18077) 2025-12-17 11:28:34 +05:30