# FLUX 3 Image Klein

## Quick example

Submit one image request, save the returned `id`, and poll until the task is `completed` or `failed`. This API uses asynchronous tasks and URL outputs.

```bash
curl https://api.seedrouter.ai/v1/images/generations \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"flux-3-image-klein","prompt":"An amber bottle on pale limestone in soft morning light","resolution":"1k","aspect_ratio":"3:2"}'
```

```python
import os
import requests
response = requests.post(
    "https://api.seedrouter.ai/v1/images/generations",
    headers={"Authorization": f"Bearer {os.environ['SEEDROUTER_API_KEY']}"},
    json={"model": "flux-3-image-klein", "prompt": "An amber bottle on pale limestone in soft morning light", "resolution": "1k", "aspect_ratio": "3:2"},
    timeout=60,
)
response.raise_for_status()
task = response.json()
print(task["id"])
```

```javascript
const response = await fetch('https://api.seedrouter.ai/v1/images/generations', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.SEEDROUTER_API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ model: 'flux-3-image-klein', prompt: 'An amber bottle on pale limestone in soft morning light', resolution: '1k', aspect_ratio: '3:2' }),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const task = await response.json();
console.log(task.id);
```

```php
<?php
$ch = curl_init('https://api.seedrouter.ai/v1/images/generations');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('SEEDROUTER_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode(['model' => 'flux-3-image-klein', 'prompt' => 'An amber bottle on pale limestone in soft morning light', 'resolution' => '1k', 'aspect_ratio' => '3:2']),
]);
$response = curl_exec($ch);
if ($response === false) throw new RuntimeException('Submission could not be confirmed');
echo $response;
curl_close($ch);
```

## Endpoint and headers

`POST https://api.seedrouter.ai/v1/images/generations`

| Header        | Value                 |
| ------------- | --------------------- |
| Authorization | `Bearer YOUR_API_KEY` |
| Content-Type  | `application/json`    |

Keep the key on your server. An HTTP success acknowledges a task; it does not mean that its image is ready.

## Parameters

There are 11 accepted fields. Only `model` and `prompt` are required. Omit optional fields to use their defaults; `null` is not accepted.

| Field              | Type         | Default  | Constraint                                                                                 |
| ------------------ | ------------ | -------- | ------------------------------------------------------------------------------------------ |
| `model`            | string       | Required | `flux-3-image-klein`                                                                       |
| `prompt`           | string       | Required | Non-empty image description or edit instruction                                            |
| `image_urls`       | string array | None     | At most 10 public HTTP(S) image URLs, without credentials; empty array means no references |
| `aspect_ratio`     | string       | `auto`   | A listed ratio; also accepts forms such as `16x9`                                          |
| `size`             | string       | None     | Compatibility alias for aspect ratio; prefer `aspect_ratio` and send only one              |
| `resolution`       | string       | `1k`     | `768sq`, `1k`, `1.5k`, `2k`, `4k`; case insensitive; `768` aliases `768sq`                 |
| `safety_tolerance` | integer      | `2`      | 0–4; 0 is strictest                                                                        |
| `seed`             | integer      | Random   | 0–4294967295; explicit 0 is preserved                                                      |
| `steps`            | integer      | `16`     | 1–16                                                                                       |
| `output_format`    | string       | `jpeg`   | `jpeg`, `png`; `jpg` aliases `jpeg`                                                        |
| `n`                | integer      | `1`      | Only 1                                                                                     |

Ratios: `auto`, `21:9`, `2:1`, `16:9`, `3:2`, `7:5`, `4:3`, `5:4`, `1:1`, `4:5`, `3:4`, `5:7`, `2:3`, `9:16`, `1:2`, `9:21`.

The Playground has a fixed model and ten input controls, including `n` fixed at 1. Safety values above 2 are API only, except for administrators.

## Modes and constraints

No references means text-to-image. One reference enables editing; multiple references enable composition from several images. With `auto`, edits follow the first reference's aspect ratio. Text-only generation uses the prompt to select a frame, falling back to `1:1` when no frame is determined. Resolution defaults to `1k` in every mode.

Resolution tiers represent approximate image scale: 768sq is about 768 × 768; 1K is about 1 MP; 1.5K about 2 MP; 2K about 4 MP; 4K about 16 MP. Inspect the returned file for actual dimensions.

This endpoint does not accept `width`, `height`, pixel dimensions in `size`, `negative_prompt`, `guidance`, `grounding`, `prompt_upsampling`, `mask`, or `mask_url`. Unknown fields return HTTP 400 before billing. WebP output, base64 input, streaming, and callbacks are not offered.

## Reference images and regional edits

Upload references to a public URL before submitting. The request body contains URLs, never file bytes or data URLs.

```json
{
  "model": "flux-3-image-klein",
  "prompt": "Use Image 1 as the subject and Image 2 as the setting; match the perspective and light",
  "image_urls": ["https://example.com/subject.png", "https://example.com/setting.png"],
  "aspect_ratio": "auto",
  "resolution": "2k",
  "seed": 0,
  "steps": 16,
  "output_format": "png"
}
```

Replace these placeholder URLs with your own accessible images. References are ordered: `ref_image_0` is the first. Bounding-box instructions are part of the `prompt` string, not a separate request field. Coordinates use `[y1, x1, y2, x2]` normalized to 0–1000. A layout object can contain `id`, `bbox`, and `desc`; an edit can use `id`, `from`, `src_bbox`, `tgt_bbox`, and `desc`. JSON-encode the complete request so quotes inside the prompt are escaped correctly.

## Billing

One successful request is one image. The selected resolution alone sets the price; steps, seed, aspect ratio, reference count, and format do not add fees. Text-to-image and editing have the same rate. Failed requests are not charged. See [live pricing](https://seedrouter.ai/models/flux-3-image-klein#pricing).

## Task response and polling

Submission:

```json
{"id":"task_example","model":"flux-3-image-klein","status":"processing"}
```

```bash
curl https://api.seedrouter.ai/v1/tasks/task_example \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY"
```

Completed task (illustrative URL):

```json
{
  "id": "task_example",
  "model": "flux-3-image-klein",
  "status": "completed",
  "output": {"data": [{"url": "https://file.deepytb.com/generated/example.png"}]}
}
```

Read `output.data[0].url`. Allow up to ten minutes for generation, especially at 4K. Polling is read-only; a client timeout is not permission to submit another paid request. Public task responses do not include costs or account balances.

## Errors

HTTP errors use `{"error": {"code": integer, "message": string}}`. See the [shared error directory](https://seedrouter.ai/docs/errors). A failed task exposes its error alongside `status: "failed"`. Correct invalid parameters before resubmitting; retain the task ID when checking a submitted request.

## Tips and related guides

Use positive descriptions and name the regions or details to preserve. Lower steps may alter quality without reducing the price. Compare one change at a time.

* [FLUX 3 Image Klein Playground](https://seedrouter.ai/models/flux-3-image-klein)
* [Download, weights, and ComfyUI guide](https://seedrouter.ai/blog/flux-3-image-klein-download)
* [Task lifecycle](https://seedrouter.ai/docs/api/tasks)
