Skip to main content
POST

Authorization

  • Auth Type: Bearer Auth (In: header)
  • Format: Authorization: Bearer <YOUR_API_KEY>
  • Description: Use Bearer <YOUR_API_KEY>. Format: Authorization: Bearer sk-xxxxxx.
  • API Key: where API Key is your AGCloud API KEY
Generate images from a text prompt using gpt-image-2. Send a JSON request to https://aiandgpu.com/v1/images/generations.

Request Examples

The success response is illustrative; replace the Base64 placeholder with actual image data before decoding. OpenAI GPT Image responses use data[].b64_json, not image URLs. Do not send response_format or style; describe the desired style in prompt.

Request Parameters

These fields follow the OpenAI Create image reference.

Size and streaming notes

For gpt-image-2, both dimensions must be multiples of 16, each at most 3840 pixels. The longer edge must not exceed three times the shorter edge, and total pixels must be between 655,360 and 8,294,400. Examples include 1024x1024, 1536x1024, 1024x1536, and 1536x864. Resolutions above 2560x1440 are experimental. With stream: true, consume SSE events instead of parsing a single JSON response. Partial images use image_generation.partial_image; the final image uses image_generation.completed. Image bytes are Base64-encoded in b64_json. Fewer previews than requested may arrive if generation completes early; each preview adds 100 image output tokens. See the OpenAI image generation guide for sizing and streaming details.