Simple proxy service to translate OpenAI image generation requests into MiniMax API calls for OpenWebUI.
  • Go 98.4%
  • Dockerfile 0.9%
  • Makefile 0.7%
Find a file
Kitsu 5b846d42be
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/tag/ci Pipeline was successful
ci: use golang:1.26 (full image) for test-race to keep CGO available
2026-08-20 02:11:24 +03:00
.woodpecker ci: use golang:1.26 (full image) for test-race to keep CGO available 2026-08-20 02:11:24 +03:00
cmd/app feat(cmd): add entry point with config, slog, graceful shutdown 2026-08-19 07:39:27 +03:00
internal feat(api): log inbound image generation request shape at INFO 2026-08-20 01:55:40 +03:00
.dockerignore build: add Makefile and dockerignore 2026-08-19 07:34:01 +03:00
.gitignore Initial commit 2026-08-19 04:13:49 +00:00
.golangci.yml Initial commit 2026-08-19 04:13:49 +00:00
.goreleaser.yml Initial commit 2026-08-19 04:13:49 +00:00
Dockerfile build: bump Go toolchain to 1.26-alpine, drop missing go.sum copy 2026-08-20 02:07:06 +03:00
go.mod build: bump go directive to 1.26 2026-08-20 01:55:26 +03:00
LICENSE Initial commit 2026-08-19 04:13:49 +00:00
Makefile build: add Makefile and dockerignore 2026-08-19 07:34:01 +03:00
README.md docs: drop compose example, point to docker-stacks repo 2026-08-20 01:55:48 +03:00

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.