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”img = client.images.generate( model="flux-2-pro", prompt="Portrait of a ginger cat in a spacesuit, studio lighting", aspect_ratio="3:4", resolution="2k",)print(img.data[0].url)const img = await client.images.generate({ model: 'flux-2-pro', prompt: 'Portrait of a ginger cat in a spacesuit, studio lighting', aspect_ratio: '3:4', resolution: '2k',})console.log(img.data[0].url)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": "3:4", "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 |
response_format |
url or b64_json |
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.
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 \ -F image=@cat.png \ -F prompt="Dress the cat as an astronaut, keep the background"How many references a model takes is the references field in the catalog. Some accept a single image, others take up to nine.
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.