# Kling O1 Image

> Perform precise image edits using strong reference control, transforming subjects, styles, and local details while preserving visual consistency.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/kling-image/o1`
- **Model ID**: `fal-ai/kling-image/o1`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: edit, realism, typography



## Pricing

- **Price**: $0.028 per images

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`prompt`** (`string`, _required_):
  Text prompt for image generation. Reference images using @Image1, @Image2, etc. (or @Image if only one image). Max 2500 characters.
  - Examples: "Put @Image1 to the back seat of the car in @Image2, put @Element1 on to the @Image1"

- **`image_urls`** (`list<string>`, _required_):
  List of reference images. Reference images in prompt using @Image1, @Image2, etc. (1-indexed). Max 10 images.
  - Array of string
  - Examples: ["https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input.png","https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input-2.png"]

- **`elements`** (`list<ElementInput>`, _optional_):
  Elements (characters/objects) to include in the image. Reference in prompt as @Element1, @Element2, etc. Maximum 10 total (elements + reference images).
  - Array of ElementInput
  - Examples: [{"reference_image_urls":["https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/element-1-reference.png"],"frontal_image_url":"https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/element-1-front.png"}]

- **`resolution`** (`ResolutionEnum`, _optional_):
  Image generation resolution. 1K: standard, 2K: high-res. Default value: `"1K"`
  - Default: `"1K"`
  - Options: `"1K"`, `"2K"`

- **`num_images`** (`integer`, _optional_):
  Number of images to generate (1-9). Default value: `1`
  - Default: `1`
  - Range: `1` to `9`

- **`aspect_ratio`** (`AspectRatioEnum`, _optional_):
  Aspect ratio of generated images. 'auto' intelligently determines based on input content. Default value: `"auto"`
  - Default: `"auto"`
  - Options: `"auto"`, `"16:9"`, `"9:16"`, `"1:1"`, `"4:3"`, `"3:4"`, `"3:2"`, `"2:3"`, `"21:9"`

- **`output_format`** (`OutputFormatEnum`, _optional_):
  The format of the generated image. Default value: `"png"`
  - Default: `"png"`
  - Options: `"jpeg"`, `"png"`, `"webp"`

- **`sync_mode`** (`boolean`, _optional_):
  If `True`, the media will be returned as a data URI and the output data won't be available in the request history.
  - Default: `false`

- **`enable_safety_checker`** (`boolean`, _optional_):
  Authorized callers may set false to request relaxed screening. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{
  "prompt": "Put @Image1 to the back seat of the car in @Image2, put @Element1 on to the @Image1",
  "image_urls": [
    "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input.png",
    "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input-2.png"
  ]
}
```

**Full Example**:

```json
{
  "prompt": "Put @Image1 to the back seat of the car in @Image2, put @Element1 on to the @Image1",
  "image_urls": [
    "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input.png",
    "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input-2.png"
  ],
  "elements": [
    {
      "reference_image_urls": [
        "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/element-1-reference.png"
      ],
      "frontal_image_url": "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/element-1-front.png"
    }
  ],
  "resolution": "1K",
  "num_images": 1,
  "aspect_ratio": "auto",
  "output_format": "png",
  "enable_safety_checker": true
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<Image>`, _required_):
  Generated images
  - Array of Image
  - Examples: [{"content_type":"image/png","file_name":"d4eeaeaeae294a41b0321ba6c99f0f9d.png","url":"https://storage.googleapis.com/falserverless/example_outputs/kling-image-o1/output.png","file_size":1419818}]



**Example Response**:

```json
{
  "images": [
    {
      "content_type": "image/png",
      "file_name": "d4eeaeaeae294a41b0321ba6c99f0f9d.png",
      "url": "https://storage.googleapis.com/falserverless/example_outputs/kling-image-o1/output.png",
      "file_size": 1419818
    }
  ]
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/kling-image/o1 \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "prompt": "Put @Image1 to the back seat of the car in @Image2, put @Element1 on to the @Image1",
     "image_urls": [
       "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input.png",
       "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input-2.png"
     ]
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/kling-image/o1",
    arguments={
        "prompt": "Put @Image1 to the back seat of the car in @Image2, put @Element1 on to the @Image1",
        "image_urls": ["https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input.png", "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input-2.png"]
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/kling-image/o1", {
  input: {
    prompt: "Put @Image1 to the back seat of the car in @Image2, put @Element1 on to the @Image1",
    image_urls: ["https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input.png", "https://storage.googleapis.com/falserverless/example_inputs/kling-image-o1/input-2.png"]
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/kling-image/o1)
- [API Documentation](https://fal.ai/models/fal-ai/kling-image/o1/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/kling-image/o1)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
