- Go 98.4%
- Dockerfile 0.9%
- Makefile 0.7%
| .woodpecker | ||
| cmd/app | ||
| internal | ||
| .dockerignore | ||
| .gitignore | ||
| .golangci.yml | ||
| .goreleaser.yml | ||
| Dockerfile | ||
| go.mod | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
minimax-openai-image-proxy
A small, stateless Go service that exposes an OpenAI-compatible image
generation endpoint and translates it to the MiniMax /v1/image_generation
API. Its primary purpose is to make Open WebUI's built-in generate_image
tool work with MiniMax image-01 without modifying Open WebUI.
Endpoints
POST /v1/images/generations— OpenAI-compatible image generation.GET /healthz/GET /readyz— liveness; never contact MiniMax.- (No image edit endpoint; intentionally out of scope.)
Configuration
| Env var | Default | Notes |
|---|---|---|
LISTEN_ADDR |
:8080 |
HTTP listen address |
MINIMAX_BASE_URL |
https://api.minimax.io |
Base URL; trailing slashes are stripped |
UPSTREAM_TIMEOUT |
120s |
Per-request upstream timeout (Go duration) |
The MiniMax API key is not stored in the service. The incoming
Authorization: Bearer <key> is forwarded upstream unchanged, per request.
The service is normally reached only from a private Docker network fronting
Open WebUI; expose it publicly only behind a reverse proxy.
Build & run
make build # produces ./app
make test # go test ./...
make vet # go vet ./...
make fmt # gofmt -w ./cmd ./internal
make docker-build # build the Docker image as minimax-image-proxy:dev
./app # default :8080
Example request
curl -sS http://localhost:8080/v1/images/generations \
-H "Authorization: Bearer $MINIMAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "image-01",
"prompt": "A server rack in a dark homelab, realistic photography",
"size": "1024x1024",
"n": 1,
"response_format": "b64_json"
}'
The response body is OpenAI-shaped:
{ "created": 1780000000, "data": [ { "b64_json": "..." } ] }
Open WebUI configuration
| Field | Value |
|---|---|
| Image Generation | Enabled |
| Image Generation Engine | Default (Open AI) |
| Model | image-01 |
| Image Size | 1024x1024 |
| API Base URL | http://minimax-image-proxy:8080/v1 |
| API Key | <your MiniMax Token Plan API key> |
| API Version | (leave empty) |
No "Additional Parameters" are required for normal generation. Optional
MiniMax-native fields are passed through unchanged: prompt_optimizer,
seed, aspect_ratio. OpenAI-specific fields that this proxy does not
understand (quality, style, …) are silently ignored so Open WebUI's
common payloads keep working.
Error responses
Errors follow the OpenAI envelope:
{
"error": {
"message": "invalid size: width 123 outside [512..2048]",
"type": "invalid_request_error",
"param": "size",
"code": "invalid_size"
}
}
Status codes:
| Status | Meaning |
|---|---|
400 |
Invalid request (bad size, n out of range, unsupported model, malformed body, unknown field tolerance is permissive) |
401 |
Missing or malformed Authorization |
502 |
Upstream MiniMax error (HTTP or application-level base_resp) |
Docker Compose
A working Docker Compose example for this proxy lives in the user's
docker-stacks repository, not here. The proxy is normally reached only
from a private Docker network fronting Open WebUI.
Quality bar
- No retry on upstream failure — a retry could consume an additional MiniMax image quota and produce an extra billable generation.
- Authorization headers, API keys, prompts, and base64 image data are never logged.
- Release binaries are statically linked, run as a non-root user (
app), and ship only CA certificates. - Implementation depends on the Go standard library only.