Skip to main content
Use the size option on POST /image/generate to control layout and scale. size is optional. When you omit it, or pass "auto", Mynth chooses dimensions for you. This page covers request size and output file format. For prompts, inputs, and models, see Generate Images. Full field tables live in Image Generation Request.

Pricing

Choosing a base preset or aspect ratio does not add a separate fee. You pay the model’s per-image price for the resolved scale.
ScaleBilling
base (default)Model perImage.base rate
4kModel perImage["4k"] when published; otherwise the base rate
Check each model page or mynth.io/models for base and 4K prices. Requesting 4k on a model that does not support it fails the task — Mynth does not silently downgrade to base.

Use a named preset

The simplest option is a layout preset string:
const task = await mynth.image.generate({
  prompt: "Architectural photograph of a brutalist library at golden hour",
  model: "google/gemini-3.1-flash-image",
  size: "landscape",
});
PresetAspect ratio
square1:1
portrait2:3
landscape3:2
portrait_tall9:16
landscape_wide16:9
Presets resolve to aspect ratios. Exact pixel dimensions depend on the model and scale.

Use an aspect ratio

Pass a ratio as a shorthand string, or as a structured object:
// Shorthand (same as structured with scale "base")
size: "16:9";

// Structured
size: { type: "aspect_ratio", aspectRatio: "16:9" };

// Structured with explicit base scale
size: { type: "aspect_ratio", aspectRatio: "16:9", scale: "base" };

Supported aspect ratios

RatioTypical use
1:1Square social, icons
2:3Portrait photo
3:2Landscape photo
3:4Portrait product
4:3Classic landscape
4:5Portrait feed posts
5:4Near-square landscape
9:16Stories / vertical video frames
16:9Widescreen / hero
21:9Ultrawide cinematic
2:1Wide banner
1:2Tall banner
If a model does not list an exact ratio among its presets, Mynth maps to the closest same-orientation preset for that model. Prefer ratios the model documents when you need a specific layout. You cannot pass raw width / height on the public generate API. Use presets, aspect ratios, or auto.

Request 4K

Set scale to 4k when the model supports it:
const task = await mynth.image.generate({
  prompt: "Wide aerial of a coastal city at dusk",
  model: "google/gemini-3.1-flash-image",
  size: { type: "aspect_ratio", aspectRatio: "16:9", scale: "4k" },
});
Ratio shorthands with a _4k suffix are equivalent:
size: "16:9_4k";
Supported 4K shorthands: 1:1_4k, 2:3_4k, 3:2_4k, 3:4_4k, 4:3_4k, 4:5_4k, 5:4_4k, 9:16_4k, 16:9_4k, 21:9_4k, 2:1_4k, 1:2_4k. Named layout presets (square, portrait, …) do not have _4k variants. Use a ratio shorthand or structured scale: "4k" instead. Leave scale unset (or set "base") for the model’s standard tier. Check the model’s capabilities table — 4K: Yes — before requesting 4K.

Use auto size

Any of these ask Mynth not to force a fixed user-chosen ratio:
// Omitted size (same behavior)
const task = await mynth.image.generate({
  prompt: "Editorial product shot on marble",
  model: "google/gemini-3.1-flash-image",
});

// Explicit
size: "auto";
size: { type: "auto" };
What happens next depends on the model and mode:
  1. Native auto size — if the model supports auto size in the active mode (often image-to-image), the provider chooses dimensions (for example from the input image). Look for Native auto size: Yes on the model page.
  2. Mynth-resolved auto — if the model has no native auto path for that mode, Mynth picks an aspect ratio from your prompt at base scale, then maps it to the model’s presets.
Models with native auto size today:
ModelNotes
Gemini 3.1 Flash-Lite ImageImage-to-image
Gemini 3 Pro Image PreviewImage-to-image
ImagineArt 2.0Image-to-image
Grok Imagine ImageImage-to-image
Grok Imagine Image QualityImage-to-image
FLUX Virtual Try-OnImage-to-image (required)
P-Image Try-OnImage-to-image (required)
Ideogram Remove BackgroundImage-to-image (required)
For a fixed layout, prefer a preset or aspect ratio instead of auto.

Read the resolved size

Each successful image includes the actual pixel size as {width}x{height}:
{
  "status": "success",
  "id": "img_...",
  "url": "https://...",
  "mynth_url": "https://...",
  "cost": "0.03",
  "size": "2688x1536"
}
for (const image of task.getImages()) {
  if (image.status === "success") {
    console.log(image.id, image.size); // e.g. "2688x1536"
  }
}
Request size is what you asked for. Result size is what was generated.

Set output format

output controls the delivered file, not layout:
const task = await mynth.image.generate({
  prompt: "Matte product render on seamless background",
  model: "google/gemini-3.1-flash-image",
  size: "square",
  output: {
    format: "webp",
    quality: 80,
  },
});
FieldValuesDefault
formatpng, jpg, webpwebp
quality110080

REST example

curl https://api.mynth.io/image/generate \
  -X POST \
  -H "Authorization: Bearer $MYNTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Architectural photograph of a brutalist library at golden hour",
    "model": "google/gemini-3.1-flash-image",
    "size": {
      "type": "aspect_ratio",
      "aspectRatio": "16:9",
      "scale": "base"
    },
    "output": {
      "format": "webp",
      "quality": 80
    }
  }'
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see Async and polling.

How size fits generation

  1. Mynth validates size (preset, aspect ratio, 4K shorthand, or auto).
  2. Shorthand presets expand to aspect ratio + scale.
  3. For auto: native provider sizing when supported; otherwise Mynth picks a base aspect ratio from the prompt.
  4. The resolved size is mapped to the selected model’s presets (exact match, or closest same-orientation ratio).
  5. After generation, each image reports true pixel size as size ({width}x{height}).
For the full request schema, see Image Generation Request.