Description

This endpoint generates high-quality AI images using various models with different capabilities and price points. It supports multiple models with customizable parameters for each.

Endpoint

POST /api/v1/generate-ai-image

Headers

  • Content-Type: application/json
  • Authorization: Bearer <API_KEY> (required)

Request Body

{
  "model": "string", // Required. The model to use for image generation
  "input": "object" // Required. Model-specific parameters
}

Supported Models and Their Parameters

FLUX.1-schnell (3 credits per image)

{
  "model": "FLUX.1-schnell",
  "input": {
    "prompt": "string", // Required. Text prompt for image generation
    "seed": "number", // Optional. Random seed for reproducible generation
    "num_outputs": "number", // Optional. Number of images (1-4). Default: 1
    "aspect_ratio": "string", // Optional. One of: "1:1", "16:9", "21:9", "3:2", "2:3", "4:5", "5:4", "3:4", "4:3", "9:16", "9:21". Default: "1:1"
    "output_format": "string", // Optional. One of: "webp", "jpg", "png". Default: "webp"
    "output_quality": "number", // Optional. 0-100. Default: 80
    "num_inference_steps": "number", // Optional. 1-4. Default: 4
    "disable_safety_checker": "boolean", // Optional. Default: false
    "go_fast": "boolean", // Optional. Default: true
    "megapixels": "string" // Optional. "1" or "0.25". Default: "1"
  }
}

FLUX.1-dev (25 credits per image)

{
  "model": "FLUX.1-dev",
  "input": {
    "prompt": "string", // Required. Text prompt for image generation
    "seed": "number", // Optional. Random seed for reproducible generation
    "image": "string", // Optional. Input image URL for image-to-image mode
    "prompt_strength": "number", // Optional. 0-1. Default: 0.8
    "num_outputs": "number", // Optional. Number of images (1-4). Default: 1
    "num_inference_steps": "number", // Optional. 1-50. Default: 28
    "guidance": "number", // Optional. 0-10. Default: 3
    "aspect_ratio": "string", // Optional. Same options as FLUX.1-schnell
    "output_format": "string", // Optional. Same options as FLUX.1-schnell
    "output_quality": "number", // Optional. 0-100. Default: 80
    "disable_safety_checker": "boolean", // Optional. Default: false
    "go_fast": "boolean", // Optional. Default: true
    "megapixels": "string" // Optional. "1" or "0.25". Default: "1"
  }
}

FLUX.1-pro and FLUX.1.1-pro (50 credits per image)

{
  "model": "FLUX.1-pro",
  "input": {
    "prompt": "string", // Required. Text prompt for image generation
    "seed": "number", // Optional. Random seed for reproducible generation
    "steps": "number", // Optional. 1-50. Default: 25
    "width": "number", // Optional. 256-1440. Must be multiple of 32
    "height": "number", // Optional. 256-1440. Must be multiple of 32
    "guidance": "number", // Optional. 2-5. Default: 3
    "interval": "number", // Optional. 1-4. Default: 2
    "aspect_ratio": "string", // Optional. One of: "custom", "1:1", "16:9", "2:3", "3:2", "4:5", "5:4", "9:16", "3:4", "4:3"
    "output_format": "string", // Optional. One of: "webp", "jpg", "png"
    "output_quality": "number", // Optional. 0-100. Default: 80
    "safety_tolerance": "number", // Optional. 1-5. Default: 2
    "prompt_upsampling": "boolean" // Optional. Default: false
  }
}

recraft-v3 (50 credits per image)

{
  "model": "recraft-v3",
  "input": {
    "prompt": "string", // Required. Text prompt for image generation
    "size": "string", // Optional. One of the size options below. Default: "1024x1024"
    "style": "string" // Optional. One of the style options below. Default: "any"
  }
}

Available size options:

  • “1024x1024"
  • "1365x1024"
  • "1024x1365"
  • "1536x1024"
  • "1024x1536"
  • "1820x1024"
  • "1024x1820"
  • "1024x2048"
  • "2048x1024"
  • "1434x1024"
  • "1024x1434"
  • "1024x1280"
  • "1280x1024"
  • "1024x1707"
  • "1707x1024”

Available style options:

  • “any"
  • "realistic_image"
  • "digital_illustration"
  • "digital_illustration/pixel_art"
  • "digital_illustration/hand_drawn"
  • "digital_illustration/grain"
  • "digital_illustration/infantile_sketch"
  • "digital_illustration/2d_art_poster"
  • "digital_illustration/handmade_3d"
  • "digital_illustration/hand_drawn_outline"
  • "digital_illustration/engraving_color"
  • "digital_illustration/2d_art_poster_2"
  • "realistic_image/b_and_w"
  • "realistic_image/hard_flash"
  • "realistic_image/hdr"
  • "realistic_image/natural_light"
  • "realistic_image/studio_portrait"
  • "realistic_image/enterprise"
  • "realistic_image/motion_blur”

Responses

Success (200)

Returns the generated image URLs and usage information.

{
  "images": [
    {
      "url": "string" // URL to the generated image
    }
  ],
  "prompt": "string", // The prompt used for generation
  "creditUsage": "number" // Total credits used for this request
}
  • Content-Type: application/json
  • X-RateLimit-Limit: The rate limit for the user
  • X-RateLimit-Remaining: The remaining number of requests for the user

Bad Request (400)

Returned if the request is invalid.

{
  "error": "Error message describing the issue"
}

Internal Server Error (500)

Returned if there’s an error during the image generation process.

{
  "error": "Failed to generate image: [error message]"
}

Example Request

curl -X POST https://app.dumplingai.com/api/v1/generate-ai-image \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "model": "FLUX.1-schnell",
  "input": {
    "prompt": "A serene landscape with mountains and a lake",
    "num_outputs": 1,
    "aspect_ratio": "16:9"
  }
}'

Notes

  • Credit costs per image vary by model:
    • FLUX.1-schnell: 3 credits
    • FLUX.1-dev: 25 credits
    • FLUX.1-pro: 50 credits
    • FLUX.1.1-pro: 50 credits
    • recraft-v3: 50 credits
  • Total credit usage is calculated as: model cost × number of images generated
  • Generated images are temporarily stored and accessible via the returned URLs
  • Safety checks are enabled by default to prevent NSFW content generation

Rate Limiting

Rate limit headers (X-RateLimit-Limit and X-RateLimit-Remaining) are included in the response to indicate the user’s current rate limit status.