4o Image API documentation
Integrate 4o Image with your VezAPI key. The operations below share the same authentication and account balance.
https://api.vezapi.comSend Authorization: Bearer YOUR_VEZAPI_KEY. Use a unique Idempotency-Key for each submission; reuse it only when checking the same request.
Generate 4o Image
/api/v1/jobs/createTaskModel IDs: 4o-image-api
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | Required. Must be 4o-image-api. Values: Default: |
callBackUrloptional | string | The URL to receive 4o image generation task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when 4o image generation completes - Callback includes generated image URLs and task information for all variations - Your callback endpoint should accept POST requests with JSON payload containing image generation results - For detailed callback format and implementation guide, see [4o Image Generation Callbacks]([see VezAPI documentation]) - Alternatively, query the task with [Get Task Details](/market/common/get-task-detail) (GET /api/v1/jobs/recordInfo). - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation |
inputrequired | object | |
input.promptoptional | string | (Optional) Text prompt that conveys the creative idea you want the 4o model to render. Required if neither `files_url` nor `file_url` is supplied. At least one of `prompt` or `files_url` must be provided. |
input.files_urloptional | array | (Optional) Up to 5 publicly reachable image URLs to serve as reference or source material. Use this when you want to edit or build upon an existing picture. If you don’t have reliable hosting, upload your images first via our File Upload API quick‑start: [see VezAPI documentation] Supported formats: .jfif, .pjpeg, .jpeg, .pjp, .jpg, .png, .webp. At least one of `prompt` or `files_url` must be provided. |
input.sizerequired | string | (Required) Aspect ratio of the generated image. Must be one of the listed values. Values: |
input.file_urloptional | string | (Optional, Deprecated) File URL, such as an image URL. If file_url is provided, 4o image may create based on this image. This parameter will be deprecated in the future, please use files_url instead. |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"callBackUrl": "https://example.com/input.png",
"input": {
"prompt": "A beautiful sunset over the mountains",
"size": "1:1"
},
"model": "4o-image-api"
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
msgoptional | string | Error message when code != 200 |
dataoptional | object | |
data.taskIdoptional | string | Task ID, can be used with [Get Task Details](/market/common/get-task-detail) to query task status |
HTTP 500
Server error.
| Parameter | Type | Description & constraints |
|---|---|---|
coderequired | integer | Response status code - **200**: Success - Request has been processed successfully - **401**: Unauthorized - Authentication credentials are missing or invalid - **402**: Insufficient Credits - Account does not have enough credits to perform the operation - **404**: Not Found - The requested resource or endpoint does not exist - **408**: Timeout - No result has been returned for over 10 minutes. - **422**: Validation Error - The request parameters failed validation checks - **429**: Rate Limited - Request limit has been exceeded for this resource - **455**: Service Unavailable - System is currently undergoing maintenance - **500**: Server Error - An unexpected error occurred while processing the request - **501**: Generation Failed - Content generation task failed - **505**: Feature Disabled - The requested feature is currently disabled |
msgrequired | string | Response message, error description when failed |
datarequired | object |
Task status and callbacks
For asynchronous tasks, keep the returned taskId. Query GET /api/v1/jobs/recordInfo?taskId=... or provide callBackUrl when creating the task. Only the account that created a task can access it or derive new resources from it.
A timeout can mean the submission was accepted. Inspect the existing request in your dashboard; do not create another task automatically. Callback delivery is retried and may arrive more than once. Deduplicate with X-VezAPI-Event-Id.
Files, logs and billing
Generated media normally follows a 14-day provider lifetime; uploaded files expire after 24 hours. Save the files you need before expiration. VezAPI streams registered files without keeping a permanent media library. Request logs are retained for two calendar months.
Credits are reserved before submission. Final deductions match actual discounted consumption one for one. Unknown usage pauses new paid requests. If available funds cannot cover final usage while protecting other reservations, settlement stays pending until funded; model usage cannot make the wallet negative. Time-based inputs require server-side metadata reads; a failed read prevents submission.