Calculate Generation Price
Immutable Catalog + Curated Guide
This lossless descriptor comes from the active Portal catalog and is enhanced with reviewed examples.
- Contract tier:
agent_ready - Risk:
write - Catalog version:
leonardo-ai-2026.07.12.1 - Descriptor hash:
c2a2ee2b9782871233a4d853dd259903c11b3292d7a2619320da10e4be602630
Estimate provider credit use for the planned generation before execution.
Request Body
{
"jsonrpc": "2.0",
"id": "leonardo-ai-leonardo-pricing-calculator-example",
"method": "tools/call",
"params": {
"name": "leonardo-ai.leonardo_pricing_calculator",
"arguments": {
"body": "",
"mode": "",
"model": "",
"query": "",
"width": "",
"height": "",
"motion": "",
"confirm": false,
"modelId": "",
"service": ""
}
}
}
Arguments Schema
{
"type": "object",
"properties": {
"body": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "JSON request body for the Leonardo endpoint. Use provider parameter names exactly, including casing such as `modelId`, `num_images`, or `init_image_id`."
},
"mode": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional resolution mode or pixel preset, such as RESOLUTION_480, 480p, RESOLUTION_720, 720p, or 496x864."
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional modern video provider model or alias to estimate through the closest pricing-calculator service. Examples: seedance-2.0 or seedance-2.0-fast."
},
"query": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "Query string parameters for the Leonardo endpoint. Omit when unused."
},
"width": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional video dimension used to infer the pricing resolution mode."
},
"height": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional video dimension used to infer the pricing resolution mode."
},
"motion": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional GUI-style pricing/generation hint. When motion or imageToVideo is true, the MCP maps the request to MOTION_VIDEO_GENERATION for pricing."
},
"confirm": {
"type": "boolean",
"default": false,
"description": "Must be true for destructive DELETE tools. Ignored for non-destructive tools."
},
"modelId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional provider modelId from legacy or GUI-style payloads. Returned in normalization context; pricing service selection is based on service or motionModel."
},
"service": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Pricing service enum. Examples: IMAGE_GENERATION, MOTION_VIDEO_GENERATION, VEO3_MOTION_VIDEO_GENERATION, LCM_GENERATION, MODEL_TRAINING, UNIVERSAL_UPSCALER, or UNIVERSAL_UPSCALER_ULTRA."
},
"duration": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional duration in seconds. Leonardo's v1 pricing calculator may ignore this for video, but it is returned in the normalized estimate context."
},
"settings": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "Optional settings object from planner-style inputs. Supports model, duration, resolution, mode, width, height, and aspect ratio aliases."
},
"imageWidth": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional video dimension used to infer the pricing resolution mode."
},
"model_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional modern video provider model or alias to estimate through the closest pricing-calculator service. Examples: seedance-2.0 or seedance-2.0-fast."
},
"resolution": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional resolution mode or pixel preset, such as RESOLUTION_480, 480p, RESOLUTION_720, 720p, or 496x864."
},
"aspectRatio": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional resolution mode or pixel preset, such as RESOLUTION_480, 480p, RESOLUTION_720, 720p, or 496x864."
},
"imageHeight": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional video dimension used to infer the pricing resolution mode."
},
"motionModel": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional modern video provider model or alias to estimate through the closest pricing-calculator service. Examples: seedance-2.0 or seedance-2.0-fast."
},
"path_params": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "Values for path placeholders in the endpoint path, such as `{'id': '...'}` or `{'datasetId': '...'}`. Omit when the endpoint has no placeholders."
},
"aspect_ratio": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional resolution mode or pixel preset, such as RESOLUTION_480, 480p, RESOLUTION_720, 720p, or 496x864."
},
"imageToVideo": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional GUI-style pricing/generation hint. When motion or imageToVideo is true, the MCP maps the request to MOTION_VIDEO_GENERATION for pricing."
},
"query_params": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "Query string parameters for the Leonardo endpoint. Omit when unused."
},
"request_body": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "JSON request body for the Leonardo endpoint. Use provider parameter names exactly, including casing such as `modelId`, `num_images`, or `init_image_id`."
},
"serviceParams": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "Provider serviceParams object. You may pass the full wrapper, such as `{'MOTION_VIDEO_GENERATION': {'resolution': 'RESOLUTION_480'}}`, or just the selected service params, such as `{'resolution': 'RESOLUTION_480'}` when `service` is also provided."
},
"service_params": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"default": null,
"description": "Provider serviceParams object. You may pass the full wrapper, such as `{'MOTION_VIDEO_GENERATION': {'resolution': 'RESOLUTION_480'}}`, or just the selected service params, such as `{'resolution': 'RESOLUTION_480'}` when `service` is also provided."
},
"preferred_model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional modern video provider model or alias to estimate through the closest pricing-calculator service. Examples: seedance-2.0 or seedance-2.0-fast."
},
"resolution_mode": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional resolution mode or pixel preset, such as RESOLUTION_480, 480p, RESOLUTION_720, 720p, or 496x864."
},
"duration_seconds": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional duration in seconds. Leonardo's v1 pricing calculator may ignore this for video, but it is returned in the normalized estimate context."
}
},
"additionalProperties": false
}
Output Schema
{
"type": "object",
"description": "Leonardo MCP result. ok=false, provider_ok=false, a failed status, or an error field represents a semantic failure even when transport delivery succeeded.",
"additionalProperties": true
}
Code Examples
- cURL
- Node.js
- Python
curl -X POST 'https://portal.madpanda3d.com/api/mcp' \
-H 'Authorization: Bearer mad_live_***' \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "leonardo-ai-leonardo-pricing-calculator-example",
"method": "tools/call",
"params": {
"name": "leonardo-ai.leonardo_pricing_calculator",
"arguments": {
"body": "",
"mode": "",
"model": "",
"query": "",
"width": "",
"height": "",
"motion": "",
"confirm": false,
"modelId": "",
"service": ""
}
}
}'
const response = await fetch('https://portal.madpanda3d.com/api/mcp', {
method: 'POST',
headers: {
Authorization: 'Bearer mad_live_***',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"jsonrpc": "2.0",
"id": "leonardo-ai-leonardo-pricing-calculator-example",
"method": "tools/call",
"params": {
"name": "leonardo-ai.leonardo_pricing_calculator",
"arguments": {
"body": "",
"mode": "",
"model": "",
"query": "",
"width": "",
"height": "",
"motion": "",
"confirm": false,
"modelId": "",
"service": ""
}
}
}),
});
const data = await response.json();
console.log(data);
import requests
url = 'https://portal.madpanda3d.com/api/mcp'
headers = {
'Authorization': 'Bearer mad_live_***',
'Content-Type': 'application/json',
}
payload = {
"jsonrpc": "2.0",
"id": "leonardo-ai-leonardo-pricing-calculator-example",
"method": "tools/call",
"params": {
"name": "leonardo-ai.leonardo_pricing_calculator",
"arguments": {
"body": "",
"mode": "",
"model": "",
"query": "",
"width": "",
"height": "",
"motion": "",
"confirm": false,
"modelId": "",
"service": ""
}
}
}
response = requests.post(url, headers=headers, json=payload, timeout=60)
print(response.json())
Example Responses
- 200 Success
- 502 Upstream Error
{
"ok": true,
"data": {
"estimateAvailable": true
},
"error": null
}
{
"ok": false,
"classification": "upstream_http_error",
"message": "Upstream MCP returned a non-success status."
}