Skip to main content
Mynth image generation starts with a request to POST /image/generate. You can call it through the official SDK or directly over HTTP.

Use the JavaScript SDK

import Mynth from "@mynthio/sdk";

const mynth = new Mynth();

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",
  count: 1,
});

console.log(task.urls);

Use the REST API

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": "landscape",
    "count": 1
  }'
Example response:
{
  "data": {
    "taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
    "access": {
      "publicAccessToken": "pat_eyJhbGciOi..."
    }
  }
}

What happens next

Creating a task does not return final images immediately. Mynth creates a task first, then you retrieve the result in one of two ways:
  • wait for completion in the SDK
  • poll task endpoints or receive webhooks
Read Async and polling for the decision.

Common request fields

FieldPurpose
promptThe prompt text.
modelA specific model ID, or "auto" to let Mynth choose.
sizePreset, aspect ratio, or "auto".
countNumber of images to generate. Maximum: 20.
negative_promptText to discourage in the generated image.
magic_promptSet to true to let Mynth rewrite your prompt for better results.
inputsOptional input images by URL or structured input objects.
outputOutput format and quality.
webhookTask-level webhook controls and extra custom endpoints.
ratingOptional content classification settings.
metadataApplication-specific data returned with the task and webhook payloads.

Choose a model

Set model explicitly in production. model: "auto" is an early preview feature. Browse models at mynth.io/models.