> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindcase.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Generation API

> Generate images from text prompts with the image model of your choice, and get each image as a file link with its size, the exact model version, its maker, the options used and the exact cost of the call. You pay exactly what each image costs at the model's own rates.

`POST /v1/data/ai/images/run`

**Pricing:** Metered: you pay exactly each call's cost at the selected model's rates (default Google: Nano Banana (Gemini 2.5 Flash Image): the model's own rate).

## Request

Send the inputs under `params`. Only the keys below are accepted; any other key returns `422 invalid_params`.

**prompts** `string[]` *required*

What to draw, one prompt per line. Each prompt makes Count images, one call and one row each.

**model** `string` (default: google/gemini-2.5-flash-image)

The image model. Pick from the list (popular models first). Each model shows its own rates, per image or per 1M image tokens, and that is exactly what each image costs.

67 allowed values, for example `google/gemini-2.5-flash-image` (Google: Nano Banana (Gemini 2.5 Flash Image)), `google/gemini-nano-banana-2.1` (Google: Nano Banana 2.1), `google/gemini-3.1-flash-lite-image` (Google: Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image)), `google/gemini-3.1-flash-image` (Google: Nano Banana 2 (Gemini 3.1 Flash Image)), `openai/gpt-image-2.6-sunburst` (OpenAI: GPT Image 2.6 Sunburst), `openai/gpt-image-2.6-flare` (OpenAI: GPT Image 2.6 Flare), `openai/gpt-image-2.5-sunburst` (OpenAI: GPT Image 2.5 Sunburst), `black-forest-labs/flux-3-image-klein` (Black Forest Labs: FLUX 3 Image Klein), `black-forest-labs/flux-3-image` (Black Forest Labs: FLUX 3 Image), `bytedance-seed/seedream-5-5` (ByteDance Seed: Seedream 5.5). Fetch the full list with `GET /v1/data/ai/images?expand=options`.

**aspectRatio** `string`

The image shape, e.g. 1:1 or 16:9. Leave blank for the model's default. Only the ratios the selected model offers are accepted.

28 allowed values, for example `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`. Fetch the full list with `GET /v1/data/ai/images?expand=options`.

**resolution** `string`

The size tier, e.g. 1K, 2K or 4K, on models that offer one. Leave blank for the model's default.

Allowed values: `1K`, `1.5K`, `2K`, `4K`, `512`, `768`.

**quality** `string`

Rendering quality (low, medium, high...) on models that offer it. Leave blank for the model's default.

Allowed values: `auto`, `low`, `medium`, `high`, `xhigh`, `max`.

**outputFormat** `string`

The file type (png, jpeg, webp...) on models that offer a choice. Leave blank for the model's default.

Allowed values: `png`, `jpeg`, `webp`, `gif`, `svg`.

**count** `integer` (default: 1)

How many images to make for each prompt, 1 to 4. Each image is its own call and its own row.

Allowed values: `1`, `2`, `3`, `4`.

**referenceImages** `string[]`

Optional public image URLs to edit or draw from, for models that take reference images. One prompt with several images runs the prompt on each image; several prompts with one image uses that image for each prompt. Several prompts with several images is refused.

## Example

```bash cURL theme={null}
curl -X POST "https://api.mindcase.co/v1/data/ai/images/run?wait=true" \
  -H "Authorization: Bearer $MINDCASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "params": {
    "prompts": [
      "A red apple on a white table, studio light",
      "A paper boat on a calm pond at sunrise"
    ],
    "model": "recraft/recraft-v4.1-flash",
    "aspectRatio": "1:1"
  }
}'
```

```python Python theme={null}
import os, requests

r = requests.post(
    "https://api.mindcase.co/v1/data/ai/images/run",
    params={"wait": "true"},
    headers={"Authorization": f"Bearer {os.environ['MINDCASE_API_KEY']}"},
    json={"params": {
    "prompts": [
        "A red apple on a white table, studio light",
        "A paper boat on a calm pond at sunrise"
    ],
    "model": "recraft/recraft-v4.1-flash",
    "aspectRatio": "1:1"
}},
)
job = r.json()
rows = job.get("data", [])  # if job["status"] == "running", poll /v1/jobs/{job_id}/results
```

```javascript Node.js theme={null}
const r = await fetch("https://api.mindcase.co/v1/data/ai/images/run?wait=true", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MINDCASE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ params: {
  "prompts": [
    "A red apple on a white table, studio light",
    "A paper boat on a calm pond at sunrise"
  ],
  "model": "recraft/recraft-v4.1-flash",
  "aspectRatio": "1:1"
} }),
});
const job = await r.json();
const rows = job.data ?? []; // if job.status === "running", poll /v1/jobs/{job_id}/results
```

## Response fields

Each row in `data` is one image, keyed by these fields.

| Field | Name | Type |
| - | - | - |
| `id` | ID | text |
| `prompt` | Prompt | text |
| `referenceImage` | Reference Image | text |
| `fileUrl` | File URL | text |
| `mimeType` | MIME Type | text |
| `width` | Width | number |
| `height` | Height | number |
| `model` | Model | text |
| `provider` | Provider | text |
| `aspectRatio` | Aspect Ratio | text |
| `resolution` | Resolution | text |
| `quality` | Quality | text |
| `outputFormat` | Output Format | text |
| `costUsd` | Cost (USD) | number |
| `error` | Error | text |
| `createdAt` | Created At | datetime |

## Example response

Abridged: long text and lists are shortened.

```json theme={null}
{
  "job_id": "7f3a1c2e-0b9d-4c55-9a51-3f2e8d1b6a40",
  "agent": "ai/images",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "data": [
    {
      "resolution": null,
      "mimeType": "image/webp",
      "fileUrl": "https://api-staging.mindcase.co/api/v1/files/2026/11/09/878221c877de4f6aad833fc6a6a73cf5e67a3694.webp",
      "provider": "Recraft",
      "referenceImage": null,
      "error": null,
      "quality": null,
      "aspectRatio": "1:1",
      "model": "recraft/recraft-v4.1-flash-20260923",
      "id": "gen-img-1794263002-IgMF0jJS2zgoeoyOCDSt",
      "prompt": "A red apple on a white table, studio light",
      "height": 1024,
      "outputFormat": null,
      "costUsd": 0.007,
      "width": 1024,
      "createdAt": "2026-11-09T22:23:38Z"
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.