/v1/images/generations) for standard image generation workflows, and the Chat Completions API (/v1/chat/completions) for models that return images alongside text.
Images API (/v1/images/generations)
The dedicated images endpoint follows the OpenAI Images API format and is the recommended way to generate images with supported models.
Request Format
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model to use for image generation |
prompt | string | Yes | A text description of the desired image |
n | integer | No | Number of images to generate (default: 1) |
size | string | No | Image dimensions (e.g., 1024x1024, 1536x1024, 1024x1536) |
quality | string | No | Image quality (auto, high, medium, low) |
response_format | string | No | Output delivery format: url or b64_json (default: url) |
background | string | No | Background type: auto, transparent, or opaque |
output_format | string | No | File format: png, jpeg, or webp |
Response Format
The response returns adata array containing the generated images:
response_format is set to b64_json:
Supported Models
| Model | Description |
|---|---|
azure/openai/gpt-image-1 | OpenAI’s GPT Image 1 model via Azure |
azure/openai/gpt-image-1.5 | OpenAI’s GPT Image 1.5 model via Azure |
Chat Completions API (/v1/chat/completions)
Some image generation models use the standard chat completions endpoint and return generated images alongside text responses.
Request Format
Response Format
The response includes both the standard text content and an array of generated images:Python Example
JavaScript/TypeScript Example
Supported Models
| Model | Description |
|---|---|
vertex/google/gemini-2.5-flash-image-preview | Google Gemini image generation via Vertex AI |
Choosing an Endpoint
| Feature | Images API | Chat Completions API |
|---|---|---|
| Endpoint | /v1/images/generations | /v1/chat/completions |
| OpenAI SDK support | client.images.generate() | client.chat.completions.create() |
| Text + image response | No | Yes |
| Conversational context | No | Yes |
| Background control | Yes | No |
| Output format control | Yes (png, jpeg, webp) | No |
Image generation models may have different pricing compared to text models. Check the model library for specific pricing information.
Limitations
- Image size and resolution depend on the specific model capabilities
- Some models may have content filtering or safety restrictions
- Response size limits apply to the combined text and image data