V1ImagesGenerations

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
POST
/v1/images/generations
AuthorizationBearer <token>

Enter your JWT token in the format: Bearer

In: header

modelstring

Image model identifier to call for generation.

promptstring

Text prompt describing the desired image content.

Length1 <= length <= 4000
n?integer

Number of images to generate (1-8).

Default1
Range1 <= value <= 8
size?string

Output resolution, e.g. 1024x1024 or 1920x1080.

Default"1024x1024"
Value in"256x256" | "512x512" | "1024x1024" | "2048x2048" | "1024x768" | "768x1024" | "1920x1080" | "1080x1920"
quality?string

Image quality level. Some models support low/medium/high tiers; HD doubles cost for legacy Imagen models.

Default"standard"
Value in"standard" | "hd" | "low" | "medium" | "high"
style?string

Style preset applied to the generation.

Default"natural"
Value in"natural" | "vivid"
response_format?string

Whether to return URLs or base64 JSON payloads.

Default"url"
Value in"url" | "b64_json"
user?string

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"
}