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

> Confirm a batch inference run.

Accept the prepared quote to reserve its maximum charge and start inference. Returns the updated run. Returns 409 if the quote is unavailable or expired, or the run failed or was canceled. Repeated confirmation of an already confirmed run returns its current state.

## Signature

Method signature on `client.batchInference`:

```ts theme={null}
confirmRun(args: {
  batchInferenceRunId: string;
}): Promise<BatchInferenceRun>;
```

## Parameters

**batchInferenceRunId** `string` *required*

ID of the batch inference run, with prefix `bir.`.

## Returns

`Promise<BatchInferenceRun>`

A batch inference run with its quote, progress, charge, and output location.

**id** `BatchInferenceRunId` *required*

ID of the batch inference run, with prefix `bir.`.

**projectId** `ProjectId` *required*

Project ID with prefix `pp.`.

**datasetId** `DatasetId` *required*

Dataset ID with prefix `ds.`.

**model** `BatchInferenceModel` *required*

The model to use: a catalog base model or a model version in this project containing a LoRA adapter or full weights. More model types may be added, so branch on `type`.

**type: "base\_model"**

**type** `"base_model"` *required*

Model source: `base_model` uses a catalog model; `model_version` uses a published project model version.

**baseModelId** `"qwen3-4b" | "qwen3-8b" | "qwen3-32b" | "qwen3-235b"` *required*

Catalog base model identifier.

**type: "model\_version"**

**type** `"model_version"` *required*

Model source: `base_model` uses a catalog model; `model_version` uses a published project model version.

**modelVersionId** `string` *required*

Model version ID with prefix `mdv.`.

**mode** `BatchInferenceMode` *required*

How each row is processed. Defaults to `single_turn`: one model call per row, with the answer written as text. More modes may be added, so branch on `type`.

**Fields**

**type** `"single_turn"` *required*

Processing mode; `single_turn` makes one model call for each requested sample of a row.

**sampling** `object` *required*

Generation settings used for each model call.

**Fields**

**maxOutputTokens** `number` *required*

Maximum number of generated tokens per answer, from 1 to 8192.

**temperature** `number` (default: 0)

Sampling temperature from 0 to 2; defaults to 0.

**topP** `number`

Cumulative probability cutoff for nucleus sampling, greater than 0 and at most 1; omit to use the model default.

**stop** `string[]`

One to four strings that stop generation when encountered; absent when no stop strings are set.

**seed** `number`

Optional sampling seed, from 0 to 2147483647.

**samplesPerRow** `number` (default: 1)

Number of answers to generate for each row, from 1 to 16; defaults to 1.

**output** `object` *required*

Dataset and field where this run writes completions.

**Fields**

**type** `"field" | "dataset"` *required*

Output destination: `field` writes to the source dataset, while `dataset` writes to a new dataset.

**datasetId** `DatasetId` *required*

Dataset ID with prefix `ds.`.

**fieldId** `DatasetFieldId` *required*

Dataset field ID with prefix `df.`.

**status** `"preparing" | "awaiting_confirmation" | "queued" | "running" | "writing_outputs" | "stopping" | "blocked" | "completed" | "failed" | "canceled"` *required*

Run state from input preparation through confirmation, execution, and output writing; `stopping` is cancellation in progress, `blocked` requires action, and `completed`, `failed`, or `canceled` are terminal.

**progress** `object | null` *required*

Latest generation progress while running or stopping; null in other states or when progress is unavailable.

**Fields**

**phase** `"queued" | "preparing" | "generating" | "finishing"` *required*

Generation phase: `queued`, `preparing` inputs, `generating` answers, or `finishing` results.

**requests** `object`

Request progress; absent when request counts are unavailable.

**Fields**

**done** `number` *required*

Number of model requests completed.

**total** `number` *required*

Total number of model requests.

**blockedReason** `"funds" | "payment" | "billing_review" | null` *required*

Reason the run is blocked: `funds` to reserve the budget, `payment` to settle usage, or `billing_review` for staff review; otherwise null.

**message** `string | null` *required*

Current status or billing explanation, or null when none is available.

**error** `object | null` *required*

Failure or cancellation details, or null when no error is recorded.

**Fields**

**code** `"requests_export_failed" | "no_requests" | "selection_too_large" | "billing_rejected" | "provider_failed" | "provider_timeout" | "invalid_provider_output" | "output_rejected" | "payment_window_expired" | "canceled"` *required*

Machine-readable reason the run failed or was canceled.

**message** `string` *required*

Explanation of the failure or cancellation.

**quote** `object | null` *required*

Price quote for confirmation, or null before a quote is ready.

**Fields**

**requests** `number` *required*

Number of model requests included in the quote.

**skippedRows** `number` *required*

Number of selected rows excluded while preparing requests.

**maximumCharge** `string` *required*

Maximum quoted charge in US dollars as a decimal string.

**currency** `"USD"` *required*

Currency of the quote; always `USD`.

**confirmBefore** `string | null` *required*

Deadline assigned to confirm this quote, as an ISO 8601 timestamp, or null when no deadline was assigned.

**chargedAmount** `string | null` *required*

Settled charge in US dollars as a decimal string, or null before a charge is recorded.

**result** `object | null` *required*

Output counts and token usage, or null before results are available.

**Fields**

**written** `number` *required*

Number of generated answers written.

**failed** `number` *required*

Number of failed, missing, or unusable answers.

**truncated** `number` *required*

Number of answers truncated during generation.

**inputTokens** `number` *required*

Input tokens reported for successfully written answers.

**outputTokens** `number` *required*

Output tokens reported for successfully written answers.

**errorCounts** `object` *required*

Counts of request failures, keyed by error code.

**Fields**

**\[key: string]** `number`

**errorSamples** `object[]` *required*

Sample of request failures, up to 20 entries.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/batch-inference/confirm-batch-inference-run.md) for the complete schema.

**createdAt** `string` *required*

Time the batch inference run was created, as an ISO 8601 timestamp.

**updatedAt** `string` *required*

Time the batch inference run was last updated, 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 | The quote is not ready or has expired, or the run failed or was canceled |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /batch-inference-runs/{batchInferenceRunId}/confirm`](https://docs.platform.toloka.ai/docs/api-reference/batch-inference/confirm-batch-inference-run).

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

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

const run = await client.batchInference.confirmRun({
  batchInferenceRunId: "bir.019a0000-0000-7000-8000-000000000001"
});
console.log(run);
```

```json confirmRun() theme={null}
{
  "id": "bir.019a0000-0000-7000-8000-000000000001",
  "projectId": "pp.019a0000-0000-7000-8000-000000000001",
  "datasetId": "ds.019a0000-0000-7000-8000-000000000001",
  "model": {
    "type": "base_model",
    "baseModelId": "qwen3-4b"
  },
  "mode": {
    "type": "single_turn"
  },
  "sampling": {
    "maxOutputTokens": 1
  },
  "output": {
    "type": "field",
    "datasetId": "ds.019a0000-0000-7000-8000-000000000001",
    "fieldId": "df.019a0000-0000-7000-8000-000000000001"
  },
  "status": "preparing",
  "progress": null,
  "blockedReason": null,
  "message": null,
  "error": null,
  "quote": null,
  "chargedAmount": null,
  "result": null,
  "createdAt": "2026-01-01T00:00:00Z",
  "updatedAt": "2026-01-01T00:00:00Z"
}
```


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