Commit graph

49 commits

Author SHA1 Message Date
Chesars
8a85a2cf82 Merge branch 'litellm_oss_staging_02_27_2026' of https://github.com/BerriAI/litellm into litellm_oss_staging_02_27_2026 2026-02-28 09:54:56 -03: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
a08e5195e5 fix: put image_edit_request_params spread first to avoid overwriting model_info/metadata 2026-02-27 16:26:11 -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
Zero Clover
a1c939b2ef
fix(image_generation): propagate extra_headers to OpenAI image generation
Add headers parameter to image_generation() and aimage_generation() methods
in OpenAI provider, and pass headers from images/main.py to ensure custom
headers like cf-aig-authorization are properly forwarded to the OpenAI API.
Aligns behavior with completion() method and Azure provider implementation.
2026-02-25 01:29:06 +08:00
Sameer Kankute
49b2886ef0 Add None as default image value 2026-01-19 09:08:38 +05:30
Sameer Kankute
0a15f1b66a Fix: stability image optional para 2026-01-19 09:05:52 +05:30
Sameer Kankute
bc8abf8b4b Add support for openrouter image generation endpoint 2026-01-14 10:15:02 +05:30
Sameer Kankute
d88bc13006 Add support for image generation via azure ad token 2025-12-24 15:15:20 +05:30
Sameer Kankute
e39376c54b fix lint error 2025-12-19 23:39:37 +05:30
Sameer Kankute
98382bdb93 Fix mypy errors 2025-12-19 23:21:20 +05:30
Sameer Kankute
248eb4ea49 Minor bug fixes: mask list 2025-12-19 23:04:53 +05:30
Sameer Kankute
5feb6d5388 Add support for stability speicifc params in request 2025-12-19 23:03:17 +05:30
Sameer Kankute
b849f51e58 Add support for stability model in image edit 2025-12-19 23:03:17 +05:30
Sameer Kankute
b09ea08424 Add stability models for image edit 2025-12-19 23:03:17 +05:30
Curtis
d1c6eb3a7c
fix(image_edit): add drop_params support and fix Vertex AI config (#18077) 2025-12-17 11:28:34 +05:30
Alexsander Hamir
9b440caac2
Lazy load ImageEditRequestUtils in images/main.py to avoid heavy import (#18074)
- Remove direct import of ImageEditRequestUtils from images.utils
- Add __getattr__ handler to lazy load ImageEditRequestUtils when accessed
- Create _get_ImageEditRequestUtils() helper function with caching
- Use importlib instead of sys to avoid importing sys inside functions
- Update image_edit() to use helper function for accessing ImageEditRequestUtils
- Add TYPE_CHECKING import for proper type hints

This defers the heavy import from images.utils until ImageEditRequestUtils is actually needed, improving import time when from .images.main import * is executed.
2025-12-16 12:28:33 -08:00
Cesar Garcia
df19a747a2
feat(custom_llm): add image_edit and aimage_edit support (#17999)
* feat(custom_llm): add image_edit and aimage_edit support

Add support for image_edit and aimage_edit methods in CustomLLM class,
allowing users to implement custom image editing providers.

Changes:
- Add image_edit() and aimage_edit() methods to CustomLLM base class
- Add custom provider detection in litellm.image_edit() function
- Add tests for sync and async image_edit with custom handlers

* docs: add image_edit to CustomLLM documentation

- Add /v1/images/edits to supported routes
- Add Image Edit section with example
- Update Custom Handler Spec with image_edit methods
2025-12-15 14:16:36 -08:00
Cesar Garcia
bd1a075a89
feat(stability): add Stability AI image generation support (#17894)
Add direct Stability AI REST API support for image generation endpoints.
This enables using Stability's SD3, SD3.5, and Stable Image models via
LiteLLM's OpenAI-compatible interface.

Changes:
- Add STABILITY provider to LlmProviders enum
- Create StabilityImageGenerationConfig with multipart/form-data support
- Add OpenAI size to Stability aspect_ratio mapping
- Register provider in ProviderConfigManager
- Add 9 Stability models to model_prices_and_context_window.json
- Add documentation at docs/providers/stability.md
- Add 25 unit tests

Supported models:
- stability/sd3, sd3-large, sd3-large-turbo, sd3-medium
- stability/sd3.5-large, sd3.5-large-turbo, sd3.5-medium
- stability/stable-image-ultra, stable-image-core
2025-12-14 08:29:45 +05:30
Alexsander Hamir
56328e6535
[Refactor#2] litellm/init – Lazy-load utils to reduce memory + import time (#17171)
* fix: lazy load utils.py imports

Lazy-load most functions and response types from utils.py to avoid loading
tiktoken and other heavy dependencies at import time. This significantly
reduces memory usage when importing completion from litellm.
2025-12-03 11:40:16 -08:00
Ishaan Jaffer
5cfcc98d2e fix img gen 2025-11-26 17:56:59 -08:00
Alexsander Hamir
eacf20fddb
Merge branch 'main' into litellm_refactor_01 2025-11-26 08:56:40 -08:00
Sameer Kankute
29ab291cf5 Add vertex ai image support 2025-11-25 13:31:16 +05:30
AlexsanderHamir
863b2267f2 remove comment 2025-11-24 17:01:58 -08:00
AlexsanderHamir
b4b8133d47 refactor: litellm init file #1 2025-11-24 16:59:56 -08:00
pnookala-godaddy
44bb18a6ba
fix: forward OpenAI organization for image generation (#16607) 2025-11-13 21:51:27 -08:00
Ishaan Jaff
b30439257b
[Feat] Add RunwayML Img Gen API support (#16557)
* TestRunwaymlImageGeneration

* fix RUNWAYML

* rename

* fix rename

* get_runwayml_image_generation_config

* get_runwayml_image_generation_config

* TestRunwaymlImageGeneration

* add RUNWAYML_POLLING_TIMEOUT

* fix rnwayml transform img gen

* runwayml_image_cost_calculator

* runwayml_image_cost_calculator

* docs runwayml

* fix runwayML polling

* test_get_first_default_fallback
2025-11-12 18:20:14 -08:00
Ishaan Jaff
99feefd614
[Feat] Add FAL AI Image Generations on LiteLLM (#16067)
* add fal-ai provider

* fix image_generation_handler

* init FalAIImageGenerationConfig

* init cost_calculator

* init FAL AI

* TestFAL_AI_ImageGeneration

* fix load_custom_provider_entrypoints

* TestFAL_AI_ImageGeneration

* add imagen4 transform FAL AI

* add FAL AI imagen 4 transform

* BaseImageGenTest

* test_fal_ai_image_generation_basic

* add BRIA + Recraft img gen

* add recraft + BRIA

* test_fal_ai_image_generation_basic

* tests for flux PRO v11

* Add FAL AI SD

* test FAL AI SD

* docs FAL AI

* docs fal ai

* Using Model-Specific Parameters

* add fal ai model prices

* add fall_ai JPG logo

* ui fixes FAL AI

* fix linting

* fix linting

* fix bedrock test_get_request_body_stability3

* test_custom_llm_provider_entrypoint
2025-10-29 13:10:51 -07:00
Byron Grogan
bf47c25de0
[fix] Pass user-defined headers and extra_headers to image-edit calls (#15811) 2025-10-23 15:08:10 -07:00
Krrish Dholakia
db14edfbdd fix(main.py): remove image edit optional param from image generation 2025-09-06 11:24:25 -07:00
Ishaan Jaff
f35ce02475
[Bug Fix] LLM Translation - Allow using dynamic api_key for image generation requests (#14007)
* fix - allow using dyanmic api key for img gen

* test_aiml_image_generation_with_dynamic_api_key
2025-08-27 10:51:24 -07:00
Krish Dholakia
3ed1220f75
Merge pull request #13916 from mubashir1osmani/openai-multiple-images
feat: multiple images in openai images/edits endpoint
2025-08-25 23:11:13 -07:00
mubashir1osmani
2fa8f971e0 feat: multiple images in openai images/edits endpoint 2025-08-23 19:13:32 -04:00
Ishaan Jaff
835879bc85 fix: img gen 2025-08-23 14:03:11 -07:00
Ishaan Jaff
9750374081
[Feat] New LLM API - AI/ML API for Image Gen (#13893)
* add LlmProviders.AIML

* add AIMLChatConfig

* add aiml

* fix AimlImageGenerationConfig

* add AimlImageGenerationConfig

* add cost_calculator

* fixes for AI ML API

* add known AIML Flux image models

* add AIML Cost Calc

* add AI/ML API

* add aiml_models
2025-08-23 13:12:44 -07:00
Ishaan Jaff
ba0881d728
[Bug Fix] image_edit() function returns APIConnectionError with litellm_proxy - Support for both image edits and image generations (#13735)
* add image edits litellm proxy on SDK

* add image gen provider

* add IMG Gen support for litellm_proxy provider
2025-08-18 18:26:32 -07:00
Ishaan Jaff
76d25926d4
[Feat] New provider - Azure AI Flux Image Generation (#13592)
* init files

* add AzureFoundryModelInfo

* fix api_version property

* add azure_ai img gen

* use AzureFoundryModelInfo

* get_base_image_generation_call_args

* add azure_ai/FLUX-1.1-pro

* add util for route_image_generation_cost_calculator

* docs azure ai flux

* fixes for flux

* fixes for AzureFoundryFluxImageGenerationConfig

* ruff fix
2025-08-13 17:20:30 -07:00
Michael Verunica
37e57a0e5f
fix(azure): remove trailing semicolon in Content-Type header for image generation (#13584) 2025-08-13 09:43:02 -07:00
Ishaan Jaff
a8371d2cb1
[Feat] Add Google AI Studio Imagen4 model family (#13065)
* add gemini

* add init files

* add get_gemini_image_generation_config

* refactor transform

* TestGoogleImageGen

* fix transform

* fix transform

* add gemini_image_cost_calculator

* add cost tracking for gemini/imagen models

* docs image gen

* docs image gen

* test_get_model_info_gemini
2025-07-28 21:25:40 -07:00
Ishaan Jaff
03baf23ad1 [Feat] Add Recraft Image Generation API Support - New LLM Provider (#12832)
* add recraft

* init RecraftImageGenerationConfig

* add get_complete_url + validate_environment

* add image_generation_handler in llm http clas

* fixes for transform

* working recraft request

* fixed img gen transform

* fixes for llm http handler

* test: TestRecraftImageGeneration

* fixes for llm_http_handler

* fix RecraftImageGenerationConfig

* TestRecraftImageGenerationTransformation

* add recraft API

* docs recraft API

* fix code QA

* map_openai_params

* fix recraft

* cost tracking for recraft/recraftv3

* fix code qa check
2025-07-21 22:19:58 -07:00
Krish Dholakia
e4e10aa4ed
Litellm dev 07 21 2025 p1 (#12848)
* fix(main.py): fix async retryer

Fixes https://github.com/BerriAI/litellm/issues/12830

* fix(forward_clientside_headers_by_model_group.py): filter out 'content-type' from forwardable headers

clientside content-type != proxy content type, can cause requests to hang

* test(tests/): update tests
2025-07-21 22:09:39 -07:00
Ishaan Jaff
2941a555a8
[Feat] Add Recraft Image Generation API Support - New LLM Provider (#12832)
* add recraft

* init RecraftImageGenerationConfig

* add get_complete_url + validate_environment

* add image_generation_handler in llm http clas

* fixes for transform

* working recraft request

* fixed img gen transform

* fixes for llm http handler

* test: TestRecraftImageGeneration

* fixes for llm_http_handler

* fix RecraftImageGenerationConfig

* TestRecraftImageGenerationTransformation

* add recraft API

* docs recraft API

* fix code QA

* map_openai_params

* fix recraft

* cost tracking for recraft/recraftv3

* fix code qa check
2025-07-21 15:01:32 -07:00
Cole McIntosh
b2080ec9af
feat: add input_fidelity parameter for OpenAI image generation (#12662)
* feat: add input_fidelity parameter for OpenAI image generation

- Add input_fidelity to OpenAIImageGenerationOptionalParams type
- Update image_generation function signature to accept input_fidelity
- Add input_fidelity to default_params in get_optional_params_image_gen
- Include input_fidelity in openai_params list for proper handling
- Update documentation with input_fidelity parameter description
- Add test for input_fidelity parameter functionality

This enables control over how closely the model follows the input prompt
for gpt-image-1 model, improving prompt adherence and image quality.

* feat: add input_fidelity to optional parameters for image generation

- Include input_fidelity in the list of OpenAIImageGenerationOptionalParams
- This addition enhances the flexibility of image generation by allowing control over input fidelity.

* test: enhance test for gpt-image-1 with input_fidelity parameter

- Update test_gpt_image_1_with_input_fidelity to include mocking of OpenAI response
- Validate that the OpenAI client is called with correct parameters, including input_fidelity
- Improve response validation to ensure expected output structure and values
2025-07-16 16:56:05 -07:00
Ishaan Jaff
b0003bd03c
Feat(bedrock): support api key authentication for AWS Bedrock API (#12426) (#12495)
* add support of bearer token for bedrock integration

* fix linting issue

* fix type checking issue

* reoder arguments to address type checking issue

* switch to use get_secret_str to fetch env variable

Co-authored-by: 0x-fang <fanggong@amazon.com>
2025-07-10 15:12:17 -07:00
Krrish Dholakia
1cd97e41e9 test: update tests 2025-05-24 12:26:31 -07:00
Ishaan Jaff
702b5fec22
[Feat] Add /image/edits on LiteLLM (#11123)
* feat: add image edits on litellm router

* feat: add image edits endpoint

* fix: use pure async for image edits

* fix: base_process_llm_request

* fix: get_image_content_type

* feat: add image edits endpoint

* add image edits on UI

* test: image edits support

* fix: linting errors

* fix: linting errors

* test fix img gen
2025-05-24 10:18:01 -07:00
Ishaan Jaff
8d7e234efd
[Feat] Add content policy violation error mapping for image editd (#11113)
* feat: add image edit mapping for content policy violations

* test fix
2025-05-23 21:57:43 -07:00
Ishaan Jaff
e5d278c454
[Feat] Add Image Edits Support to LiteLLM (#11020)
* refactor: use 1 file for image methods

* refactor: use 1 file for image methods

* feat: add stubs for image edits

* fix: types for image edits

* feat: add async image edits

* feat: add base config for image edits

* feat: add basic structure for image edits

* feat: add ImageEditRequestUtils

* feat: complete instrumentation of image edits

* tes: test_openai_image_edit_litellm_sdk

* tets: test_openai_image_edit_litellm_sdk

* feat: get_provider_image_edit_config

* feat: add OpenAIImageEditConfig

* feat: working image edits

* fixes: working image edits

* fix: code qa

* fix: using image edits

* fix: linting errors
2025-05-21 14:03:09 -07:00