Skip to main content
POST
/
image
/
generate
/
estimate
Estimate Image Generation Cost
curl --request POST \
  --url https://api.example.com/image/generate/estimate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "output": {
    "format": "webp",
    "quality": 80
  },
  "model": "black-forest-labs/flux.2-pro",
  "count": 1,
  "destination": "<string>",
  "inputs": [
    "<string>"
  ],
  "magic_prompt": "<unknown>",
  "metadata": {},
  "negative_prompt": "<string>",
  "rating": {
    "mode": "custom",
    "levels": [
      {
        "value": "<13",
        "description": "Safe for Children"
      },
      {
        "value": "<18",
        "description": "Safe for Teens"
      },
      {
        "value": "18+",
        "description": "Adults Only"
      }
    ]
  },
  "size": {
    "type": "<unknown>",
    "scale": "base"
  },
  "webhook": {
    "custom": [
      {
        "url": "<string>"
      }
    ],
    "dashboard": "<unknown>"
  }
}
'
import requests

url = "https://api.example.com/image/generate/estimate"

payload = {
    "prompt": "<string>",
    "output": {
        "format": "webp",
        "quality": 80
    },
    "model": "black-forest-labs/flux.2-pro",
    "count": 1,
    "destination": "<string>",
    "inputs": ["<string>"],
    "magic_prompt": "<unknown>",
    "metadata": {},
    "negative_prompt": "<string>",
    "rating": {
        "mode": "custom",
        "levels": [
            {
                "value": "<13",
                "description": "Safe for Children"
            },
            {
                "value": "<18",
                "description": "Safe for Teens"
            },
            {
                "value": "18+",
                "description": "Adults Only"
            }
        ]
    },
    "size": {
        "type": "<unknown>",
        "scale": "base"
    },
    "webhook": {
        "custom": [{ "url": "<string>" }],
        "dashboard": "<unknown>"
    }
}
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({
    prompt: '<string>',
    output: {format: 'webp', quality: 80},
    model: 'black-forest-labs/flux.2-pro',
    count: 1,
    destination: '<string>',
    inputs: ['<string>'],
    magic_prompt: '<unknown>',
    metadata: {},
    negative_prompt: '<string>',
    rating: {
      mode: 'custom',
      levels: [
        {value: '<13', description: 'Safe for Children'},
        {value: '<18', description: 'Safe for Teens'},
        {value: '18+', description: 'Adults Only'}
      ]
    },
    size: {type: '<unknown>', scale: 'base'},
    webhook: {custom: [{url: '<string>'}], dashboard: '<unknown>'}
  })
};

