litellm/tests/unit/llms/minimax
SaladDay dfcb9e7b21
feat(minimax): add MiniMax-H3-Image generation and edit support (#50881)
* feat(minimax): add MiniMax-H3-Image generation and edit support

Reuse the OpenAI image generation and edit configs so MiniMax-H3-Image
works through litellm.image_generation / image_edit and the proxy, with
first-class aspect_ratio and area, JSON image_url edits, and token pricing.

* ci: follow relocated cost-map-guard paths after the repo move

The guard now lives under litellm/scripts/ci_cd and the model-catalog crate
under litellm/rust. Fork PR runs use this workflow file, so the old paths
fail on current main.

* fix(minimax): bill H3 image spend under MiniMax and price the Highspeed model

Image cost routing sent MiniMax image responses to the default per-image calculator, which priced them at 0. Route them to the token-based image calculator with the MiniMax cost-map rows, add the MiniMax-H3-Image-Highspeed price row, keep output_format and output_compression on edits, type the new transformations, and mark image generations and edits as supported for MiniMax in the endpoint map

* chore: retrigger pull request head sync

* fix(minimax): forward extra_body and refuse stream on MiniMax image calls

Flatten extra_body into the MiniMax image generation body, route MiniMax
image edits through the same param passthrough as Tencent, send a numeric
output_compression form value as a number, and answer 400 for stream
unless drop_params is set, since MiniMax image endpoints do not stream.

* fix(minimax): treat a multipart stream=false as off on MiniMax image edits

A proxy multipart edit sends stream as the string "false", which the
stream check read as truthy and refused with a 400. Parse the flag as a
bool first, and still refuse a value that is not a bool.

* fix(minimax): send image edits as multipart and report failed images

* fix(minimax): upload tuple and path images on edits and map safety rejects to content policy errors

MiniMax image edits now read every image through the shared extract_file_data helper, so a
(filename, file) tuple or a pathlib.Path uploads the file bytes instead of failing

A MiniMax error that ends in its safety check code (1026) or (1027) now raises
ContentPolicyViolationError, so content_policy_fallbacks fire for MiniMax deployments

* fix(minimax): scope image safety errors to images, accept chat API bases, refuse JSON edit images

Safety rejects on image calls now answer 400 as a content policy error, and other MiniMax calls keep their old errors. Image URLs strip /anthropic and /v1 suffixes from the API base. JSON images on edits answer 400 unless drop_params is set. additional_drop_params now drops extra_body fields on image generations, and edits rewind partly read file handles before upload

* fix(minimax): strip API surface suffixes from the URL path only

A host named like a suffix (https://anthropic/v1) lost its host when the suffix regex ran over the whole base URL

* test(minimax): annotate the image generation config local as Final

* fix(minimax): match the image edit config's override types to main's base classes

* fix(images): drop bracket fields by root on MiniMax and Tencent edit passthrough

additional_drop_params roots like imageConfig now also drop imageConfig[aspectRatio] on the edit passthrough, as other edits already do

* fix(images): drop the whole extra_body on MiniMax and Tencent edits when additional_drop_params lists it

Edit passthrough now matches generation, which already drops the whole extra_body container when additional_drop_params names it

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-24 05:54:43 +00:00
..
chat fix(minimax): forward reasoning_effort instead of dropping it (#49583) 2026-11-09 14:03:50 -08:00
image_edit feat(minimax): add MiniMax-H3-Image generation and edit support (#50881) 2026-11-24 05:54:43 +00:00
image_generation feat(minimax): add MiniMax-H3-Image generation and edit support (#50881) 2026-11-24 05:54:43 +00:00
messages
text_to_speech test: move whole-unit legacy test files into tests/unit and delete dead skips (#44807) 2026-10-07 05:02:28 +00:00
videos feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
__init__.py