Xenodia Docs
API 参考

GPT Image-2 API

在 Xenodia 使用 `gpt-image-2` 进行 prompt-only 和 reference-image generation。

gpt-image-2 使用 shared image endpoint:

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

Xenodia 暴露一个 public model ID。Prompt-only 和带 reference image 的请求会自动路由。

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 reference:

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
model必须是 gpt-image-2
prompt必填文本 prompt。
image_input可选 reference image input。存在 reference 时会触发 reference-image mode。
image / image[]可选 multipart reference file fields。
aspect_ratio当前值包括 auto1:19:1616:94:33:4
resolution可选:1K2K4Kaspect_ratio: auto 时只允许 1Kaspect_ratio: 1:1 不能与 4K 一起使用。
output_formatXenodia 上的 GPT Image-2 当前不支持。
async设置 true 后返回 202 task envelope。

Responses and errors

Sync 返回 200data[].url。Async 返回 202task_idstatepoll_url。使用 Task Retrieval 轮询。

常见错误:400 参数无效,401 key 缺失或无效,402 billing boundary,502 generation failure。

本页内容