- Vision understanding: read and analyze images.
- Image generation: create images from text prompts.
- Image editing: modify an existing image.
Vision understanding
Use a vision-capable chat model and include both text and image content inmessages.
Image URL
Base64 image data
For local files, encode the image and pass adata: URI:
Python example
Image generation
Use/v1/images/generations with a supported image model:
response_format and model support.
Image editing
Use/v1/images/edits when a model supports image-to-image editing. These requests usually use multipart/form-data:
Prompting tips
- Describe subject, style, composition, lighting, color palette, and background.
- State important constraints directly.
- For analysis tasks, ask for the exact format you need.
- Combine vision with structured output when downstream code needs fields.
Billing notes
- Vision understanding usually counts image input as tokens.
- Image generation and editing may be priced per image, by size, or by model-specific units.
- Review current prices in models and pricing.
