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

# Grok Image Image to Image API

> xAI Grok image editing — edit images with up to 3 reference images.

[← Grok Image](https://docs.creatify.ai/api-documentation/ai-generation/models/grok-image.md)

**Model name:** `grok-imagine-image/edit`\
**Generation type:** `image_to_image`\
**Endpoint:** [`POST /api/asset_generator/`](https://docs.creatify.ai/api-reference/ai-generation/post-ai-generation)

## Pricing

**0.5** credits per output.

Prices are per output. When a request asks for several outputs, the charge is this price times the number of outputs.

## Quick start

The example uses sample media from our CDN. Swap in publicly accessible URLs for your own files.

```bash cURL theme={null}
curl --request POST \
  --url https://api.creatify.ai/api/asset_generator/ \
  --header 'Content-Type: application/json' \
  --header 'X-API-ID: your-api-id' \
  --header 'X-API-KEY: your-api-key' \
  --data '{
    "model_name": "grok-imagine-image/edit",
    "input_params": {
      "prompt": "Place her in a bright café with soft morning light.",
      "image_url": "https://d35ghwdno3nak3.cloudfront.net/tutorial/avatar-aurora/recommendation-4.jpg"
    }
  }'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://api.creatify.ai/api/asset_generator/",
    headers={"X-API-ID": "your-api-id", "X-API-KEY": "your-api-key"},
    json={
        "model_name": "grok-imagine-image/edit",
        "input_params": {
            "prompt": "Place her in a bright café with soft morning light.",
            "image_url": "https://d35ghwdno3nak3.cloudfront.net/tutorial/avatar-aurora/recommendation-4.jpg"
        },
    },
)
print(response.json()["id"])
```

## Input parameters

Send these fields in `input_params`.

**prompt** `string` *required*

The text prompt describing the desired edit.

Minimum characters: `3`.
Maximum characters: `8000`.

**image\_url** `string` *required*

URL of the image to edit.

**num\_images** `integer` (default: 1)

Number of images to generate.

Minimum: `1`.
Maximum: `4`.

> [accordion] Complete JSON schema
>
> ```json theme={null}
> {
>   "$schema": "http://json-schema.org/draft-07/schema#",
>   "required": [
>     "prompt",
>     "image_url"
>   ],
>   "properties": {
>     "prompt": {
>       "type": "string",
>       "title": "Prompt",
>       "maxLength": 8000,
>       "minLength": 3,
>       "description": "The text prompt describing the desired edit."
>     },
>     "image_url": {
>       "type": "string",
>       "title": "Reference Image URL",
>       "timeout": 20,
>       "max_width": 4096,
>       "min_width": 128,
>       "max_height": 4096,
>       "min_height": 128,
>       "description": "URL of the image to edit.",
>       "max_file_size": 8388608,
>       "limit_description": "Max file size: 8.0MB, Min width: 128px, Min height: 128px, Max width: 4096px, Max height: 4096px, Timeout: 20.0s"
>     },
>     "num_images": {
>       "type": "integer",
>       "title": "Number of Images",
>       "default": 1,
>       "minimum": 1,
>       "maximum": 4,
>       "x-ui-name": "output_nums",
>       "description": "Number of images to generate."
>     }
>   }
> }
> ```

## Response

The request returns the task with `status: "initializing"`. Poll [GET /api/asset\_generator/\{id}/](https://docs.creatify.ai/api-reference/ai-generation/get-ai-generation-.md) until `status` is `done` or `failed`, or pass a `webhook_url` to be notified. A finished task lists its files in `assets` and the credits it charged in `credits_used`.


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