Xenodia Docs
API 参考

Image Generation API

Create image tasks with Xenodia's shared image endpoint, model-specific parameters, and reference input.

Use POST /v1/images/generations to create a public image generation task. Multiple models share the same endpoint, but supported parameters and pricing can differ by model. The endpoint returns a task immediately; poll the task endpoint for the final image URL.

Endpoint

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

Minimal request

{
  "model": "gpt-image-2",
  "prompt": "A clean product render of a translucent AI gateway cube on a white desk.",
  "response_format": "url"
}

Task request

{
  "model": "nano-banana-pro",
  "prompt": "A cinematic dashboard screenshot for a developer API product.",
  "aspect_ratio": "16:9",
  "resolution": "2K",
  "response_format": "url"
}

The request returns a task identifier. Poll it with Task Retrieval. The async field can still be sent for backward compatibility, but image generation always uses task mode.

Reference inputs

支持 reference 的模型可以接受 image_input URL 或 multipart file。

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

Multipart request:

curl -X POST "https://api.xenodia.xyz/v1/images/generations" \
  -H "Authorization: Bearer $XENODIA_API_KEY" \
  -F "model=nano-banana-pro" \
  -F "prompt=Render the uploaded reference as a clean product image." \
  -F "response_format=url" \
  -F "image=@./reference.png"

Multipart fields:modelpromptasyncresponse_formataspect_ratioresolutionoutput_formatnchannel_id、重复的 image_input / image_input[] URL fields,以及重复的 image / image[] file fields。

Responses

Image requests return a 202 task envelope:

{
  "task_id": "task_123",
  "object": "task",
  "model": "nano-banana-pro",
  "type": "image",
  "state": "waiting",
  "created_at": 1760000000,
  "poll_url": "/v1/tasks/task_123"
}

Shared rules

  • 使用 /v1/models 确认当前模型限制。
  • 除非 discovery 明确支持,否则 n 保持 1
  • 使用 response_format: "url";当前不支持 base64 image response。
  • Store the returned task_id and poll poll_url until success or fail.
  • 如果返回 URL 是临时资源,应尽快下载生成资产。

本页内容