Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

GPT Image 1 is an OpenAI image generation model for prompt-based image creation and reference-guided generation. Use this page when you are ready to call the API after trying the model in the APIXO playground.
CapabilityValue
Model IDgpt-image-1
Modegpt-image-1
Prompt length1-10000 characters
Reference images0-5 URLs
Aspect ratios1:1, 2:3, 3:2
Number of images1, 2, 4

Endpoint and authentication

Base URL:
https://api.apixo.ai/api/v1
MethodEndpointPurpose
POST/generateTask/gpt-image-1Submit a generation task
GET/statusTask/gpt-image-1?taskId={taskId}Poll task status and retrieve results
All requests require your APIXO API key:
Authorization: Bearer YOUR_API_KEY
Submit requests also require:
Content-Type: application/json

Copy-paste async quickstart

This minimal request submits a text-to-image task and returns a taskId.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/gpt-image-1" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "gpt-image-1",
      "prompt": "a cozy cyberpunk cafe with neon lights",
      "aspect_ratio": "3:2",
      "num_images": 1
    }
  }'
Successful response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Save the taskId; you need it to poll for the final result.

Poll for result

curl -X GET "https://api.apixo.ai/api/v1/statusTask/gpt-image-1?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Processing response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
Success response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/xxx.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
Failed response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "SensitiveContent",
    "failMsg": "Content violates provider policy, please adjust the prompt",
    "createTime": 1767965610929,
    "completeTime": 1767965620132,
    "costTime": 9040
  }
}
Parse resultJson after state becomes success:
const payload = JSON.parse(data.resultJson);
const imageUrls = payload.resultUrls;

Request body

Text-to-image

{
  "request_type": "async",
  "input": {
    "mode": "gpt-image-1",
    "prompt": "a cozy cyberpunk cafe with neon lights",
    "aspect_ratio": "3:2",
    "num_images": 1
  }
}

Reference-guided generation

{
  "request_type": "async",
  "input": {
    "mode": "gpt-image-1",
    "prompt": "turn these references into a futuristic cityscape at sunset",
    "image_urls": [
      "https://example.com/ref1.jpg",
      "https://example.com/ref2.png"
    ],
    "aspect_ratio": "3:2",
    "num_images": 2
  }
}

Parameters

request_type
string
default:"async"
required
Result delivery mode. Use async for polling with statusTask, or callback for webhook delivery.
callback_url
string
Required when request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.
input
object
required
GPT Image 1 input parameters.

Response format

Submit task response

POST /generateTask/gpt-image-1 returns a task ID when the task is accepted:
code
integer
API status code. 200 means the task was accepted.
message
string
Human-readable status message.
data.taskId
string
Unique task identifier used with the status endpoint.

Status response fields

taskId
string
Unique task identifier.
state
string
Current task state: processing, success, or failed.
resultJson
string
JSON string containing the generated image URLs. Present when state is success.
failCode
string
Machine-readable failure code. Present when state is failed.
failMsg
string
Human-readable failure message. Present when state is failed.
createTime
integer
Task creation timestamp in Unix milliseconds.
completeTime
integer
Task completion timestamp in Unix milliseconds. Present after completion.
costTime
integer
Processing duration in milliseconds. Present after completion.

Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/gpt-image-1" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "gpt-image-1",
      "prompt": "a clean product photo of wireless earbuds on soft stone",
      "aspect_ratio": "1:1",
      "num_images": 1
    }
  }'
See Webhooks for delivery requirements and retry behavior.

Billing

GPT Image 1 is billed per generated image. The selected num_images value determines the number of images requested.
UnitAPIXO priceMarket price
Image$0.35 / image$0.40 / image
For current route and market comparison pricing, see Pricing.

Latency and polling

Actual latency may vary by prompt complexity, reference image count, provider route, and current queue load.
Typical generation timeRecommended first pollPoll interval
About 30 seconds20 seconds after task creation3-10 seconds
For high-concurrency production workloads, use callback mode to avoid frequent polling.
Rate limits and concurrency can vary by account, API key, and route. If you receive 429, slow down requests and retry with backoff. For account-level details, see System APIs.

Errors and troubleshooting

HTTP errors

CodeMeaningWhat to do
400Invalid request body, mode, parameter, prompt, or image URL shapeFix the request before retrying
401Missing or invalid API keyCheck the Authorization header
402Insufficient balance or quotaAdd balance or switch account/key
403Key or route cannot access the modelCheck permissions and route strategy
429Rate limit, daily quota, or provider rate limit reachedRetry with exponential backoff
500Server error or unknown upstream errorRetry with backoff
502Upstream provider errorRetry with backoff
504Upstream timeoutRetry or use callback mode for long-running jobs

Task failure codes

Fail codeMeaningWhat to do
SensitiveContentPrompt or output was rejected by provider safety checksChange the prompt or reference image
PromptInvalidPrompt format or content was rejectedRevise the prompt
ImageNotAccessA reference image URL could not be reachedUse a public, direct image URL
ImageFormatIncorrectImage format is incorrectUse a supported image format
RateLimitedProvider or account rate limit was reachedRetry with backoff
TimeoutGeneration did not finish in timeRetry, reduce input complexity, or use callback mode
Unknown errorUnmapped provider-side failureRetry with backoff or try another route

Tips

  • prompt must be a non-empty string and cannot exceed 10000 characters.
  • aspect_ratio is required. Use 1:1 for square outputs, 3:2 for landscape images, or 2:3 for portrait images.
  • num_images is required. Supported values are 1, 2, and 4.
  • image_urls supports JPG, PNG, and WebP reference images, up to 10 MB per image. Use public, direct HTTP(S) image URLs.
  • Result URLs are normally stored for 15 days. Download and store important outputs promptly.
See Error Codes for the full error reference.