curl --request POST \
--url https://api.octen.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-image-2",
"prompt": "A shiba inu wearing an astronaut helmet, flat illustration, starry background",
"n": 1,
"size": "1536x1024",
"quality": "high",
"output_format": "png"
}
'{
"id": "img-9f2c1a7b3e6d4082",
"created": 1749812456,
"model": "openai/gpt-image-2",
"background": "opaque",
"output_format": "png",
"quality": "high",
"size": "1536x1024",
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"usage": {
"input_tokens": 22,
"input_tokens_details": {
"text_tokens": 22,
"image_tokens": 0
},
"output_tokens": 1056,
"output_tokens_details": {
"image_tokens": 1056,
"text_tokens": 0
},
"total_tokens": 1078
}
}Auto Search
Image Generation API Reference
Compatible with the OpenAI Images protocol. Text-to-image when no image is provided; image editing when an image is provided.
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://api.octen.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-image-2",
"prompt": "A shiba inu wearing an astronaut helmet, flat illustration, starry background",
"n": 1,
"size": "1536x1024",
"quality": "high",
"output_format": "png"
}
'{
"id": "img-9f2c1a7b3e6d4082",
"created": 1749812456,
"model": "openai/gpt-image-2",
"background": "opaque",
"output_format": "png",
"quality": "high",
"size": "1536x1024",
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"usage": {
"input_tokens": 22,
"input_tokens_details": {
"text_tokens": 22,
"image_tokens": 0
},
"output_tokens": 1056,
"output_tokens_details": {
"image_tokens": 1056,
"text_tokens": 0
},
"total_tokens": 1078
}
}Authorizations
bearerAuthapiKeyAuth
Body
application/jsonmultipart/form-data
JSON request body for the Image Generation API.
The model to use. Aliases nano-banana-pro (= google/gemini-3-pro-image) and nano-banana-2 (= google/gemini-3.1-flash-image) are also accepted.
Available options:
openai/gpt-image-2.6-flare, openai/gpt-image-2.6-sunburst, openai/gpt-image-2.5-flare, openai/gpt-image-2.5-sunburst, openai/gpt-image-2, google/gemini-3-pro-image, google/gemini-3.1-flash-image Response
Successful image response. When stream=false, returns a single object. When stream=true (GPT only), returns an SSE stream of image_generation.partial_image / image_edit.partial_image preview events followed by a image_generation.completed / image_edit.completed event.
- Non-streaming
- Streaming
A non-streaming image response. Images are always returned as base64.
Was this page helpful?