feat(black_forest_labs): add image generation support #18144
+2,785
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relevant issues
Follow-up to #18006 - adds text-to-image generation support for Black Forest Labs
Pre-Submission checklist
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitType
🆕 New Feature
Changes
Add native text-to-image generation support for Black Forest Labs Flux models.
Supported Models
flux-pro-1.1- Fast & reliable standard generation ($0.04/image)flux-pro-1.1-ultra- Ultra high-resolution up to 4MP ($0.06/image)flux-dev- Development/open-source variant ($0.025/image)flux-pro- Original pro model ($0.05/image)Features
_poll_for_result()and_poll_for_result_async()methodssize→width/height,n→num_images,quality=hd→raw=True_get_httpx_client()andget_async_httpx_client()for connection poolingUsage
Files Changed
litellm/llms/black_forest_labs/image_generation/- New module with transformation configlitellm/llms/black_forest_labs/__init__.py- Export new configlitellm/utils.py- Register provider inget_provider_image_generation_config()litellm/images/main.py- Add to HTTP handler provider listmodel_prices_and_context_window.json- Add model pricingDocumentation Added
docs/my-website/docs/providers/black_forest_labs.md- Full provider documentation with SDK and Proxy examplesdocs/my-website/docs/image_generation.md- Added Black Forest Labs to supported providers listTests Added