Skip to main content
Endpoint:
POST https://api.mynth.io/image/generate

Request body

{
  "prompt": {
    "positive": "Modern poster design for a jazz festival",
    "negative": "watermark, blurry text",
    "enhance": "prefer_magic"
  },
  "model": "google/gemini-3.1-flash-image",
  "size": {
    "type": "aspect_ratio",
    "aspectRatio": "4:5",
    "scale": "4k"
  },
  "count": 2,
  "inputs": [
    {
      "type": "image",
      "role": "reference",
      "source": {
        "type": "url",
        "url": "https://example.com/reference.png"
      }
    }
  ],
  "output": {
    "format": "webp",
    "quality": 80
  },
  "webhook": {
    "enabled": true,
    "custom": [
      {
        "url": "https://example.com/api/mynth-webhook?token=abc123"
      }
    ]
  },
  "content_rating": {
    "enabled": true
  },
  "metadata": {
    "requestId": "req_123"
  },
  "access": {
    "pat": {
      "enabled": true
    }
  }
}

Fields

FieldTypeDefaultNotes
promptstring or objectrequiredObject form supports positive, optional negative, and enhance.
modelstring"auto"A model ID or "auto". Set a specific model in production.
sizestring or object"auto"Presets, structured aspect ratios, or "auto".
countnumber1Minimum 1, maximum 100.
inputsarray[]String URLs or structured image input objects.
outputobjectformat (png, jpg, webp) and quality (0-100).
webhookobjectenabled (boolean) and custom (array of { url }).
content_ratingobjectenabled (boolean) and optional levels array.
metadataobjectArbitrary JSON, maximum 2 KB. Returned with the task and webhook payloads.
accessobjectpat.enabled (boolean). Controls whether a task-scoped access token is returned.

Object details

prompt object:
{
  "positive": "required prompt text",
  "negative": "optional negative prompt",
  "enhance": "prefer_magic"
}
inputs entry:
{
  "type": "image",
  "role": "reference",
  "source": {
    "type": "url",
    "url": "https://example.com/reference.png"
  }
}
Roles: reference, context, init. webhook object:
{
  "enabled": true,
  "custom": [{ "url": "https://example.com/hook" }]
}
Maximum 5 custom endpoints. Custom endpoints are not signed. See Use Webhooks. access object:
{
  "pat": { "enabled": true }
}
Returns a publicAccessToken for browser-safe polling. See Browser Polling.

Prompt enhancement values

prompt.enhance accepts:
  • false
  • prefer_magic
  • prefer_native

Size presets

  • square
  • portrait
  • landscape
  • portrait_tall
  • landscape_wide
  • 1:1
  • 2:3
  • 3:2
  • 3:4
  • 4:3
  • 4:5
  • 5:4
  • 9:16
  • 16:9
  • 21:9
  • 2:1
  • 1:2
  • 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

Structured size objects

Aspect ratio

{ "type": "aspect_ratio", "aspectRatio": "16:9" }
Supported aspect ratios:
  • 1:1
  • 2:3
  • 3:2
  • 3:4
  • 4:3
  • 4:5
  • 5:4
  • 9:16
  • 16:9
  • 21:9
  • 2:1
  • 1:2
Optional scale values:
  • 4k
When scale: "4k" is requested, models with dedicated 4K pricing are billed at their 4K rate.

Auto

{ "type": "auto", "prefer": "native" }