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

> Prepare training cost estimate inputs.

Send an `Idempotency-Key` header and an empty JSON body to freeze training and validation inputs for the current configuration. Poll each non-null ID in `exports` with `GET /api/v2-beta/exports/{exportId}` until its `status` is `succeeded` or `failed`. A failed export blocks the estimate with an `export_failed` issue. Once all exports succeed, send the input set's `id` as `inputSetId` to `POST /api/v2-beta/trainings/{trainingId}/cost-estimate` before `expiresAt`. Test rows are excluded, except validation rows in a part with both validate and test roles in the selected split field.

## Signature

Method signature on `client.trainings`:

```ts theme={null}
prepareCostEstimateInputs(args: {
  trainingId: string;
  idempotencyKey: string;
}): Promise<TrainingCostEstimateInputSet>;
```

## Parameters

**trainingId** `string` *required*

Training draft ID with prefix `trg.`.

**idempotencyKey** `string` *required*

A caller-generated key reused for retries of one logical request.

## Returns

`Promise<TrainingCostEstimateInputSet>`

Frozen training and validation inputs prepared for a cost estimate.

**id** `TrainingCostEstimateInputSetId` *required*

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

**trainingId** `TrainingId` *required*

Training draft ID with prefix `trg.`.

**cutoff** `string` *required*

Dataset cutoff for these frozen inputs, as an ISO 8601 timestamp.

**expiresAt** `string` *required*

Deadline for estimating and starting a run with this input set, as an ISO 8601 timestamp.

**exports** `object` *required*

Export IDs to poll until all non-null exports succeed before estimating the cost.

**Fields**

**training** `string` *required*

Export ID with prefix `dex.` used to validate the training examples.

**validation** `string | null` *required*

Export ID with prefix `dex.` used to validate the validation examples, or null when no validation selection exists.

**createdAt** `string` *required*

Time this input set was prepared, as an ISO 8601 timestamp.

## Errors

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

| Status | Description |
| - | - |
| 409 | Expired replay or too many unconsumed Input Sets |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /trainings/{trainingId}/cost-estimate-inputs`](https://docs.platform.toloka.ai/docs/api-reference/trainings/prepare-training-cost-estimate-inputs).

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

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

const inputSet = await client.trainings.prepareCostEstimateInputs({
  trainingId: "trg.019a0000-0000-7000-8000-000000000001",
  idempotencyKey: crypto.randomUUID()
});
console.log(inputSet);
```

```json prepareCostEstimateInputs() theme={null}
{
  "id": "tei.019a0000-0000-7000-8000-000000000001",
  "trainingId": "trg.019a0000-0000-7000-8000-000000000001",
  "cutoff": "2026-01-01T00:00:00Z",
  "expiresAt": "2026-01-01T00:00:00Z",
  "exports": {
    "training": "dex.019a0000-0000-7000-8000-000000000001",
    "validation": null
  },
  "createdAt": "2026-01-01T00:00:00Z"
}
```


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