> ## 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.trainings.estimateCost()

> Estimate training cost.

Send the prepared `inputSetId`. Returns either a maximum charge and fingerprint for starting a run, or issues that block training. Returns 409 while inputs are still being prepared or after they expire.

## Signature

Method signature on `client.trainings`:

```ts theme={null}
estimateCost(args: {
  trainingId: string;
  inputSetId: string;
}): Promise<TrainingCostEstimate>;
```

## Parameters

**trainingId** `string` *required*

Training draft ID with prefix `trg.`.

**inputSetId** `string` *required*

The immutable input set used to calculate a Training Cost Estimate.

## Returns

`Promise<TrainingCostEstimate>`

A validation result and conservative maximum price for one Training draft.

**trainingId** `TrainingId` *required*

Training draft ID with prefix `trg.`.

**inputSetId** `TrainingCostEstimateInputSetId` *required*

The immutable input set used to calculate a Training Cost Estimate.

**cutoff** `string` *required*

Dataset cutoff used to select the inputs, as an ISO 8601 timestamp.

**inputs** `TrainingCostEstimateInputs` *required*

Prepared inputs and their validation reports.

**Fields**

**training** `object` *required*

Frozen training selection and its validation result.

**Fields**

**datasetId** `string` *required*

Dataset ID with prefix `ds.` containing these examples.

**datasetExportId** `string` *required*

Export ID with prefix `dex.` for the frozen selection.

**report** `TrainingInputReport | null` *required*

Validation report for these examples, or null when the export failed or produced no report.

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

**failure** `TrainingInputExportFailure` *required*

Export failure details, or null when the export did not fail.

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

**heldOutRows** `number`

Number of rows excluded by split roles; absent when that count has not been calculated.

**validation** `object | null` *required*

Frozen validation selection and its validation result, or null when no validation input is selected.

**Fields**

**datasetId** `string` *required*

Dataset ID with prefix `ds.` containing these examples.

**datasetExportId** `string` *required*

Export ID with prefix `dex.` for the frozen selection.

**report** `TrainingInputReport | null` *required*

Validation report for these examples, or null when the export failed or produced no report.

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

**failure** `TrainingInputExportFailure` *required*

Export failure details, or null when the export did not fail.

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

**heldOutRows** `number`

Number of rows excluded by split roles; absent when that count has not been calculated.

**capabilityVersion** `string` *required*

Version of the model capability rules used for this estimate.

**pricingVersion** `string` *required*

Version of the pricing rules used for this estimate.

**calculatedAt** `string` *required*

Time the estimate was calculated, as an ISO 8601 timestamp.

**status** `"blocked" | "ready"` *required*

Estimate status; `blocked` means the reported issues must be resolved before starting a run. Estimate status; `ready` means the inputs passed validation and a maximum charge is available.

**issues** `TrainingCostEstimateIssue[]` *required*

Issues preventing a ready cost estimate. Blocking issues; always empty for a ready estimate.

**Variant 1**

**item** `TrainingCostEstimateIssue` *required*

**Fields**

**code** `"unsupported_source" | "export_failed" | "invalid_examples" | "empty_selection" | "row_limit_exceeded" | "token_limit_exceeded" | "estimator_mismatch" | "unsupported_duration"` *required*

Reason the estimate is blocked: unsupported source or duration, failed export, invalid or empty examples, exceeded row or token limits, or a mismatched token estimator.

**message** `string` *required*

Explanation of the issue preventing a ready estimate.

**purpose** `"training" | "validation" | null` *required*

Affected input: `training` or `validation`, or null when the issue applies to the whole estimate.

**Variant 2**

**item** `TrainingCostEstimateIssue` *required*

**Fields**

**code** `"unsupported_source" | "export_failed" | "invalid_examples" | "empty_selection" | "row_limit_exceeded" | "token_limit_exceeded" | "estimator_mismatch" | "unsupported_duration"` *required*

Reason the estimate is blocked: unsupported source or duration, failed export, invalid or empty examples, exceeded row or token limits, or a mismatched token estimator.

**message** `string` *required*

Explanation of the issue preventing a ready estimate.

**purpose** `"training" | "validation" | null` *required*

Affected input: `training` or `validation`, or null when the issue applies to the whole estimate.

**budget** `TrainingResourceBudget`

Estimated and maximum training resource usage.

**Fields**

**methodWorkUnits** `number` *required*

Token-based work estimate, including epochs and the method-specific training and validation workload.

**estimatedGpuSeconds** `number` *required*

Estimated total GPU time, in seconds summed across all GPUs.

**estimatedWallSeconds** `number` *required*

Estimated elapsed training time, in seconds.

**maximumWallSeconds** `number` *required*

Conservative maximum elapsed training time, in seconds.

**maximumGpuSeconds** `number` *required*

Maximum GPU time used to bound the charge, in seconds summed across all GPUs.

**gpuCount** `number` *required*

Number of GPUs used for the estimate.

**maximumCharge** `string`

Maximum charge in US dollars as a decimal string.

**currency** `"USD"`

Currency used for the estimate; always `USD`.

**fingerprint** `string`

SHA-256 fingerprint of this estimate, as 64 lowercase hexadecimal characters; send it when starting the run.

## Errors

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

| Status | Description |
| - | - |
| 409 | Expired Input Set or inputs still running |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /trainings/{trainingId}/cost-estimate`](https://docs.platform.toloka.ai/docs/api-reference/trainings/estimate-training-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.trainings.estimateCost({
  trainingId: "trg.019a0000-0000-7000-8000-000000000001",
  inputSetId: "tei.019a0000-0000-7000-8000-000000000001"
});
console.log(estimate);
```

```json estimateCost() theme={null}
{
  "trainingId": "trg.019a0000-0000-7000-8000-000000000001",
  "inputSetId": "tei.019a0000-0000-7000-8000-000000000001",
  "cutoff": "2026-01-01T00:00:00Z",
  "inputs": {
    "training": {
      "datasetId": "ds.019a0000-0000-7000-8000-000000000001",
      "datasetExportId": "dex.019a0000-0000-7000-8000-000000000001",
      "report": null,
      "failure": null
    },
    "validation": null
  },
  "capabilityVersion": "<string>",
  "pricingVersion": "<string>",
  "calculatedAt": "2026-01-01T00:00:00Z",
  "status": "blocked",
  "issues": [
    {
      "code": "unsupported_source",
      "message": "<string>",
      "purpose": null
    }
  ]
}
```


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