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

# Text to Image

> Generate images from text with Kling Image 4.0 at 2K, 4K or 8K, including coherent image series.

## Models

| Model | Resolutions | Images per task | Prompt length |
| - | - | - | - |
| `kling-4-0/image` — Kling Image 4.0 | 2K, 4K, 8K | 1–9 (series: 2–10) | 20000 |

> [!NOTE]
>
> This endpoint only accepts `kling-4-0/image`. Kling video models use the video endpoints.
> The same model also serves [Image to Image](https://docs.modelhunter.ai/api-reference/kling/image-to-image.md): add `image_urls` or `elements` to use references.

## Pricing

Billed per generated image at the official price:

| Resolution | Price per image |
| - | - |
| `2K` | \$0.063 |
| `4K` | \$0.094 |
| `8K` | \$0.157 |

The total is the price per image × `count`. Each reference image or element adds \$0.003 per task.

## Body Parameters

**model** `string` *required*

Model to use: `kling-4-0/image`.

**input** `object` *required*

Input parameters for the generation.

**properties**

**prompt** `string` *required*

Text description of the image to generate. Maximum length: 20000 characters.
To render text in the image, put the text inside quotation marks.

**resolution** `string` (default: 2K)

Output resolution: `2K`, `4K` or `8K` (case-insensitive). `2K` / `4K` usually return PNG, `8K` returns JPEG —
do not hard-code the file extension.

**aspect\_ratio** `string` (default: auto)

Output aspect ratio: `auto`, `9:16`, `2:3`, `3:4`, `1:1`, `4:3`, `3:2`, `16:9`, `21:9`.
`auto` lets the model choose from the prompt.

**mode** `string` (default: default)

Generation mode:

* `default` — independent images; `count` can be `1`–`9`.
* `series` — a coherent set of images (for example the same character from morning to night);
  `count` is required and can be `2`–`10`.

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

Number of images to generate. `1`–`9` in `default` mode; required and `2`–`10` in `series` mode.
The task result contains one URL per image.

**webhookUrl** `string`

URL to receive a webhook when the task completes.

**metadata** `object`

Custom key-value metadata to attach to the task.

```bash cURL theme={null}
curl -X POST https://api.modelhunter.ai/api/v1/kling/text-to-image \
  -H "Authorization: Bearer $MODELHUNTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-4-0/image",
    "input": {
      "prompt": "A red wooden bridge over a koi pond in a Japanese garden, cherry blossoms in soft morning mist",
      "resolution": "4K",
      "aspect_ratio": "16:9",
      "count": 2
    }
  }'
```

```json 202 theme={null}
{
  "success": true,
  "data": {
    "id": "task_abc123",
    "status": "pending",
    "type": "text-to-image",
    "provider": "kling",
    "model": "kling-4-0/image",
    "created_at": "2026-11-24T10:00:00Z",
    "estimated_seconds": 60
  }
}
```

```json 400 theme={null}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "input.count is required when mode is series"
  }
}
```


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