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

# client.pipelines.estimateCost()

> Estimate pipeline cost.

Return expected and maximum costs for the current graph and attached dataset. Optional `itemLimit` and `itemFilter` override the Start node settings for this estimate. No run is started.

## Signature

Method signature on `client.pipelines`:

```ts theme={null}
estimateCost(args: {
  pipelineId: string;
  itemLimit?: number;
  itemFilter?: DatasetItemFilter;
}): Promise<PipelineCostEstimate>;
```

## Parameters

**pipelineId** `string` *required*

Pipeline ID with prefix `pl.`.

**itemLimit** `number`

Maximum number of items to price. Defaults to the Start node's `itemLimit`, or all matching items if no limit is set.

**itemFilter** `DatasetItemFilter`

Filter selecting items to price. Defaults to the Start node's `itemFilter`.

**Fields**

**fieldValues** `DatasetFieldValueConditions`

Field-value conditions that selected rows must satisfy; defaults to no conditions.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/estimate-pipeline-cost.md) for the complete schema.

**fieldSources** `DatasetFieldSourceConditions`

Field-author conditions that selected rows must satisfy; defaults to no conditions.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/estimate-pipeline-cost.md) for the complete schema.

**missingRevisionFields** `string[]`

Field IDs with prefix `df.` that must have no revision on a selected row; defaults to an empty array.

**slice** `DatasetSliceSelection`

Slice whose frozen rows and fields to read; omit to use live dataset rows.

**Fields**

**sliceId** `string` *required*

Dataset slice ID with prefix `dsl.`.

**parts** `DatasetSplitPartInclusion`

Split parts to include; omit to include every part.

**Fields**

**fieldId** `string` *required*

Split field ID with prefix `df.`.

**names** `string[]` *required*

Names of the split parts to select.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/estimate-pipeline-cost.md) for the complete schema.

**excludeParts** `DatasetSplitPartExclusions`

Split-part selections to exclude; omit when no parts should be excluded.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/estimate-pipeline-cost.md) for the complete schema.

**createdBefore** `string`

Cutoff for dataset items and field revisions, as an ISO 8601 timestamp; omit to use the endpoint's cutoff.

## Returns

`Promise<PipelineCostEstimate>`

A forecast of pipeline cost for the current graph. Expected and maximum are forecasts; billing is pay-as-you-go.

**dataset** `object` *required*

Dataset and item count used for the forecast.

**Fields**

**datasetId** `string` *required*

Dataset ID with prefix `ds.` being priced.

**itemCount** `number` *required*

Number of matching dataset items included in the forecast.

**total** `object` *required*

Forecast costs for all priced nodes.

**Fields**

**expected** `string` *required*

Expected pipeline cost in US dollars, formatted with a currency symbol.

**worstCase** `string` *required*

Maximum forecast pipeline cost in US dollars, formatted with a currency symbol.

**bestCase** `string | null` (default: null)

Minimum forecast pipeline cost in US dollars with a currency symbol, or null when unavailable.

**perItemExpected** `string | null` *required*

Expected cost per input item in US dollars with a currency symbol, or null when no items are selected.

**perItemWorstCase** `string | null` *required*

Maximum forecast cost per input item in US dollars with a currency symbol, or null when no items are selected.

**disclaimer** `string` *required*

Explanation of the estimate assumptions and billing limitations.

**nodes** `object[]` *required*

Per-node cost forecasts, including nodes that cannot be priced.

**kind: "non-priced"**

**nodeId** `string` *required*

Identifier of the pipeline node being priced.

**nodeType** `"root" | "code" | "generation_sft" | "match" | "quorum_sft"` *required*

Type of node being priced.

**nodeNameDisplay** `string` *required*

Display name of the node.

**expectedItems** `number` *required*

Expected number of items reaching this node.

**kind** `"non-priced"` *required*

Estimate kind: `non-priced` for nodes without charges, `validation-errors` when configuration prevents pricing, or `priced` when a forecast is available.

**kind: "validation-errors"**

**nodeId** `string` *required*

Identifier of the pipeline node being priced.

**nodeType** `"root" | "code" | "generation_sft" | "match" | "quorum_sft"` *required*

Type of node being priced.

**nodeNameDisplay** `string` *required*

Display name of the node.

**expectedItems** `number` *required*

Expected number of items reaching this node.

**kind** `"validation-errors"` *required*

Estimate kind: `non-priced` for nodes without charges, `validation-errors` when configuration prevents pricing, or `priced` when a forecast is available.

**kind: "priced"**

**nodeId** `string` *required*

Identifier of the pipeline node being priced.

**nodeType** `"root" | "code" | "generation_sft" | "match" | "quorum_sft"` *required*

Type of node being priced.

**nodeNameDisplay** `string` *required*

Display name of the node.

**expectedItems** `number` *required*

Expected number of items reaching this node.

**kind** `"priced"` *required*

Estimate kind: `non-priced` for nodes without charges, `validation-errors` when configuration prevents pricing, or `priced` when a forecast is available.

**groupSubtitle** `object` *required*

Summary of the quantities and assumptions used for this node.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/estimate-pipeline-cost.md) for the complete schema.

**expectedTotal** `string` *required*

Expected node cost in US dollars, formatted with a currency symbol.

**maxTotal** `string` *required*

Maximum forecast node cost in US dollars, formatted with a currency symbol.

**perItemExpected** `string | null` *required*

Expected cost per item in US dollars with a currency symbol, or null when there are no items to price.

**displayBreakdown** `CostBreakdownLine[]` *required*

Cost lines and nested calculations for this node.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/estimate-pipeline-cost.md) for the complete schema.

**warning** `string`

Pricing warning; absent when no warning applies.

**graphVersion** `PipelineGraphVersion` *required*

The snapshot version expected to still be active. A stale version is rejected with HTTP 409.

## Errors

HTTP errors throw [`PotatoApiError`](https://docs.platform.toloka.ai/docs/sdk/errors). The endpoint documents these error responses:

| Status | Description |
| - | - |
| 400 | Pipeline has no dataset attached or the graph is missing a root node |
| 404 | Pipeline not found |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /pipelines/{pipelineId}/cost-estimate`](https://docs.platform.toloka.ai/docs/api-reference/pipelines/estimate-pipeline-cost).

```ts estimateCost() theme={null}
import { createClient } from "@toloka-platform/sdk";

const client = createClient({
  baseUrl: "https://platform.toloka.ai",
  apiKey: process.env.TOLOKA_API_KEY!,
});

const estimate = await client.pipelines.estimateCost({
  pipelineId: "pl.019a0000-0000-7000-8000-000000000001",
  itemLimit: 100
});
console.log(estimate);
```

```json estimateCost() theme={null}
{
  "dataset": {
    "datasetId": "ds.019a0000-0000-7000-8000-000000000001",
    "itemCount": 0
  },
  "total": {
    "expected": "<string>",
    "worstCase": "<string>",
    "perItemExpected": null,
    "perItemWorstCase": null
  },
  "disclaimer": "<string>",
  "nodes": [
    {
      "nodeId": "<string>",
      "nodeType": "root",
      "nodeNameDisplay": "<string>",
      "expectedItems": 0,
      "kind": "non-priced"
    }
  ],
  "graphVersion": "ple.019a0000-0000-7000-8000-000000000001"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.