Images
Two endpoints: POST /v1/images/generations for text-to-image and POST /v1/images/edits for working from a reference.
Generation
Section titled “Generation”import base64
img = client.images.generate( model="flux-2-pro", prompt="Portrait of a ginger cat in a spacesuit, studio lighting", # aspect_ratio/resolution — расширения Mixen: OpenAI SDK такие kwargs # не принимает, поэтому их передают через extra_body extra_body={"aspect_ratio": "2:3", "resolution": "2k"},)with open("cat.png", "wb") as f: f.write(base64.b64decode(img.data[0].b64_json))const img = await client.images.generate({ model: 'flux-2-pro', prompt: 'Portrait of a ginger cat in a spacesuit, studio lighting', aspect_ratio: '2:3', resolution: '2k',})await Bun.write('cat.png', Buffer.from(img.data[0].b64_json, 'base64'))curl https://api.mixen.ai/v1/images/generations \ -H "Authorization: Bearer $MIXEN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux-2-pro", "prompt": "Portrait of a ginger cat in a spacesuit, studio lighting", "aspect_ratio": "2:3", "resolution": "2k" }'| Field | Description |
|---|---|
model |
An image model identifier, or the dall-e-3 / gpt-image-1 aliases |
prompt |
What to draw |
n |
How many images, 1 to 4 |
size |
Explicit WxH |
aspect_ratio |
Aspect ratio such as 16:9; defaults to 1:1 |
resolution |
1k, 2k or 4k; defaults to 1k |
quality |
low or medium — only on models that expose it |
background |
transparent | opaque | auto — GPT Image 2.5 only; transparent requires output_format of png or webp |
output_format |
png | jpeg | webp — GPT Image 2.5 only; defaults to png |
response_format |
Accepted for compatibility and ignored: the answer always carries b64_json, url is never returned |
size and the aspect_ratio + resolution pair say the same thing two ways. Pick one.
Accepted values differ per model and arrive in the catalog as sizes, aspect_ratios and resolutions. Anything outside those lists returns 400.
Price depends on resolution: on most models 4k costs noticeably more than 1k. Check per_image_rub in the catalog.
Prompt length cap
Section titled “Prompt length cap”Prompts are length-capped, the limit differs per model and arrives in the catalog as prompt_max_chars. Exceeding it returns 400 before any billing:
| Model | Maximum |
|---|---|
| GPT Image 2.5 (Flare/Sunburst) | 20,000 characters |
| GPT Image 2 | 32,000 characters |
| MAI-Image 2.5 / 2.6 (all tiers) | 20,000 characters |
| Grok Imagine Image 2.0 | 8,000 characters |
| Qwen Image 3, Flux 2 | no hard rejection — long text is silently truncated by the vendor |
| Nano Banana, Seedream | limit not published |
The caps were measured by live upstream rejections on a deliberately huge prompt (verified 2026-09-10) plus official docs; always check the current value in the catalog’s prompt_max_chars.
GPT Image 2.5: transparent backgrounds and up to 16 references
Section titled “GPT Image 2.5: transparent backgrounds and up to 16 references”The gpt-image-2.5-flare (speed tier) and gpt-image-2.5-sunburst (precision tier) series adds:
- Transparent background —
background: "transparent"cuts the object out with no backdrop; the output format must bepngorwebp(JPEG has no alpha).autolets the model decide from the prompt,opaqueforces a filled background. - Up to 16 reference images on
/v1/images/edits— combine products, style references and characters. - Prompts up to 20,000 characters (
prompt_max_charsin the catalog) — paste briefs whole. - Aspect ratios from 1:3 to 3:1 — including ultra-wide
3:1and vertical1:3, up to 4K.
curl https://api.mixen.ai/v1/images/generations \ -H "Authorization: Bearer $MIXEN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.5-flare", "prompt": "Mixen AI logo, neon lightning bolt, monochrome", "aspect_ratio": "1:1", "background": "transparent", "output_format": "png" }'The catalog declares the knobs as background and output_formats; sending them to any other model returns 400.
Editing from a reference
Section titled “Editing from a reference”POST /v1/images/edits takes multipart/form-data: one or more images in the image field, plus the same parameters as generation.
curl https://api.mixen.ai/v1/images/edits \ -H "Authorization: Bearer $MIXEN_API_KEY" \ -F model=gpt-image-2.5-sunburst \ -F image=@cat.png \ -F prompt="Dress the cat as an astronaut, keep the background"Whether a model accepts reference images at all is the boolean references flag in the catalog.
Reference billing: for models the upstream meters with per-image SKUs (Qwen Image 3, Grok Imagine and the like), every input image is added to the charge — the base per generated image plus a per-reference rate (the “Input / image” column in the providers table on the showcase). Models without that rate stay flat-priced.
One practical note: when transferring style, a model inherits the reference’s colour palette along with its composition. If you want a different palette, say so explicitly in the prompt.
Nothing async here
Section titled “Nothing async here”Both endpoints answer synchronously with the finished image. Generation takes anywhere from a few seconds to half a minute — set your HTTP client timeout to at least 120 seconds, or you will abandon a request you have already paid for.
Price before you run
Section titled “Price before you run”POST /v1/images/price accepts the same body as POST /v1/images/generations and returns the amount without generating or charging anything. It uses the same formula as the actual charge (resolution × n), so the quote matches the bill; validation is shared too — invalid parameters return the same 400/404 as a real run.
The exception is token-metered models (microsoft/mai-image-*): the upstream bills by actual tokens, so the charge follows the generation’s usage receipt — the quote stays a close estimate (same as duration with Seed Audio).
{ "object": "price", "model": "gpt-image-1", "model_id": "gpt-image-2", "price": {"rub": 12.0069, "usd": 0.13}, "per_unit": {"rub": 4.0023, "unit": "image"}, "quantity": 3, "params": {"aspect_ratio": "16x9", "resolution": "2k", "size": null, "quality": null, "n": 3}}The rouble amount uses the live rate — quote right before you run, don’t cache it.