curl --request POST \
--url https://apiany.ai/v1/images/generations/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2.6",
"prompt": "A polished studio photograph of an orange ceramic robot",
"output_format": "png",
"size": "1:1",
"n": 1
}
'
{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"input_tokens": 123,
"output_tokens": 123,
"cached_input_tokens": 123
}
}{
"task_id": "task_123",
"status": "pending",
"poll_url": "/v1/tasks/task_123",
"model": "<string>"
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"param": "<string>",
"code": "<string>"
}
}Images
创建图片生成并等待结果
创建图片任务并等待至最大等待时长。GPT Image 2.6 完成后在 data[0].url 返回一个 PNG 或 GIF 动图地址;HTTP 202 表示需要继续轮询返回的任务。
POST
/
v1
/
images
/
generations
/
sync
curl --request POST \
--url https://apiany.ai/v1/images/generations/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2.6",
"prompt": "A polished studio photograph of an orange ceramic robot",
"output_format": "png",
"size": "1:1",
"n": 1
}
'
{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"input_tokens": 123,
"output_tokens": 123,
"cached_input_tokens": 123
}
}{
"task_id": "task_123",
"status": "pending",
"poll_url": "/v1/tasks/task_123",
"model": "<string>"
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"param": "<string>",
"code": "<string>"
}
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Allowed value:
"gpt-image-2"Accepts auto, a positive WIDTHxHEIGHT target, or ratio shorthand such as 16:9. Every non-auto target is mapped to the nearest official popular size: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160, or 2160x3840.
示例:
"auto"
"1024x1024"
"1280x720"
"16:9"
GPT-Image 2 rendering quality.
可用选项:
auto, low, medium, high Number of images to generate. Billing scales with the image count.
必填范围:
1 <= x <= 10Deprecated ratio shorthand. The ratio and compatibility tier are mapped to the nearest official popular size.
Deprecated compatibility tier used to form the target size before nearest-official-size mapping.
可用选项:
1K, 2K, 4K