Leonardo.AI Pricing Calculator API
Pre-calculate the API credit cost (in USD) of a generation request before submitting it. Mirrors the cost estimation logic of the in-app Pricing Calculator.
Pre-calculate the API credit cost (in USD) of a generation request before submitting it. Mirrors the cost estimation logic of the in-app Pricing Calculator.
{
"openapi": "3.0.0",
"info": {
"title": "Leonardo.AI Pricing Calculator API",
"description": "Pre-calculate the API credit cost of a generation request before submitting it.",
"version": "v1.0.0",
"contact": {
"name": "Leonardo.AI Support",
"url": "https://docs.leonardo.ai/docs/need-more-support"
},
"license": {
"name": "Leonardo.AI Terms of Service",
"url": "https://leonardo.ai/terms-of-service/"
}
},
"servers": [
{
"url": "https://cloud.leonardo.ai/api/rest/v1",
"description": "Leonardo.AI Production API"
}
],
"tags": [
{
"name": "Pricing Calculator"
}
],
"paths": {
"/pricing-calculator": {
"post": {
"tags": [
"Pricing Calculator"
],
"summary": "Calculating API Cost",
"description": "This endpoint returns the cost used for generating images using a particular service type.",
"operationId": "pricingCalculator",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"service": {
"$ref": "#/components/schemas/pricingCalculatorServices"
},
"serviceParams": {
"nullable": false,
"title": "Object",
"type": "object",
"description": "Parameters for the service",
"properties": {
"IMAGE_GENERATION": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for IMAGE_GENERATION service",
"properties": {
"imageHeight": {
"$ref": "#/components/schemas/imageHeight"
},
"imageWidth": {
"$ref": "#/components/schemas/imageHeight"
},
"numImages": {
"$ref": "#/components/schemas/numImages"
},
"inferenceSteps": {
"nullable": false,
"title": "Int",
"type": "integer",
"description": "The Step Count to use for the generation. Must be between 10 and 60."
},
"promptMagic": {
"$ref": "#/components/schemas/promptMagicArg"
},
"promptMagicStrength": {
"$ref": "#/components/schemas/promptMagicStrengthArg"
},
"promptMagicVersion": {
"$ref": "#/components/schemas/promptMagicVersionArg"
},
"alchemyMode": {
"nullable": false,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use Alchemy."
},
"photoRealMode": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use PhotoReal. Requires enabling alchemy."
},
"photoRealStrength": {
"$ref": "#/components/schemas/photoRealStrengthArg"
},
"photoRealVersion": {
"$ref": "#/components/schemas/photoRealVersion"
},
"highResolution": {
"nullable": false,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use high resolution."
},
"loraCount": {
"nullable": true,
"title": "Int",
"type": "integer",
"description": "The number of elements used for the generation."
},
"isModelCustom": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use custom model."
},
"controlnetsCost": {
"nullable": true,
"title": "Int",
"type": "integer",
"description": "The total cost of controlnets input."
},
"isPhoenix": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use Phoenix model."
},
"isSDXL": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use SDXL model."
},
"isSDXLLightning": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use SDXL Lightning model."
},
"isUltra": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use Ultra mode."
},
"isFluxSchnell": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use Flux Schnell model."
},
"isFluxDev": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use Flux Dev model."
},
"isFluxKontext": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable to use Flux Kontext model."
}
}
},
"FANTASY_AVATAR_GENERATION": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for FANTASY_AVATAR_GENERATION service",
"properties": {
"imageHeight": {
"$ref": "#/components/schemas/imageHeight"
},
"imageWidth": {
"$ref": "#/components/schemas/imageHeight"
},
"numImages": {
"$ref": "#/components/schemas/numImages"
}
}
},
"MOTION_SVD_GENERATION": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for MOTION_SVD_GENERATION service",
"properties": {}
},
"MOTION_VIDEO_GENERATION": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for MOTION_VIDEO_GENERATION service",
"properties": {
"resolution": {
"nullable": false,
"title": "String",
"type": "string",
"description": "The resolution of the video. Must be RESOLUTION_480 or RESOLUTION_720."
}
}
},
"VEO3_MOTION_VIDEO_GENERATION": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for VEO3_MOTION_VIDEO_GENERATION service",
"properties": {
"resolution": {
"nullable": false,
"title": "String",
"type": "string",
"enum": [
"RESOLUTION_720"
],
"description": "The resolution of the video. Supported resolution for VEO3 is RESOLUTION_720."
}
}
},
"LCM_GENERATION": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for LCM_GENERATION service",
"properties": {
"height": {
"nullable": true,
"title": "Int",
"type": "integer",
"description": "The output height of the image. Must be 512, 640 or 1024."
},
"width": {
"nullable": true,
"title": "Int",
"type": "integer",
"description": "The output width of the image. Must be 512, 640 or 1024."
},
"instantRefine": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable for instant upscale"
},
"refine": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Enable for normal alchemy upscale"
}
}
},
"MODEL_TRAINING": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for MODEL_TRAINING service",
"properties": {
"resolution": {
"nullable": false,
"title": "Int",
"type": "integer",
"description": "The resolution for training. Must be 512, 768, or 1024."
},
"sd_version": {
"nullable": true,
"title": "sd_version",
"enum": [
"FLUX_DEV"
],
"description": "The model for the training. Can be set to 'FLUX_DEV' for FLUX_DEV specific pricing or can be omitted."
},
"datasetImageCount": {
"nullable": true,
"title": "Int",
"type": "integer",
"description": "The number of images in the training dataset when sd_version is set to 'FLUX_DEV'. Must be between 1 and 50."
}
}
},
"TEXTURE_GENERATION": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for TEXTURE_GENERATION service",
"properties": {
"preview": {
"nullable": false,
"title": "Boolean",
"type": "boolean"
}
}
},
"UNIVERSAL_UPSCALER": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for UNIVERSAL_UPSCALER service",
"properties": {
"megapixel": {
"nullable": false,
"title": "Int",
"type": "integer",
"description": "The maximum upscaled image size is 20 megapixels."
}
}
},
"UNIVERSAL_UPSCALER_ULTRA": {
"nullable": true,
"title": "Object",
"type": "object",
"description": "Parameters for UNIVERSAL_UPSCALER_ULTRA service",
"properties": {
"inputWidth": {
"nullable": false,
"title": "Int",
"type": "integer",
"description": "The input width of the image."
},
"inputHeight": {
"nullable": false,
"title": "Int",
"type": "integer",
"description": "The input height of the image."
},
"upscaleMultiplier": {
"nullable": false,
"title": "Float",
"type": "number",
"description": "The upscale multiplier of the universal upscaler. Must be between 1.00 and 2.00."
}
}
}
}
}
}
}
}
}
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"calculateProductionApiServiceCost": {
"nullable": true,
"properties": {
"cost": {
"nullable": false,
"title": "Int",
"type": "integer",
"description": "API service cost to generate the image."
}
},
"title": "calculateProductionApiServiceCost",
"type": "object"
}
}
}
}
},
"description": "Responses for POST /pricing-calculator"
}
}
}
}
},
"components": {
"schemas": {
"cost": {
"nullable": true,
"type": "object",
"title": "Cost",
"description": "The cost of the operation.",
"properties": {
"amount": {
"type": "string",
"description": "The amount of the cost."
},
"unit": {
"type": "string",
"enum": [
"CREDITS",
"DOLLARS"
],
"description": "The unit of the cost. Can be CREDITS or DOLLARS. Note: DOLLARS unit only supports PAYG plan."
}
}
},
"Cursor": {
"type": "string",
"title": "Cursor",
"description": "An opaque cursor used for pagination"
},
"Blueprint": {
"type": "object",
"title": "Blueprint",
"description": "A Blueprint object",
"properties": {
"akUUID": {
"type": "string",
"description": "Unique identifier for the Blueprint",
"example": "c846413e-92ba-4302-84f8-47c667d4761f"
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "Creation timestamp",
"example": "2025-10-29T21:31:47.999Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "Last update timestamp",
"example": "2025-12-19T02:34:44.740Z"
},
"name": {
"type": "string",
"description": "Name of the Blueprint",
"example": "Golden Hour Relight"
},
"description": {
"type": "string",
"description": "Description of the Blueprint",
"example": "Relight an image with warm, golden tones of late afternoon sunlight for a soft and radiant glow."
},
"thumbnails": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Thumbnail type name (e.g., thumbnailUrl, videoUrl, thumbnailUrlBanner, thumbnailUrlLandscape, thumbnailUrlExtremePortrait)",
"example": "thumbnailUrl"
},
"url": {
"type": "string",
"description": "URL of the thumbnail",
"example": "https://cdn.leonardo.ai/blueprint_assets/official/384ab5c8-55d8-47a1-be22-6a274913c324/thumbnails/goldenhour.jpg"
}
}
}
},
"teamId": {
"type": "string",
"nullable": true,
"description": "Team ID if Blueprint belongs to a team",
"example": null
},
"official": {
"type": "boolean",
"description": "Whether this is an official Blueprint",
"example": true
}
}
},
"BlueprintVersion": {
"type": "object",
"title": "BlueprintVersion",
"description": "A Blueprint Version object",
"properties": {
"edges": {
"type": "array",
"items": {
"type": "object",
"properties": {
"cursor": {
"type": "string",
"example": "eyJjcmVhdGVkQXQiOiIyMDI1LTExLTI3VDA1OjEzOjIxLjg5NloiLCJha1VVSUQiOiI5NTZlOTU2NC0xOWY3LTQ5NjgtYjU2ZC0wNWMyYzU2NzcyNmYifQ=="
},
"node": {
"type": "object",
"properties": {
"akUUID": {
"type": "string",
"format": "uuid",
"example": "956e9564-19f7-4968-b56d-05c2c567726f"
},
"createdAt": {
"type": "string",
"format": "date-time",
"example": "2025-11-27T05:13:21.896Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"example": "2025-11-27T05:13:21.896Z"
},
"cost": {
"type": "integer",
"example": 160
},
"uiMetadata": {
"type": "object",
"properties": {
"inputs": {
"type": "array",
"items": {
"type": "object"
}
},
"outputs": {
"type": "array",
"items": {
"type": "object"
}
}
},
"additionalProperties": false
},
"uiMetadataSchemaVersion": {
"type": "string",
"example": "21"
},
"models": {
"type": "array",
"items": {
"type": "string"
}
},
"executability": {
"type": "object",
"properties": {
"isExecutable": {
"type": "boolean",
"example": true
},
"reasons": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"models": {
"type": "string",
"example": "gemini-2.5-flash-image"
}
}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"totalCount": {
"type": "integer",
"example": 2
},
"pageInfo": {
"type": "object",
"properties": {
"hasNextPage": {
"type": "boolean",
"example": false
},
"hasPreviousPage": {
"type": "boolean",
"example": false
},
"startCursor": {
"type": "string",
"example": "eyJjcmVhdGVkQXQiOiIyMDI1LTExLTI3VDA1OjEzOjIxLjg5NloiLCJha1VVSUQiOiI5NTZlOTU2NC0xOWY3LTQ5NjgtYjU2ZC0wNWMyYzU2NzcyNmYifQ=="
},
"endCursor": {
"type": "string",
"example": "eyJjcmVhdGVkQXQiOiIyMDI1LTExLTI3VDA1OjEzOjIxLjg5NloiLCJha1VVSUQiOiI5NTZlOTU2NC0xOWY3LTQ5NjgtYjU2ZC0wNWMyYzU2NzcyNmYifQ=="
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"NodeInput": {
"type": "object",
"title": "NodeInput",
"description": "A node input object for customizing a Blueprint Execution",
"required": [
"nodeId",
"settingName",
"value"
],
"properties": {
"nodeId": {
"type": "string",
"format": "uuid",
"description": "The ID of the node in the Blueprint",
"example": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"settingName": {
"type": "string",
"enum": [
"text",
"imageUrl",
"textVariables"
],
"description": "The type of setting to replace:\n- `text`: Direct text replacement (value is a string)\n- `imageUrl`: Image URL input (value is a URL string)\n- `textVariables`: Text with placeholder variables (value is an array of TextVariable)",
"example": "text"
},
"value": {
"oneOf": [
{
"type": "string",
"description": "String value. Use for settingName='text' (direct text) or settingName='imageUrl' (image URL)"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/TextVariable"
},
"description": "Array of TextVariable objects. Use only for settingName='textVariables' to replace {{placeholders}} in the Blueprint"
}
],
"description": "The replacement value. Type depends on settingName:\n- `text`: string (the full text)\n- `imageUrl`: string (the image URL)\n- `textVariables`: array of TextVariable objects",
"example": "A futuristic cityscape at sunset"
}
}
},
"TextVariable": {
"type": "object",
"title": "TextVariable",
"description": "A text variable for replacing placeholders in Blueprint templates",
"required": [
"name",
"value"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the placeholder variable (without curly braces)",
"example": "characterName"
},
"value": {
"type": "string",
"description": "The value to replace the placeholder with",
"example": "Luna"
}
}
},
"ApiError": {
"type": "object",
"title": "ApiError",
"description": "API error response structure",
"required": [
"message"
],
"properties": {
"message": {
"type": "string",
"description": "Error message"
},
"path": {
"type": "array",
"items": {
"type": "string"
},
"description": "Path to the field that caused the error"
},
"locations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"column": {
"type": "integer"
},
"line": {
"type": "integer"
}
}
},
"description": "Location information for the error"
},
"extensions": {
"type": "object",
"description": "Additional error details and context"
}
}
},
"apiCreditCost": {
"nullable": true,
"title": "Int",
"type": "integer",
"description": "API credits cost, available for Production API users. Note: it will be deprecated. Please use the cost instead.",
"deprecated": true
},
"isVariation": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "If it is a variation image."
},
"isInitImage": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "If it is an init image uploaded by the user. This image is uploaded from endpoint: Upload init image."
},
"imageToVideo": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "If it is an image to video generation."
},
"sd_versions": {
"type": "string",
"nullable": false,
"title": "sd_versions",
"enum": [
"v1_5",
"v2",
"v3",
"SDXL_0_8",
"SDXL_0_9",
"SDXL_1_0",
"SDXL_LIGHTNING",
"PHOENIX",
"FLUX",
"FLUX_DEV",
"KINO_2_0"
],
"description": "The base version of stable diffusion to use if not using a custom model. v1_5 is 1.5, v2 is 2.1, if not specified it will default to v1_5. Also includes SDXL and SDXL Lightning models"
},
"lora": {
"type": "object",
"properties": {
"akUUID": {
"nullable": true,
"type": "string",
"description": "Unique identifier for the element. Elements can be found from the List Elements endpoint."
},
"creatorName": {
"nullable": true,
"type": "string",
"description": "Name of the creator of the element"
},
"name": {
"nullable": true,
"type": "string",
"description": "Name of the element"
},
"description": {
"nullable": true,
"type": "string",
"description": "Description for the element"
},
"urlImage": {
"nullable": true,
"type": "string",
"description": "URL of the element image"
},
"baseModel": {
"nullable": true,
"type": "string",
"description": "Base model version for the element"
},
"weightDefault": {
"nullable": true,
"type": "integer",
"description": "Default weight for the element"
},
"weightMin": {
"nullable": true,
"type": "integer",
"description": "Minimum weight for the element"
},
"weightMax": {
"nullable": true,
"type": "integer",
"description": "Maximum weight for the element"
},
"__typename": {
"type": "string",
"description": "Type name for introspection purposes"
}
}
},
"motion": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "If generation is of motion type."
},
"motionModel": {
"nullable": true,
"title": "String",
"type": "string",
"description": "The name of the motion model."
},
"motionMP4URL": {
"nullable": true,
"title": "String",
"type": "string",
"description": "The URL of the motion MP4."
},
"motionStrength": {
"nullable": true,
"title": "Int",
"type": "integer",
"description": "The motion strength."
},
"public": {
"nullable": true,
"title": "Boolean",
"type": "boolean",
"description": "Whether the generation is public or not"
},
"strength": {
"type": "string",
"nullable": false,
"title": "strength",
"enum": [
"VERY_LOW",
"LOW",
"MEDIUM",
"HIGH"
],
"description": "When training using the PIXEL_ART model type, this influences the training strength.",
"default": "MEDIUM"
},
"job_status": {
"type": "string",
"nullable": false,
"title": "job_status",
"enum": [
"PENDING",
"COMPLETE",
"FAILED"
],
"description": "The status of the current task."
},
"BlueprintExecutionStatus": {
"type": "string",
"nullable": false,
"title": "BlueprintExecutionStatus",
"enum": [
"PENDING",
"QUEUED",
"COMPLETED",
"FAILED"
],
"description": "The status of a Blueprint Execution."
},
"BlueprintExecution": {
"type": "object",
"nullable": false,
"title": "BlueprintExecution",
"description": "Represents the Execution of a Blueprint Version",
"properties": {
"akUUID": {
"allOf": [
{
"$ref": "#/components/schemas/uuid"
},
{
"nullable": false,
"description": "akUUID of the Blueprint Execution"
}
# --- truncated at 32 KB (50 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/leonardo-ai/refs/heads/main/openapi/leonardo-ai-pricing-calculator-openapi.json