curl --request POST \
--url https://api.deapi.ai/api/v2/images/generations/price \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A beautiful sunset over mountains",
"model": "Flux1schnell",
"width": 512,
"height": 512,
"guidance": 7.5,
"steps": 20,
"seed": 42,
"negative_prompt": "blur, darkness, noise",
"loras": [
{
"name": "style_lora",
"weight": 0.75
}
],
"quality": "medium"
}
'import requests
url = "https://api.deapi.ai/api/v2/images/generations/price"
payload = {
"prompt": "A beautiful sunset over mountains",
"model": "Flux1schnell",
"width": 512,
"height": 512,
"guidance": 7.5,
"steps": 20,
"seed": 42,
"negative_prompt": "blur, darkness, noise",
"loras": [
{
"name": "style_lora",
"weight": 0.75
}
],
"quality": "medium"
}
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A beautiful sunset over mountains',
model: 'Flux1schnell',
width: 512,
height: 512,
guidance: 7.5,
steps: 20,
seed: 42,
negative_prompt: 'blur, darkness, noise',
loras: [{name: 'style_lora', weight: 0.75}],
quality: 'medium'
})
};
fetch('https://api.deapi.ai/api/v2/images/generations/price', 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://api.deapi.ai/api/v2/images/generations/price",
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([
'prompt' => 'A beautiful sunset over mountains',
'model' => 'Flux1schnell',
'width' => 512,
'height' => 512,
'guidance' => 7.5,
'steps' => 20,
'seed' => 42,
'negative_prompt' => 'blur, darkness, noise',
'loras' => [
[
'name' => 'style_lora',
'weight' => 0.75
]
],
'quality' => 'medium'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"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://api.deapi.ai/api/v2/images/generations/price"
payload := strings.NewReader("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"model\": \"Flux1schnell\",\n \"width\": 512,\n \"height\": 512,\n \"guidance\": 7.5,\n \"steps\": 20,\n \"seed\": 42,\n \"negative_prompt\": \"blur, darkness, noise\",\n \"loras\": [\n {\n \"name\": \"style_lora\",\n \"weight\": 0.75\n }\n ],\n \"quality\": \"medium\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
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://api.deapi.ai/api/v2/images/generations/price")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"model\": \"Flux1schnell\",\n \"width\": 512,\n \"height\": 512,\n \"guidance\": 7.5,\n \"steps\": 20,\n \"seed\": 42,\n \"negative_prompt\": \"blur, darkness, noise\",\n \"loras\": [\n {\n \"name\": \"style_lora\",\n \"weight\": 0.75\n }\n ],\n \"quality\": \"medium\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/images/generations/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"model\": \"Flux1schnell\",\n \"width\": 512,\n \"height\": 512,\n \"guidance\": 7.5,\n \"steps\": 20,\n \"seed\": 42,\n \"negative_prompt\": \"blur, darkness, noise\",\n \"loras\": [\n {\n \"name\": \"style_lora\",\n \"weight\": 0.75\n }\n ],\n \"quality\": \"medium\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"price": 0.25
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"message": "The selected model does not support Text To Image.",
"errors": {
"model": [
"The selected model does not support Text To Image."
]
}
}{
"message": "Too Many Attempts."
}Image Generation Price Calculation
Estimate the price of a text-to-image generation request.
curl --request POST \
--url https://api.deapi.ai/api/v2/images/generations/price \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A beautiful sunset over mountains",
"model": "Flux1schnell",
"width": 512,
"height": 512,
"guidance": 7.5,
"steps": 20,
"seed": 42,
"negative_prompt": "blur, darkness, noise",
"loras": [
{
"name": "style_lora",
"weight": 0.75
}
],
"quality": "medium"
}
'import requests
url = "https://api.deapi.ai/api/v2/images/generations/price"
payload = {
"prompt": "A beautiful sunset over mountains",
"model": "Flux1schnell",
"width": 512,
"height": 512,
"guidance": 7.5,
"steps": 20,
"seed": 42,
"negative_prompt": "blur, darkness, noise",
"loras": [
{
"name": "style_lora",
"weight": 0.75
}
],
"quality": "medium"
}
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A beautiful sunset over mountains',
model: 'Flux1schnell',
width: 512,
height: 512,
guidance: 7.5,
steps: 20,
seed: 42,
negative_prompt: 'blur, darkness, noise',
loras: [{name: 'style_lora', weight: 0.75}],
quality: 'medium'
})
};
fetch('https://api.deapi.ai/api/v2/images/generations/price', 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://api.deapi.ai/api/v2/images/generations/price",
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([
'prompt' => 'A beautiful sunset over mountains',
'model' => 'Flux1schnell',
'width' => 512,
'height' => 512,
'guidance' => 7.5,
'steps' => 20,
'seed' => 42,
'negative_prompt' => 'blur, darkness, noise',
'loras' => [
[
'name' => 'style_lora',
'weight' => 0.75
]
],
'quality' => 'medium'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"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://api.deapi.ai/api/v2/images/generations/price"
payload := strings.NewReader("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"model\": \"Flux1schnell\",\n \"width\": 512,\n \"height\": 512,\n \"guidance\": 7.5,\n \"steps\": 20,\n \"seed\": 42,\n \"negative_prompt\": \"blur, darkness, noise\",\n \"loras\": [\n {\n \"name\": \"style_lora\",\n \"weight\": 0.75\n }\n ],\n \"quality\": \"medium\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
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://api.deapi.ai/api/v2/images/generations/price")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"model\": \"Flux1schnell\",\n \"width\": 512,\n \"height\": 512,\n \"guidance\": 7.5,\n \"steps\": 20,\n \"seed\": 42,\n \"negative_prompt\": \"blur, darkness, noise\",\n \"loras\": [\n {\n \"name\": \"style_lora\",\n \"weight\": 0.75\n }\n ],\n \"quality\": \"medium\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/images/generations/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"model\": \"Flux1schnell\",\n \"width\": 512,\n \"height\": 512,\n \"guidance\": 7.5,\n \"steps\": 20,\n \"seed\": 42,\n \"negative_prompt\": \"blur, darkness, noise\",\n \"loras\": [\n {\n \"name\": \"style_lora\",\n \"weight\": 0.75\n }\n ],\n \"quality\": \"medium\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"price": 0.25
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"message": "The selected model does not support Text To Image.",
"errors": {
"model": [
"The selected model does not support Text To Image."
]
}
}{
"message": "Too Many Attempts."
}/api/v2/images/generations.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
application/json Body
Image generation parameters
The main prompt for image generation
"A beautiful sunset over mountains"
The model to use for image generation. Available models can be retrieved via the GET /api/v1/client/models endpoint.
"Flux1schnell"
Width of the generated image in pixels
512
Height of the generated image in pixels
512
Guidance scale for the generation
7.5
Number of inference steps
20
Random seed for generation
42
Elements to avoid in the generated image
"blur, darkness, noise"
Array of LoRA models to apply
Show child attributes
Show child attributes
Quality tier, for models that support one (e.g. gpt-image: low/medium/high/auto). Only the values listed in that model's available options are accepted; ignored for models without a quality tier.
"medium"
Response
Calculated price for text2img inference.
Show child attributes
Show child attributes
Was this page helpful?