# Joyai Image Edit

> All-in-one image AI with JoyAI-Image. Understand, create, and edit images through natural language—the model's deep visual understanding powers more accurate generation and precise editing in a unified system.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/joyai-image-edit`
- **Model ID**: `fal-ai/joyai-image-edit`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: image-to-image, image-editing



## Pricing

Your requests will cost **$0.1** per megapixel.

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_):
  The edit instruction describing what changes to make to the image.
  - Examples: "Add a red hat to the dog"

- **`image_url`** (`string`, _required_):
  URL of the input image to edit.
  - Examples: "https://storage.googleapis.com/falserverless/example_inputs/dog.png"

- **`negative_prompt`** (`string`, _optional_):
  Text describing what should not appear in the output image. Default value: `""`
  - Default: `""`

- **`seed`** (`integer`, _optional_):
  Random seed for reproducibility.

- **`num_inference_steps`** (`integer`, _optional_):
  Number of denoising steps. Default value: `30`
  - Default: `30`
  - Range: `1` to `50`

- **`guidance_scale`** (`float`, _optional_):
  Controls how closely the output follows the edit instruction. Default value: `5`
  - Default: `5`
  - Range: `1` to `15`

- **`enable_safety_checker`** (`boolean`, _optional_):
  Enable safety checking on input and output. Default value: `true`
  - Default: `true`

- **`output_format`** (`OutputFormatEnum`, _optional_):
  Output image format. Default value: `"jpeg"`
  - Default: `"jpeg"`
  - Options: `"jpeg"`, `"png"`

- **`sync_mode`** (`boolean`, _optional_):
  If True, return image as data URI.
  - Default: `false`



**Required Parameters Example**:

```json
{
  "prompt": "Add a red hat to the dog",
  "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.png"
}
```

**Full Example**:

```json
{
  "prompt": "Add a red hat to the dog",
  "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.png",
  "num_inference_steps": 30,
  "guidance_scale": 5,
  "enable_safety_checker": true,
  "output_format": "jpeg"
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<Image>`, _required_):
  The edited output image.
  - Array of Image
  - Examples: [{"width":1024,"url":"https://v3b.fal.media/files/b/0a951738/yWOL7Oie3FQfzM9_HD5BJ.jpg","content_type":"image/jpeg","height":1024}]

- **`timings`** (`Timings`, _required_)

- **`seed`** (`integer`, _required_):
  Seed of the generated Image. It will be the same value of the one passed in the
  input or the randomly generated that was used in case none was passed.

- **`has_nsfw_concepts`** (`list<boolean>`, _required_):
  Whether the generated images contain NSFW concepts.
  - Array of boolean

- **`prompt`** (`string`, _required_):
  The prompt used for generating the image.



**Example Response**:

```json
{
  "images": [
    {
      "width": 1024,
      "url": "https://v3b.fal.media/files/b/0a951738/yWOL7Oie3FQfzM9_HD5BJ.jpg",
      "content_type": "image/jpeg",
      "height": 1024
    }
  ],
  "prompt": ""
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/joyai-image-edit \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "prompt": "Add a red hat to the dog",
     "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.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/joyai-image-edit",
    arguments={
        "prompt": "Add a red hat to the dog",
        "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.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/joyai-image-edit", {
  input: {
    prompt: "Add a red hat to the dog",
    image_url: "https://storage.googleapis.com/falserverless/example_inputs/dog.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/joyai-image-edit)
- [API Documentation](https://fal.ai/models/fal-ai/joyai-image-edit/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/joyai-image-edit)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
