Image Generation

Text-to-image and image editing, compatible with the OpenAI Images API. Available models include nano-banana-pro, nano-banana-2, gpt-image-2, and more — billed per image.

Text-to-Image

POST https://apicdn.xyc.ai/v1/images/generations
from openai import OpenAI

client = OpenAI(base_url="https://apicdn.xyc.ai/v1", api_key="sk-xxxxxxxx")

resp = client.images.generate(
    model="nano-banana-pro",
    prompt="An orange cat running through a neon city, cyberpunk style",
    n=1,
    size="1024x1024",
)
print(resp.data[0].url)
curl https://apicdn.xyc.ai/v1/images/generations \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "An orange cat running through a neon city, cyberpunk style",
    "n": 1,
    "size": "1024x1024"
  }'

Request Parameters

ParameterTypeNotes
modelstringRequired. Image model name
promptstringRequired. Image description
nintNumber of images to generate
sizestringSize, e.g. 1024x1024

Image Editing

POST https://apicdn.xyc.ai/v1/images/edits

Upload the source image and a prompt as multipart/form-data to edit it:

curl https://apicdn.xyc.ai/v1/images/edits \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -F model="gpt-image-2" \
  -F image="@input.png" \
  -F prompt="Replace the background with a seaside sunset"

Response Structure

{
  "created": 1748600000,
  "data": [
    {"url": "https://.../generated.png"}
  ]
}
Video Generation

sora-2 / sora-2-pro are video models, billed per task. See the console for submission details.