feat(image-generation): serve MiniMax image models through a dedicated media path - #895
Open
octo-patch wants to merge 1 commit into
Open
Conversation
…d media path The image registry resolved a provider for two credential pools only, so image-01 and image-01-live could not be classified, routed, or served. Classify and route both models, add them to the static catalog under a minimax channel, and add a media executor for POST /v1/image_generation. Requests are reshaped because dimensions arrive as a size string and byte output is spelled differently upstream; responses are translated because images are returned as bare arrays and failures arrive with HTTP 200 and a non-zero base_resp status, which a pass-through would report as success. Chat is delegated to the existing compatibility executor, and editing is not claimed: the reference-image form is a different upstream request shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reason: The image-generation registry recognised only two credential pools, so MiniMax image models could not be classified, routed, or served at all.
What changed
registry.ImageGenerationProvideris the single routing point the public images endpoints and the management console both read. It resolved to""forimage-01, so a request naming that model was rejected as "not a supported image generation model" before any credential was consulted.internal/registry/image_generation_models.go: classifyimage-01andimage-01-live, route them to the newImageProviderMiniMaxpool, and include them inListImageGenerationModels. Pricing is left at zero because the published reference documents no per-image rate, and an invented number would surface as real spend in usage reporting.internal/registry/model_definitions_image_data.go/model_definitions.go: add the static catalog entries plus aminimaxchannel, so a model that routes to a pool is also reportable by that pool. Without this the models would be selectable and unreachable at the same time.internal/runtime/executor/minimax_media.go,minimax_media_request.go,minimax_executor.go: a media path forPOST /v1/image_generationwith bearer authorization. Chat is delegated unchanged to the existing compatibility executor, so only image traffic is new behaviour.internal/app/service/runtime_executor_registry.go: register the executor forminimaxcredentials.Two upstream differences make a pass-through incorrect, and both are covered by tests:
sizestring but are sent aswidth/height, and byte output is requested asbase64rather thanb64_json. Unsupported arguments are dropped from an allowlist that mirrors theSupportedParametersin the catalog, and the dropped names are logged so an operator can see which of their settings were ignored. An explicitaspect_ratiowins over derived pixels, matching the documented upstream precedence.data.image_urlsordata.image_base64rather than as a list of image objects, and failures arrive with HTTP 200 and a non-zerobase_resp.status_code. Forwarded untranslated, an authentication or balance failure would reach the caller as a successful response carrying no images. Status codes are mapped so rate limiting surfaces as 429 and an exhausted balance as 402, which is what the shared quota-cooldown handling keys on.Editing is deliberately not claimed: the reference-image form is a different upstream request shape, not a variant of this call, so
SupportsImageEditingstays false and the edits alt is not intercepted. Configuration is untouched, so this does not overlap the open configuration PR.Checks
go build ./internal/registry/ ./internal/runtime/executor/ ./internal/app/service/go test ./internal/registry/ ./internal/runtime/executor/ -count=1go test ./sdk/api/handlers/openai/ ./sdk/cliproxy/ -count=1go test ./internal/api/handlers/management/ ./internal/app/service/ -count=1gofmt -l internal/registry internal/runtime/executor internal/app/service(clean)python3 scripts/check-backend-structure.py(passed)