litellm/tests/image_gen_tests
Mateo Wang 51769a8ede
feat(fal_ai): add Nano Banana / Gemini 2.5 Flash Image generation support (#29798)
* feat(fal_ai): add Nano Banana / Gemini 2.5 Flash Image generation support

Adds a FalAINanoBananaConfig for fal.ai's Nano Banana models, exposed under
both fal-ai/nano-banana and fal-ai/gemini-25-flash-image (identical schema).
This is the migration path for fal-ai/imagen4, which fal deprecates on
2026-06-30.

The config derives the request endpoint from the model name so both aliases
route correctly, maps OpenAI image params to the fal schema (n -> num_images,
size -> nearest supported aspect_ratio, response_format ignored since the model
returns URLs), and reuses the base fal response parser. Pricing is registered
at 0.039 per image in the cost map and backup.

* fix(fal_ai): tighten nano-banana routing and guard mapped params

Match the specific gemini-25-flash-image / gemini-2.5-flash-image
aliases instead of any model containing gemini so future fal.ai
Gemini-branded models aren't silently misrouted to the nano-banana
config. Guard the param mapping on the fal-side keys (num_images,
aspect_ratio) so a pre-set mapped value is respected and an OpenAI
key is never forwarded unmapped.

* fix(fal_ai): drop non-existent gemini-2.5-flash-image routing alias

fal.ai only serves the dotted-free fal-ai/gemini-25-flash-image and
fal-ai/nano-banana endpoints. Routing the dotted gemini-2.5-flash-image
alias built a https://fal.run/fal-ai/gemini-2.5-flash-image URL that
fal.ai 404s and had no pricing entry, so spend tracking silently fell to
zero. Match only the two real endpoint slugs.
2026-06-06 11:16:44 -07:00
..
request_payloads test(image_gen): align Azure image gen fixture with body omitting model 2026-05-04 18:09:30 +05:30
base_image_generation_test.py fix(ci): remove unused is_expired variable (ruff F841) and handle ModelDeprecated in image gen test 2026-03-12 01:27:42 +00:00
conftest.py fix(tests): stabilize image-edit VCR cassettes to stop live gpt-image-1 spend (#28110) 2026-05-18 09:15:39 -07:00
ishaan_github.png [Feat] Add Image Edits Support to LiteLLM (#11020) 2025-05-21 14:03:09 -07:00
litellm_site.png [Feat] Add Image Edits Support to LiteLLM (#11020) 2025-05-21 14:03:09 -07:00
test_bedrock_image_gen_unit_tests.py Revert "chore(tests): migrate Bedrock CI to AWS account 941277531214 (#28728)" (#29326) 2026-05-30 11:26:24 -07:00
test_fal_ai_image_generation.py feat(fal_ai): add Nano Banana / Gemini 2.5 Flash Image generation support (#29798) 2026-06-06 11:16:44 -07:00
test_image_edit.png test: cleanup tests 2026-03-30 16:20:01 -07:00
test_image_edits.py fix(tests): stabilize image-edit VCR cassettes to stop live gpt-image-1 spend (#28110) 2026-05-18 09:15:39 -07:00
test_image_generation.py Revert "chore(tests): migrate Bedrock CI to AWS account 941277531214 (#28728)" (#29326) 2026-05-30 11:26:24 -07:00
test_image_variation.py Fix: varaitions endpoint geting 401 2026-03-09 12:51:21 +05:30
test_image.png [BETA] Add OpenAI /images/variations + Topaz API support (#7700) 2025-01-11 23:27:46 -08:00
test_xinference.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
vertex_key.json test: update to new vertex ai keys 2026-03-28 20:19:05 -07:00