Xenodia Docs
API Reference

GPT Image-2 API

Use GPT Image-2 on Xenodia with one public model ID for prompt-only and reference-image generation.

gpt-image-2 uses the shared image endpoint:

POST https://api.xenodia.xyz/v1/images/generations

Xenodia exposes one public model ID. Prompt-only requests and requests with reference images are routed automatically.

Prompt-only request

{
  "model": "gpt-image-2",
  "prompt": "A crisp technical illustration of an AI gateway routing model calls.",
  "aspect_ratio": "16:9",
  "resolution": "2K",
  "response_format": "url"
}

Reference-image request

{
  "model": "gpt-image-2",
  "prompt": "Use the reference as the product shape and render it in a clean studio.",
  "image_input": [
    "https://example.com/reference.png"
  ],
  "response_format": "url"
}

Multipart file references are accepted through the same shared endpoint:

curl -X POST "https://api.xenodia.xyz/v1/images/generations" \
  -H "Authorization: Bearer $XENODIA_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Use the uploaded reference as the product shape." \
  -F "response_format=url" \
  -F "image=@./reference.png"

Current public rules

reference_input.max_items = 16
accepted_mime = image/jpeg, image/png, image/webp
max_size_per_file_bytes = 31457280
response_format = url

Parameters

FieldNotes
modelMust be gpt-image-2.
promptRequired text prompt.
image_inputOptional reference image input. Presence of references triggers reference-image mode.
image / image[]Optional multipart reference file fields.
aspect_ratioUse values exposed by model discovery. Current public values include auto, 1:1, 9:16, 16:9, 4:3, and 3:4.
resolutionOptional. Current public values are 1K, 2K, and 4K; with aspect_ratio: auto, only 1K is valid, and aspect_ratio: 1:1 cannot be used with 4K.
output_formatNot supported for GPT Image-2 on Xenodia.
asyncSet true to receive a 202 task envelope instead of a sync image response.

Responses and errors

Sync requests return 200 with data[].url. Async requests return 202 with task_id, state, and poll_url. Poll with Task Retrieval.

Common error statuses are 400 for invalid parameters, 401 for missing or invalid keys, 402 for billing boundaries, and 502 for upstream generation failures.

Pricing model

GPT Image-2 is billed per generation call rather than by token count. Use /v1/models as the source of truth before showing price-sensitive UI.

On this page