Skip to main content
POST
/
v1
/
nodes
/
estimate-credits
Estimate node credits
curl --request POST \
  --url https://api.magica.com/api/v1/nodes/estimate-credits \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "nodes": [
    {
      "type": "<string>",
      "data": {},
      "subModelId": "<string>"
    }
  ]
}
'
{
  "estimates": [
    {
      "microcredits": 123
    }
  ]
}
Returns a per-node microcredit estimate for an array of node configurations. Useful for surfacing live pricing in a UI (canvas card, playground form) before the user kicks off a run.
Pricing is computed by the same engine that charges credits at run time — this endpoint mirrors the run-time cost exactly, without side effects. Pairs with POST /v1/workflows/estimate-credits via the invariant workflowEstimate.totalMicrocredits === sum(nodes[].microcredits).

Authorizations

Authorization
string
required
Bearer API key. Format: Bearer gx_your_api_key.

Body

nodes
array
required
Array of node configurations to estimate. Max 100 entries.

Response

estimates
array
One entry per request node, in input order.

Request

curl -X POST https://api.magica.com/api/v1/nodes/estimate-credits \
  -H "Authorization: Bearer $MAGICA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": [
      {
        "type": "flux_2_pro",
        "data": { "prompt": "A red Ferrari", "image_size": "1024x1024" }
      },
      {
        "type": "nano_banana_pro",
        "data": { "prompt": "Add a dog" },
        "subModelId": "image-to-image"
      }
    ]
  }'

Response example

{
  "estimates": [{ "microcredits": 2500000 }, { "microcredits": 1200000 }]
}

Errors

StatusReason
400Invalid body, more than 100 nodes, or unparseable JSON
401Missing or invalid API key
500Pricing engine failure