Image Generation API
Generate images using state-of-the-art models including DALL-E 3, Stable Diffusion 3, Flux, and Ideogram. The API follows the OpenAI Images API format for easy integration.Endpoint
Authentication
Include your API key in the Authorization header:Request Body
Required Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | string | A text description of the desired image (max 4000 chars) |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | dall-e-3 | Model to use for generation |
n | number | 1 | Number of images to generate (1 for DALL-E 3, 1-10 for others) |
size | string | 1024x1024 | Image dimensions |
quality | string | standard | Quality level (standard or hd, DALL-E 3 only) |
style | string | vivid | Style preset (vivid or natural, DALL-E 3 only) |
response_format | string | url | Return format (url or b64_json) |
Supported Models
| Model | Provider | Sizes | Max Images | Pricing |
|---|---|---|---|---|
dall-e-3 | OpenAI | 1024x1024, 1792x1024, 1024x1792 | 1 | 0.080/image (HD) |
dall-e-2 | OpenAI | 256x256, 512x512, 1024x1024 | 10 | $0.016-0.020/image |
stable-diffusion-3 | Stability AI | 1024x1024, custom | 4 | $0.035/image |
flux-pro | Black Forest Labs | 1024x1024, custom | 4 | $0.055/image |
flux-dev | Black Forest Labs | 1024x1024, custom | 4 | $0.025/image |
ideogram-2 | Ideogram | 1024x1024, custom | 4 | $0.040/image |
imagen-3 | 1024x1024 | 4 | $0.040/image |
Request Examples
cURL
JavaScript
Python
Response
Success Response (200 OK)
Response Fields
| Field | Type | Description |
|---|---|---|
created | number | Unix timestamp of generation |
data | array | Array of generated images |
data[].url | string | URL to the generated image (expires after 1 hour) |
data[].b64_json | string | Base64-encoded image (if response_format: "b64_json") |
data[].revised_prompt | string | The actual prompt used (DALL-E 3 rewrites prompts) |
perf.request_id | string | Unique request identifier for tracking |
perf.model_used | string | Model that generated the image |
perf.size | string | Image dimensions |
perf.quality | string | Quality level used |
perf.cost_usd | number | Cost of this generation |
perf.latency_ms | number | Generation time in milliseconds |
Prompt Best Practices
Be Specific
Specify Style
Use Negative Guidance
For models that support it, describe what you don’t want:Error Responses
400 Bad Request
400 Content Policy Violation
429 Rate Limit
Rate Limits
| Tier | Images/Minute | Images/Day |
|---|---|---|
| Free | 5 | 50 |
| Pro | 30 | 1,000 |
| Enterprise | Custom | Custom |
Related Endpoints
- Chat API (with Vision) - Send images to models for analysis
- Video Generation - Generate video content
- Audio Generation - Text-to-speech and transcription