Skip to content

feat: add MiniMax H3 image generation and editing APIs - #23

Merged
Marketen merged 7 commits into
mainfrom
feat/image-generation
Nov 12, 2026
Merged

Marketen merged 7 commits into
mainfrom
feat/image-generation

Conversation

@Marketen

@Marketen Marketen commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Add paid image generation and reference-image editing through MiniMax H3, with validated provider token usage for retail billing and provider-cost accounting.

Behavior

  • Expose POST /v1/images/generations and JSON POST /v1/images/edits; advertise supported image endpoints, three retail token rates and maximum charge in model discovery.
  • Use MiniMax H3's native API with 1K PNG inline output. Remove legacy Image-01's adapter, fixed-image pricing contract and unused generic image path. Image endpoints currently require H3; chat routing is unaffected.
  • Validate 1–4 inline PNG/JPEG/WebP references: 10 MiB each, 20 MiB combined, 32 MiB request body, 128–8192 px per side and aspect ratio at most 4:1. Reject remote URLs; multipart editing is unsupported.
  • Hold retail credit before generation. Report actual text-input, reference-image-input and image-output tokens to metering, which reserves a configurable ceiling and caps settlement at successful outputs × ceiling. Filter failed output slots; refused/failed requests have no retail charge. Guests cannot use image endpoints.
  • Require complete, non-negative bounded usage counts with consistent totals. Missing/malformed usage is never guessed or charged. Retain the provider facts separately for profitability.
  • Return the authoritative deducted amount in nexus_billing, including account surcharge. Idempotent replays return the original result and receipt without charging again. Preserve fractional ceiling precision in discovery.
  • Use a dedicated long-running image HTTP client and a default 660-second deadline. Do not retry upstream image calls or fall back to another provider. Retain failed idempotency keys to prevent silently resubmitting a possibly billed operation.
  • Include api.minimax.io in the measured enclave egress manifest on vsock port 8453.

Validation

  • go test ./... passed, with additional tests for H3 generation without references, unsupported model rejection and required token pricing/ceiling.
  • Standard gateway build and Linux amd64/arm64 nitro_enclave cross-builds passed.
  • Tests cover reference validation, partial outputs, separate token dimensions, malformed usage rejection, idempotency and charge receipt replay.
  • Companion browser tests verified H3-only model discovery and generation/edit controls. Earlier end-to-end tests completed real H3 bird edits, including a follow-up without an upload and a subsequent edit combining the latest result with a new reference.

Deployment and limits

Companion Nexus PR #157 contains H3-only migrations, billing, admin pricing and the user interface. Production remains at schema 33 with no image models/usage, so its unreleased migrations 034–037 omit legacy fields and seeds directly.

Deploy the gateway before activating H3. Deploy the companion services/UIs and migrations, enter verified provider costs and review retail prices before activation. Production enclave use needs a new enclave release and matching parent-proxy MiniMax route.

Idempotency is process-local: results are cached for 15 minutes within 256 MiB and keys for 24 hours. Evicted results are refused rather than regenerated, but restarts/multiple replicas lack durable deduplication. Disconnecting or stopping waiting does not cancel the provider operation. MiniMax may bill a failed/timed-out operation without a successful retail result. Prompt masking does not anonymize reference-image pixels.

Accept validated inline image references and route H3 requests through native MiniMax generation and editing APIs. Preserve provider usage separately from retail image billing, avoid automatic image retries, and include MiniMax in enclave egress.
@Marketen Marketen changed the title feat: add image generation API with per-image billing feat: add MiniMax image generation and editing APIs Nov 11, 2026
Resolve GO-2026-6859 by using the patched Go toolchain in the module, CI, and Docker builds. Refresh the pinned enclave builder digest and documented minimum version.
Discover H3 token prices, validate its three usage dimensions, and return metering charge receipts with idempotent image results. Preserve fixed per-image models and reject missing or inconsistent token usage.
hcastc00 added a commit that referenced this pull request Nov 11, 2026
Use MiniMax H3 for image generation and editing. Remove the legacy request translator, fixed-image pricing contract and unreachable generic image path; require validated token usage for every successful image request.
@Marketen Marketen changed the title feat: add MiniMax image generation and editing APIs feat: add MiniMax H3 image generation and editing APIs Nov 12, 2026
@Marketen
Marketen merged commit f431c56 into main Nov 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants