Image Generation (GPT-Image)
Text-to-Image
POST https://api.4allapi.com/v1/images/generationscurl https://api.4allapi.com/v1/images/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $AIPROXY_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "Cyberpunk-style city night scene, neon lights, streets after rain", "n": 1, "size": "1024x1024" }'| Parameter | Description |
|---|---|
model | Image model name, such as the gpt-image-2 series |
prompt | Description of the image; recommended to include subject, style, composition, and lighting |
n | Number of images to generate |
size | Resolution, such as 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait) |
quality | Quality tier (supported models) |
The response returns an image URL or base64 (b64_json); the URL is valid for a limited time, so please transfer it promptly.
Image-to-Image / Edit
POST https://api.4allapi.com/v1/images/editsUpload a reference image as multipart/form-data:
curl https://api.4allapi.com/v1/images/edits \ -H "Authorization: Bearer $AIPROXY_KEY" \ -F model="gpt-image-2" \ -F image="@input.png" \ -F prompt="Replace the background with a seaside at dusk, keeping the person unchanged"High-Resolution Variants
Some GPT-Image models provide 2K / 4K and landscape/portrait variants (subject to the models actually listed in the model marketplace,
such as suffixes like -2k / -4k). Simply select the corresponding variant model name; no additional parameters are needed, and billing is based on variant pricing.