Generate AI image
curl --request POST \
--url https://app.dumplingai.com/api/v1/generate-ai-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "FLUX.1-schnell",
"input": {
"prompt": "A dumpling-shaped rocket launching",
"aspect_ratio": "16:9"
}
}
'import requests
url = "https://app.dumplingai.com/api/v1/generate-ai-image"
payload = {
"model": "FLUX.1-schnell",
"input": {
"prompt": "A dumpling-shaped rocket launching",
"aspect_ratio": "16:9"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'FLUX.1-schnell',
input: {prompt: 'A dumpling-shaped rocket launching', aspect_ratio: '16:9'}
})
};
fetch('https://app.dumplingai.com/api/v1/generate-ai-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.dumplingai.com/api/v1/generate-ai-image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'FLUX.1-schnell',
'input' => [
'prompt' => 'A dumpling-shaped rocket launching',
'aspect_ratio' => '16:9'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.dumplingai.com/api/v1/generate-ai-image"
payload := strings.NewReader("{\n \"model\": \"FLUX.1-schnell\",\n \"input\": {\n \"prompt\": \"A dumpling-shaped rocket launching\",\n \"aspect_ratio\": \"16:9\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.dumplingai.com/api/v1/generate-ai-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"FLUX.1-schnell\",\n \"input\": {\n \"prompt\": \"A dumpling-shaped rocket launching\",\n \"aspect_ratio\": \"16:9\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/generate-ai-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"FLUX.1-schnell\",\n \"input\": {\n \"prompt\": \"A dumpling-shaped rocket launching\",\n \"aspect_ratio\": \"16:9\"\n }\n}"
response = http.request(request)
puts response.read_body{
"images": [
{
"url": "<string>"
}
],
"prompt": "<string>",
"creditUsage": 123,
"model": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}AI
Generate AI Image
Generate an AI image using DumplingAI’s image generation providers.
POST
/
api
/
v1
/
generate-ai-image
Generate AI image
curl --request POST \
--url https://app.dumplingai.com/api/v1/generate-ai-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "FLUX.1-schnell",
"input": {
"prompt": "A dumpling-shaped rocket launching",
"aspect_ratio": "16:9"
}
}
'import requests
url = "https://app.dumplingai.com/api/v1/generate-ai-image"
payload = {
"model": "FLUX.1-schnell",
"input": {
"prompt": "A dumpling-shaped rocket launching",
"aspect_ratio": "16:9"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'FLUX.1-schnell',
input: {prompt: 'A dumpling-shaped rocket launching', aspect_ratio: '16:9'}
})
};
fetch('https://app.dumplingai.com/api/v1/generate-ai-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.dumplingai.com/api/v1/generate-ai-image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'FLUX.1-schnell',
'input' => [
'prompt' => 'A dumpling-shaped rocket launching',
'aspect_ratio' => '16:9'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.dumplingai.com/api/v1/generate-ai-image"
payload := strings.NewReader("{\n \"model\": \"FLUX.1-schnell\",\n \"input\": {\n \"prompt\": \"A dumpling-shaped rocket launching\",\n \"aspect_ratio\": \"16:9\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.dumplingai.com/api/v1/generate-ai-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"FLUX.1-schnell\",\n \"input\": {\n \"prompt\": \"A dumpling-shaped rocket launching\",\n \"aspect_ratio\": \"16:9\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/generate-ai-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"FLUX.1-schnell\",\n \"input\": {\n \"prompt\": \"A dumpling-shaped rocket launching\",\n \"aspect_ratio\": \"16:9\"\n }\n}"
response = http.request(request)
puts response.read_body{
"images": [
{
"url": "<string>"
}
],
"prompt": "<string>",
"creditUsage": 123,
"model": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}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 https://app.dumplingai.com/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 (30 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 (150 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 (300 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
}
}
FLUX.1-kontext-pro (200 credits per image)
{
"model": "FLUX.1-kontext-pro",
"input": {
"prompt": "string", // Required. Text description of what you want to generate, or instruction on how to edit the given image
"input_image": "string", // Optional. Image URL to use as reference. Must be jpeg, png, gif, or webp
"aspect_ratio": "string", // Optional. One of: "match_input_image", "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "4:5", "5:4", "21:9", "9:21", "2:1", "1:2". Default: "match_input_image"
"seed": "number" // Optional. Random seed for reproducible generation
}
}
recraft-v3 (200 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"
}
}
- “1024x1024”
- “1365x1024”
- “1024x1365”
- “1536x1024”
- “1024x1536”
- “1820x1024”
- “1024x1820”
- “1024x2048”
- “2048x1024”
- “1434x1024”
- “1024x1434”
- “1024x1280”
- “1280x1024”
- “1024x1707”
- “1707x1024”
- “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 Requests
Text-to-Image Generation
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"
}
}'
Image Editing with FLUX.1-kontext-pro
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-kontext-pro",
"input": {
"prompt": "Change the background to a tropical beach while keeping the person in the exact same position",
"input_image": "https://example.com/portrait.jpg",
"aspect_ratio": "match_input_image"
}
}'
Notes
- Credit costs per image vary by model:
- FLUX.1-schnell: 30 credits
- FLUX.1-dev: 150 credits
- FLUX.1-pro: 300 credits
- FLUX.1.1-pro: 500 credits
- FLUX.1-kontext-pro: 200 credits
- recraft-v3: 200 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.Authorizations
Body
application/json
Parameters used to generate AI images through DumplingAI providers.