Transform your text descriptions into stunning visuals with our powerful Image Generation API. Perfect for developers, designers, and businesses looking to automate image creation, generate marketing assets, or build creative applications. Our API supports multiple leading AI models and offers enterprise-grade reliability with detailed usage analytics.
The Image Generation API allows developers to create images from textual descriptions using state-of-the-art AI models. The API is fully compliant with OpenAI's API structure, enabling easy integration and migration from existing OpenAI-based applications.
Simply change the URL and your API key, and your application built on the OpenAI API can start using APIpie immediately. Once integrated, you can leverage all our additional features and capabilities.
The AI image generation landscape is rapidly evolving, with new models and capabilities being released regularly. Visit our models route for the most up-to-date list of supported image models and their capabilities. Here's a current comparison of major models:
| Feature | DALL-E 3 | DALL-E 2 | Stable Diffusion XL | Stable Diffusion 2.1 | Flux | Amazon Titan |
|---|---|---|---|---|---|---|
| Style Control | β | β | β | β | β | β |
| Image Editing | β | β | β | β | β | β |
| Photorealistic Quality | High | Medium | High | Medium-High | High | High |
| Processing Speed | Fast | Very Fast | Medium | Fast | Fast | Fast |
| Cost | Higher | Medium | Lower | Lower | Medium | Medium |
| Customization | Limited | Limited | Extensive | Extensive | Moderate | Moderate |
DALL-E 3 (OpenAI Documentation)
Explore DALL-E 3's advanced capabilities in OpenAI's Comprehensive Guide to DALL-E 3
DALL-E 2 (Model Overview)
Understand DALL-E 2's features and limitations in the Official DALL-E 2 System Card
Stable Diffusion Models (Stability AI)
Flux (Official Documentation)
Explore Flux's technical details and implementation guides in the Official Flux Model Repository
Amazon Titan (AWS Documentation)
Discover AWS Titan's enterprise capabilities in the AWS Titan Image Generation Guide
The image generation field is rapidly advancing, with new models and capabilities being released frequently. Key trends include:
For the most current information about available models and their capabilities, always refer to our models documentation. We regularly update our supported models to include the latest advancements in the field.
A typical API call sends a text prompt describing the desired image, along with optional parameters to control the generation process. The API then processes this input and returns either a URL to the generated image or the image data directly as a base64-encoded string, depending on your specified response format.
Below is an example of how to use the Image Generation API to create an image:
curl -L -X POST 'https://apipie.ai/v1/images/generations' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data-raw '{
"provider": "openai",
"model": "dall-e-3",
"prompt": "A serene lake at sunset with mountains in the background",
"n": 1,
"size": "1024x1024",
"quality": "standard",
"style": "natural"
}'
The expected response structure looks like the following:
{
"created": 1729535643,
"data": [
{
"url": "https://apipie.ai/temp/47g43g6f476vf.jpg",
"revised_prompt": "A tranquil mountain lake reflecting the warm colors of sunset, with majestic peaks silhouetted against a golden sky, creating a peaceful and atmospheric natural scene"
}
]
}
curl -L -X POST 'https://apipie.ai/v1/images/generations' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data-raw '{
"provider": "openai",
"model": "dall-e-3",
"prompt": "A futuristic cityscape at night with flying cars and neon lights",
"n": 1,
"size": "1024x1024",
"quality": "hd",
"style": "vivid",
"response_format": "b64_json"
}'
{
"created": 1729535643,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
"revised_prompt": "A sprawling futuristic metropolis illuminated by vibrant neon signs and streams of flying vehicles weaving between towering skyscrapers, creating a dynamic and energetic nighttime cityscape"
}
]
}
Our Image Generation API supports a wide range of applications:
We provide comprehensive usage data with every request to help you track costs and performance. Metrics include:
{
"created": 1729535643,
"data": [
{
"url": "https://apipie.ai/temp/47g43g6f476vf.jpg",
"revised_prompt": "A serene lake at sunset with mountains in the background"
}
],
"usage": {
"cost": 0.04,
"latency_ms": 4521,
"image_size": "1024x1024",
"model_used": "dall-e-3"
}
}
Note: We provide detailed usage tracking for every request. Historical billing data is available via API for audit purposes.
Different models excel at different types of images and use cases:
DALL-E 3
DALL-E 2
Stable Diffusion Models
Flux
Amazon Titan
DALL-E 3
Stable Diffusion
Flux
Amazon Titan
To get the best results from the Image Generation API, consider these prompt engineering tips:
Common errors and their solutions:
{
"error": {
"code": "rate_limit_exceeded",
"message": "You have exceeded your rate limit. Please try again later."
}
}
Solution: Implement exponential backoff in your requests.
{
"error": {
"code": "invalid_parameter",
"message": "The 'size' parameter must be one of: 1024x1024, 1024x1792, 1792x1024"
}
}
Solution: Verify parameter values against the documentation.
{
"error": {
"code": "content_policy_violation",
"message": "Your request was rejected as it violates our content policy."
}
}
Solution: Review and adjust your prompt to comply with content guidelines.
Chat Completions Guide: Multi-Provider Integrations
Learn how to integrate conversational AI from multiple providers using APIpie's Chat Completions API. Features, examples, and best practices.
RAG Tuning Guide: Enhance AI Responses
Discover RAG Tuning for AIβenhance responses with your data for accurate, cost-effective solutions without complex training. Try it today!