Skip to content
25 changes: 24 additions & 1 deletion product/ai-gateway/multimodal-capabilities/image-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,32 @@ curl "https://api.portkey.ai/v1/images/generations" \
</Tab>
</Tabs>

## Image Editing

Portkey supports the OpenAI signature to make image edit requests using multipart form data.

```python

from portkey_ai import Portkey

portkey = Portkey(api_key="PORTKEY_API_KEY", provider="openai")
with open("image.png", "rb") as image_file:
image = portkey.images.edit(
model="gpt-image-2",
prompt="Add snow",
image=[("image.png", image_file.read(), "image/png")],
size="1024x1024",
)
```

<Note>
Image edit models currently do not support provider-prefixed model slugs in the request body. Pass the provider in headers and keep `model` as the raw provider model name.
</Note>

### API Reference

[Create Image](/provider-endpoints/images/create-image)
- [Create Image](/provider-endpoints/images/create-image)
- [Create Image Edit](/provider-endpoints/images/create-image-edit)

### OpenAI gpt-image-1 Parameters

Expand Down