Skip to main content
POST
/
v1
/
workflows
/
estimate-credits
Estimate workflow credits
curl --request POST \
  --url https://api.magica.com/api/v1/workflows/estimate-credits \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "nodes": [
    {
      "type": "<string>",
      "data": {},
      "subModelId": "<string>"
    }
  ]
}
'
{
  "totalMicrocredits": 123,
  "estimates": [
    {
      "microcredits": 123
    }
  ]
}
Returns the total microcredit cost of a workflow run, along with a per-node breakdown so you can render the same number on a workflow summary and on individual node cards.
Uses the same pricing engine as POST /v1/nodes/estimate-credits — the response guarantees totalMicrocredits === sum(estimates[].microcredits) by construction.

Authorizations

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

Body

nodes
array
required
Array of node configurations that make up the workflow. Capped at the per-workflow node limit enforced by the workflow editor.

Response

totalMicrocredits
number
Total cost of running the whole workflow. Equals the sum of estimates[].microcredits.
estimates
array
Per-node breakdown, in input order.

Request

curl -X POST https://api.magica.com/api/v1/workflows/estimate-credits \
  -H "Authorization: Bearer $MAGICA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": [
      { "type": "flux_2_pro", "data": { "prompt": "A red Ferrari" } },
      { "type": "gpt_5_4",    "data": { "prompt": "Describe this" } }
    ]
  }'

Response example

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

Errors

StatusReason
400Invalid body, exceeds max nodes per workflow, or unparseable JSON
401Missing or invalid API key
500Pricing engine failure