# AI Image Generation API

> Generate images with 33 AI image models, including Nano Banana, GPT Image, FLUX and Seedream, through one API with one credit balance.

- Canonical page: https://www.autofeed.ai/video-api/ai-image
- API reference: https://www.autofeed.ai/docs/api
- Publisher: AutoFeed.ai (https://www.autofeed.ai)

Send a prompt and pick a model. AutoFeed runs it, stores the image and returns its URL, with the same credits and webhooks as every video type.

- 33 image models from 11 makers
- Vertical, square, horizontal and more, per model
- Priced per image and quality, the same as the dashboard
- One generation is one image at url

## Example request

Costs 135 credits, the same as in the dashboard.

```bash
curl -X POST https://www.autofeed.ai/api/v1/videos \
  -H "Authorization: Bearer $AUTOFEED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "ai_image",
    "input": {
      "model": "nano-banana-2-1",
      "prompt": "A cozy coffee shop on a rainy evening, warm light, photoreal",
      "ratio": "9:16"
    },
    "webhookUrl": "https://example.com/webhooks/autofeed",
    "idempotencyKey": "order-1042-ai-image"
  }'
```

202 Accepted:

```json
{
  "id": "1c9d6c3e-1f5b-4d2e-9c31-2b8b0f0f9a11",
  "type": "ai_image",
  "status": "processing",
  "costInCredits": 135,
  "createdAt": "2026-11-02T12:00:00.000Z"
}
```

`video.completed` webhook body:

```json
{
  "id": "1c9d6c3e-1f5b-4d2e-9c31-2b8b0f0f9a11",
  "type": "ai_image",
  "status": "completed",
  "error": null,
  "costInCredits": 135,
  "createdAt": "2026-11-02T12:00:00.000Z",
  "completedAt": "2026-11-02T12:03:41.000Z",
  "url": "https://.../1c9d6c3e-1f5b-4d2e-9c31-2b8b0f0f9a11.mp4"
}
```

## Input fields

| Field | Type | Default | Notes |
|---|---|---|---|
| `model` (required) | one of 33 values | - | The model id, exactly as listed in aiImageModels from GET /v1/types. |
| `prompt` (required) | string (max 4000) | - | What the image shows. Up to 4000 characters. |
| `ratio` | string (max 16) | - | One of the model's ratios. Defaults to its first. |
| `quality` | string (max 32) | - | One of the model's qualities (a resolution or a quality level). Price-bearing. Defaults to the one the dashboard starts on. |

Included with Ultimate. Rendered files are kept for 14 days.

## Frequently asked questions

### How do I get several images?

Send one request per image. Each is its own generation with its own id, price and webhook, so one refused prompt fails only that image.

### What if the model refuses my prompt?

The generation fails with an error saying so, and its credits are refunded automatically.

### How is an AI image billed?

From the same credit balance as the dashboard, at the same price per video. The cost is in the 202 response before any work starts, and a failed render refunds it.
