curl -X POST "https://t.ato2.nodesms.com/v1/images/generations" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A cute baby sea otter wearing a beret",
"n": 1,
"size": "1024x1024"
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.images.generate(
model="dall-e-3",
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/image.png"
}
],
"usage": {
"total_tokens": 500,
"input_tokens": 300,
"output_tokens": 200,
"input_tokens_details": {
"text_tokens": 300,
"image_tokens": 0
}
}
}
Image Generation
Generate images from text descriptions, compatible with the OpenAI Images API format.
POST
/
v1
/
images
/
generations
curl -X POST "https://t.ato2.nodesms.com/v1/images/generations" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A cute baby sea otter wearing a beret",
"n": 1,
"size": "1024x1024"
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.images.generate(
model="dall-e-3",
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/image.png"
}
],
"usage": {
"total_tokens": 500,
"input_tokens": 300,
"output_tokens": 200,
"input_tokens_details": {
"text_tokens": 300,
"image_tokens": 0
}
}
}
Creates an image given a prompt. Learn more.
Headers
string
required
Bearer token authentication. Format:
Bearer <token>Body
Format:application/json
string
The model to use for image generation. One of
dall-e-2, dall-e-3, or gpt-image-1. Defaults to dall-e-2 unless a parameter specific to gpt-image-1 is used.string
required
A text description of the desired image. Maximum length is 32,000 characters for
gpt-image-1, 1,000 characters for dall-e-2, and 4,000 characters for dall-e-3.integer
The number of images to generate. Must be between 1 and 10. For
dall-e-3, only n=1 is supported.string
The size of the generated image. For
gpt-image-1, must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default); for dall-e-2, must be one of 256x256, 512x512, or 1024x1024; for dall-e-3, must be one of 1024x1024, 1792x1024, or 1024x1792.string
Allows setting transparency for the background of the generated image. This parameter is only supported for
gpt-image-1. Must be one of transparent, opaque, or auto (default). When set to auto, the model will automatically determine the best background for the image.If the background is transparent, the output format must support transparency, so it should be set to png (default) or webp.string
Controls the content moderation level for images generated by
gpt-image-1. Must be low (less restrictive filtering) or auto (default).string
The quality of the generated image.
string
Whether to stream the response.
string
The style of the generated image.
string
A unique identifier representing the end user.
Response
200
Format:application/json
integer
required
Creation timestamp (Unix time).
object[]
required
object
required
curl -X POST "https://t.ato2.nodesms.com/v1/images/generations" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A cute baby sea otter wearing a beret",
"n": 1,
"size": "1024x1024"
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
response = client.images.generate(
model="dall-e-3",
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/image.png"
}
],
"usage": {
"total_tokens": 500,
"input_tokens": 300,
"output_tokens": 200,
"input_tokens_details": {
"text_tokens": 300,
"image_tokens": 0
}
}
}
Last modified on October 28, 2026
Was this page helpful?