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

Request body

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

Fields

FieldTypeDefaultNotes
promptstringrequiredPositive prompt, 1–8192 characters.
negative_promptstringOptional negative prompt, 1–8192 characters.
magic_prompttrueSet to true to enable Mynth-side prompt enhancement.
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 20.
inputsarray[]String URLs or structured image input objects. Maximum 20.
outputobject{ "format": "webp", "quality": 80 }format (png, jpg, webp) and quality (1100).
webhookobjectdashboard (false) and custom (array of { url }).
ratingtrue or objecttrue, { "mode": "nsfw_sfw" }, or { "mode": "custom", "levels": [...] }.
destinationstringName of a configured destination to deliver generated images to.
metadataobjectArbitrary JSON, maximum 2 KB. Returned with the task and webhook payloads.
accessobjectpat.enabled (boolean, default true). Controls whether a task-scoped access token is returned.

Object details

inputs entry:
{
  "type": "image",
  "source": {
    "type": "url",
    "url": "https://example.com/reference.png"
  }
}
String URLs are a shorthand for image inputs. Structured entries use type and source. webhook object:
{
  "dashboard": false,
  "custom": [{ "url": "https://example.com/hook" }]
}
Set dashboard: false to skip dashboard-managed webhooks for this task. 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

Set magic_prompt: true to opt into Mynth-side prompt enhancement. When enabled, the enhanced prompt is returned in result.magic_prompt (with positive and optional negative).

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:
  • base (default)
  • 4k
When scale: "4k" is requested, models with dedicated 4K pricing are billed at their 4K rate. For each successful output image, input images are billed as perImage + perInput * inputs.length.

Auto

{ "type": "auto" }
Mynth picks the size automatically. When the model can size natively, that path is used; otherwise Mynth resolves a size for you. This is not configurable.