Skip to Content

GPT-4o-image Image Generation

Asynchronous image generation and editing with task ID based result retrieval.

Endpoint

POST https://123api.co/v1/images/generations

Request Example

curl --request POST \ --url https://123api.co/v1/images/generations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "gpt-4o-image", "prompt": "An ancient castle under the starry sky", "size": "1:1", "n": 1 }'

Edit Workflow Example

curl --request POST \ --url https://123api.co/v1/images/generations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "gpt-4o-image", "prompt": "Turn this product shot into a clean studio-style advertising image", "size": "1:1", "n": 1, "image_urls": [ "https://your-uploaded-image-url.example.com/source.png" ] }'

Common Parameters

FieldTypeDescription
modelstringExample: gpt-4o-image
promptstringImage instruction
sizestringOutput aspect ratio or size option
nnumberNumber of images to generate
image_urlsarrayOptional reference images for edit workflows

Typical Response

{ "task_id": "task-unified-123456", "status": "queued", "model": "gpt-4o-image" }

Result Handling

The response typically returns a task ID. Query task status to retrieve the final result.

Best Practices