Skip to main content
Use the Images API when your workflow is primarily about image generation or image editing rather than a broader conversational interaction.

When To Use It

  • generating images from prompts
  • editing an existing image with prompt instructions
  • building image-only tools or automation jobs
If you need multimodal conversations with text, images, files, or audio in the same flow, also review Multimodal Inputs.

Endpoint Families

  • POST /v1/images/generations creates new images from a prompt
  • POST /v1/images/edits edits one or more uploaded images with a prompt and optional mask
The responses return either hosted URLs or base64 image payloads, depending on response_format.

Quick Example

Usage Tracking

The Images API includes a usage object in its response, which you can use to track token consumption. Depending on the model, it typically reports output_tokens or total_tokens corresponding to the generated images.
Example Usage Shape

Reference