fetch('https://api.example.com/image/generate/estimate', 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.example.com/image/generate/estimate",
  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' => '<string>',
    'output' => [
        'format' => 'webp',
        'quality' => 80
    ],
    'model' => 'black-forest-labs/flux.2-pro',
    'count' => 1,
    'destination' => '<string>',
    'inputs' => [
        '<string>'
    ],
    'magic_prompt' => '<unknown>',
    'metadata' => [
        
    ],
    'negative_prompt' => '<string>',
    'rating' => [
        'mode' => 'custom',
        'levels' => [
                [
                                'value' => '<13',
                                'description' => 'Safe for Children'
                ],
                [
                                'value' => '<18',
                                'description' => 'Safe for Teens'
                ],
                [
                                'value' => '18+',
                                'description' => 'Adults Only'
                ]
        ]
    ],
    'size' => [
        'type' => '<unknown>',
        'scale' => 'base'
    ],
    'webhook' => [
        'custom' => [
                [
                                'url' => '<string>'
                ]
        ],
        'dashboard' => '<unknown>'
    ]
  ]),
  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://api.example.com/image/generate/estimate"

	payload := strings.NewReader("{\n  \"prompt\": \"<string>\",\n  \"output\": {\n    \"format\": \"webp\",\n    \"quality\": 80\n  },\n  \"model\": \"black-forest-labs/flux.2-pro\",\n  \"count\": 1,\n  \"destination\": \"<string>\",\n  \"inputs\": [\n    \"<string>\"\n  ],\n  \"magic_prompt\": \"<unknown>\",\n  \"metadata\": {},\n  \"negative_prompt\": \"<string>\",\n  \"rating\": {\n    \"mode\": \"custom\",\n    \"levels\": [\n      {\n        \"value\": \"<13\",\n        \"description\": \"Safe for Children\"\n      },\n      {\n        \"value\": \"<18\",\n        \"description\": \"Safe for Teens\"\n      },\n      {\n        \"value\": \"18+\",\n        \"description\": \"Adults Only\"\n      }\n    ]\n  },\n  \"size\": {\n    \"type\": \"<unknown>\",\n    \"scale\": \"base\"\n  },\n  \"webhook\": {\n    \"custom\": [\n      {\n        \"url\": \"<string>\"\n      }\n    ],\n    \"dashboard\": \"<unknown>\"\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://api.example.com/image/generate/estimate")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"prompt\": \"<string>\",\n  \"output\": {\n    \"format\": \"webp\",\n    \"quality\": 80\n  },\n  \"model\": \"black-forest-labs/flux.2-pro\",\n  \"count\": 1,\n  \"destination\": \"<string>\",\n  \"inputs\": [\n    \"<string>\"\n  ],\n  \"magic_prompt\": \"<unknown>\",\n  \"metadata\": {},\n  \"negative_prompt\": \"<string>\",\n  \"rating\": {\n    \"mode\": \"custom\",\n    \"levels\": [\n      {\n        \"value\": \"<13\",\n        \"description\": \"Safe for Children\"\n      },\n      {\n        \"value\": \"<18\",\n        \"description\": \"Safe for Teens\"\n      },\n      {\n        \"value\": \"18+\",\n        \"description\": \"Adults Only\"\n      }\n    ]\n  },\n  \"size\": {\n    \"type\": \"<unknown>\",\n    \"scale\": \"base\"\n  },\n  \"webhook\": {\n    \"custom\": [\n      {\n        \"url\": \"<string>\"\n      }\n    ],\n    \"dashboard\": \"<unknown>\"\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/image/generate/estimate")

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  \"prompt\": \"<string>\",\n  \"output\": {\n    \"format\": \"webp\",\n    \"quality\": 80\n  },\n  \"model\": \"black-forest-labs/flux.2-pro\",\n  \"count\": 1,\n  \"destination\": \"<string>\",\n  \"inputs\": [\n    \"<string>\"\n  ],\n  \"magic_prompt\": \"<unknown>\",\n  \"metadata\": {},\n  \"negative_prompt\": \"<string>\",\n  \"rating\": {\n    \"mode\": \"custom\",\n    \"levels\": [\n      {\n        \"value\": \"<13\",\n        \"description\": \"Safe for Children\"\n      },\n      {\n        \"value\": \"<18\",\n        \"description\": \"Safe for Teens\"\n      },\n      {\n        \"value\": \"18+\",\n        \"description\": \"Adults Only\"\n      }\n    ]\n  },\n  \"size\": {\n    \"type\": \"<unknown>\",\n    \"scale\": \"base\"\n  },\n  \"webhook\": {\n    \"custom\": [\n      {\n        \"url\": \"<string>\"\n      }\n    ],\n    \"dashboard\": \"<unknown>\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "currency": "<unknown>",
    "estimateKind": "<unknown>",
    "estimatedCost": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Mynth API key sent as Authorization: Bearer <api-key>.

Body

application/json
prompt
string
required

Positive prompt.

Maximum string length: 8192
Example:

"Cute Cat"

output
object
model
default:auto
Example:

"black-forest-labs/flux.2-pro"

count
number
default:1
Required range: 1 <= x <= 20
access
object

Controls whether the create-task response should include a short-lived Public Access Token.

That token can be passed to browser or client-side code for polling task status and task images without exposing your API key.

destination
string
Required string length: 1 - 64
Example:

"bunny-prod"

inputs
(string | object)[]
Maximum array length: 20
Required string length: 1 - 2048
magic_prompt
any
metadata
object
negative_prompt
string
Maximum string length: 8192
rating

Content rating

Example:
{
  "mode": "custom",
  "levels": [
    {
      "value": "<13",
      "description": "Safe for Children"
    },
    {
      "value": "<18",
      "description": "Safe for Teens"
    },
    {
      "value": "18+",
      "description": "Adults Only"
    }
  ]
}
size
webhook
object

Response

200 - application/json

Image generation request validated and cost estimated

data
object
required