# Job Pricing

Source: https://docs.prodia.com/reference/price/

The `/v2/job` and `/v2/job/async` endpoints support an optional `price` query
parameter that includes the dollar cost of a completed job in the response. This
is useful for gateways and platforms that need to accurately pass through
generation costs to their users.

## Usage

Add `?price=true` to the job endpoint URL. The pricing flag works with both the
synchronous and asynchronous APIs.

```javascript title="main.js"
const token = process.env.PRODIA_TOKEN;

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

let response;

do {
  response = await fetch("https://inference.prodia.com/v2/job?price=true", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${token}`,
      "Content-Type": "application/json",
      Accept: "multipart/form-data",
    },
    body: JSON.stringify({
      type: "inference.flux-fast.schnell.txt2img.v2",
      config: {
        prompt: "puppies in a cloud, 4k",
      },
    }),
  });

  if (response.status === 429) {
    const retryAfter = Number(response.headers.get("Retry-After")) || 1;
    await sleep(retryAfter * 1000);
  }
} while (response.status === 429);

const formData = await response.formData();

const job = JSON.parse(await formData.get("job").text());
const output = formData.get("output");

console.log(job.price);
// { product: "inference-flux-schnell-large-steps-4", dollars: 0.0025 }

const image = new Uint8Array(await output.arrayBuffer());
// write image to disk, display in browser, etc.
```

The `?price=true` parameter also works with
[`/v2/job/async`](https://docs.prodia.com/reference/async/).

## Response

When `?price=true` is set and the job completes successfully, the job result
includes an additional `price` field:

```json title="job.json" {17-20}
{
  "type": "inference.flux-fast.schnell.txt2img.v2",
  "created_at": "2026-02-10T12:30:00.612Z",
  "updated_at": "2026-02-10T12:30:01.108Z",
  "expires_at": "2026-02-10T12:35:00.612Z",
  "id": "bf610a8d-f055-41bd-aa16-894c913d1bb3",
  "state": {
    "current": "completed"
  },
  "config": {
    "prompt": "puppies in a cloud, 4k",
    "steps": 4,
    "width": 1024,
    "height": 1024
  },
  "metrics": {
    "elapsed": 0.29949116706848145,
    "ips": 13.355986552636335
  },
  "price": {
    "product": "inference-flux-schnell-large-steps-4",
    "dollars": 0.0025
  }
}
```

### `price` Object

| Field     | Type   | Description                                 |
| --------- | ------ | ------------------------------------------- |
| `product` | string | The billing product identifier for this job |
| `dollars` | number | The cost of the job in USD                  |

> note:
>
> The `price` field is only present when `?price=true` is set **and** the job
> completes successfully. If the job fails, no pricing information is returned.

> tip:
>
> Pricing is calculated after the job finishes, so the cost reflects the actual
> work performed — including the specific job type, configuration, and any
> resources consumed.
