> ## Documentation Index
> Fetch the complete documentation index at: https://magica.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Estimate node credits

> Batch microcredit estimate for a list of nodes, against the inputs you'd actually run them with.

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.

<Info>
  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`](/api-reference/workflows/estimate-credits)
  via the invariant `workflowEstimate.totalMicrocredits ===
      sum(nodes[].microcredits)`.
</Info>

## Authorizations

<ParamField header="Authorization" type="string" required>
  Bearer API key. Format: `Bearer gx_your_api_key`.
</ParamField>

## Body

<ParamField body="nodes" type="array" required>
  Array of node configurations to estimate. **Max 100** entries.

  <Expandable title="Each node">
    <ParamField body="type" type="string" required>
      Node type identifier (e.g. `flux_2_pro`, `nano_banana_pro`, `gpt_5_4`).
    </ParamField>

    <ParamField body="data" type="object">
      Input values for the node, keyed by input field name. Pricing models may
      use these to compute dynamic cost (duration, resolution, etc.).
    </ParamField>

    <ParamField body="subModelId" type="string">
      Active sub-model identifier for multi-mode nodes (e.g. `image-to-image`
      mode of Nano Banana Pro). If omitted, the default sub-model is used.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="estimates" type="array">
  One entry per request node, in input order.

  <Expandable title="Each estimate">
    <ResponseField name="microcredits" type="number">
      Cost in microcredits. Divide by 1,000,000 to get credits.
    </ResponseField>
  </Expandable>
</ResponseField>

## Request

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    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"
          }
        ]
      }'
    ```
  </Tab>

  <Tab title="Node.js">
    ```javascript theme={null}
    const res = await fetch(
      "https://api.magica.com/api/v1/nodes/estimate-credits",
      {
        method: "POST",
        headers: {
          Authorization: `Bearer ${process.env.MAGICA_API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          nodes: [
            { type: "flux_2_pro", data: { prompt: "A red Ferrari" } },
            { type: "gpt_5_4", data: { prompt: "Describe this" } },
          ],
        }),
      },
    );
    const { estimates } = await res.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os, requests

    res = requests.post(
        "https://api.magica.com/api/v1/nodes/estimate-credits",
        headers={
            "Authorization": f"Bearer {os.environ['MAGICA_API_KEY']}",
            "Content-Type": "application/json",
        },
        json={
            "nodes": [
                {"type": "flux_2_pro", "data": {"prompt": "A red Ferrari"}},
                {"type": "gpt_5_4", "data": {"prompt": "Describe this"}},
            ]
        },
    )
    estimates = res.json()["estimates"]
    ```
  </Tab>
</Tabs>

## Response example

```json theme={null}
{
  "estimates": [{ "microcredits": 2500000 }, { "microcredits": 1200000 }]
}
```

## Errors

| Status | Reason                                                 |
| ------ | ------------------------------------------------------ |
| `400`  | Invalid body, more than 100 nodes, or unparseable JSON |
| `401`  | Missing or invalid API key                             |
| `500`  | Pricing engine failure                                 |
