Generate images
Image Generation API
Generate images from text prompts using AI models like OpenAI GPT-Image 1 and Google Imagen.
Supported Models
- openai/gpt-image-1: OpenAI's latest image model with editing, inpainting, and outpainting support via the Images API
- imagen-4.0-generate-001: Google Imagen 4.0 for high-quality image generation
Request Parameters
- prompt: Text description of the image to generate
- n: Number of images to generate (1-8)
- size: Image dimensions (e.g., "1024x1024", "1920x1080")
- quality: Model-specific quality tier (e.g., "low/medium/high" for GPT-Image 1, "standard/hd" for Imagen)
- response_format: "url" or "b64_json"
Pricing
Images are charged per generated output image. GPT-Image 1 supports granular pricing per quality tier and resolution (e.g., low 1024x1024 at $0.011), while Google Imagen continues to offer standard vs. HD (2x) pricing.
- Platform fee: 20% added to the computed base cost
Enter your JWT token in the format: Bearer
In: header
Image model identifier to call for generation.
Text prompt describing the desired image content.
1 <= length <= 4000
Number of images to generate (1-8).
1
1 <= value <= 8
Output resolution, e.g. 1024x1024 or 1920x1080.
"1024x1024"
"256x256" | "512x512" | "1024x1024" | "2048x2048" | "1024x768" | "768x1024" | "1920x1080" | "1080x1920"
Image quality level. Some models support low/medium/high tiers; HD doubles cost for legacy Imagen models.
"standard"
"standard" | "hd" | "low" | "medium" | "high"
Style preset applied to the generation.
"natural"
"natural" | "vivid"
Whether to return URLs or base64 JSON payloads.
"url"
"url" | "b64_json"
Optional end-user identifier forwarded for moderation.
Response Body
curl -X POST "https://api-beta.daydreams.systems/v1/images/generations" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-1",
"prompt": "A beautiful sunset over mountains",
"n": 1,
"size": "1024x1024",
"quality": "medium",
"response_format": "url"
}'
{
"created": 1699896901,
"data": [
{
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
}
]
}
{
"error": "Invalid model specified",
"code": "INVALID_MODEL",
"message": "The specified model is not available"
}
{
"error": "Invalid API key",
"code": "INVALID_API_KEY",
"message": "The provided API key is not valid"
}
{
"error": "Insufficient balance",
"code": "INSUFFICIENT_BALANCE",
"message": "Account balance is too low for this operation",
"current_balance": 1.25,
"required_amount": 5
}
{
"error": "Rate limit exceeded",
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later.",
"retry_after": 60
}
{
"error": "Internal server error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred while processing your request"
}