curl -X POST "https://t.ato2.nodesms.com/v1/images/edits/" \
-H "Authorization: Bearer $API_KEY" \
-F image="@otter.png" \
-F mask="@mask.png" \
-F prompt="A cute baby sea otter wearing a beret"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.images.edit(
model="dall-e-2",
image=open("otter.png", "rb"),
mask=open("mask.png", "rb"),
prompt="A cute baby sea otter wearing a beret",
n=1,
size="1024x1024"
)
print(response.data[0].url)
{
"created": 1719123456,
"data": [
{
"url": "https://example.com/edited_image.png"
}
]
}
Image Edits
Creates an edited or extended image given an original image and a prompt. Native OpenAI format.
POST
/
v1
/
images
/
edits
/
curl -X POST "https://t.ato2.nodesms.com/v1/images/edits/" \
-H "Authorization: Bearer $API_KEY" \
-F image="@otter.png" \
-F mask="@mask.png" \
-F prompt="A cute baby sea otter wearing a beret"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.images.edit(
model="dall-e-2",
image=open("otter.png", "rb"),
mask=open("mask.png", "rb"),
prompt="A cute baby sea otter wearing a beret",
n=1,
size="1024x1024"
)
print(response.data[0].url)
{
"created": 1719123456,
"data": [
{
"url": "https://example.com/edited_image.png"
}
]
}
Headers
string
required
Bearer token authentication. Format:
Bearer <token>Body
Format:multipart/form-data
file
required
The image to edit. Must be a valid PNG file, less than 4MB, and square. If no mask is provided, the image must have transparency, which will be used as the mask.Format:
binaryfile
An additional image whose fully transparent areas (e.g., where alpha is zero) indicate where the
image should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as the original image.Format: binarystring
required
A text description of the desired image. Maximum length is 1,000 characters.
string
The number of images to generate. Must be between 1 and 10.
string
The size of the generated image. Must be one of
256x256, 512x512, or 1024x1024.string
The format in which the generated images are returned. Must be
url or b64_json.string
A unique identifier representing your end user, which can help OpenAI monitor and detect abuse. Learn more.
string
Model ID.
Response
200
Format:application/json
integer
Creation timestamp (Unix time).
curl -X POST "https://t.ato2.nodesms.com/v1/images/edits/" \
-H "Authorization: Bearer $API_KEY" \
-F image="@otter.png" \
-F mask="@mask.png" \
-F prompt="A cute baby sea otter wearing a beret"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.images.edit(
model="dall-e-2",
image=open("otter.png", "rb"),
mask=open("mask.png", "rb"),
prompt="A cute baby sea otter wearing a beret",
n=1,
size="1024x1024"
)
print(response.data[0].url)
{
"created": 1719123456,
"data": [
{
"url": "https://example.com/edited_image.png"
}
]
}
Last modified on October 28, 2026
Was this page helpful?