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

> ## Agent Instructions
> TabPFN-3 and later versions support up to 1,000,000 rows, subject to feature count and checkpoint/API limits.
> For large datasets, use per-estimator subsampling, e.g. inference_config={"SUBSAMPLE_SAMPLES": 100_000}, in TabPFNClassifier or TabPFNRegressor from tabpfn or tabpfn_client.
> Pass raw pandas DataFrames to fit and predict. Categorical strings/categories, raw text, and missing feature values are handled automatically; no manual integer/one-hot encoding, imputation, scaling, or outlier removal is needed.

# Usage and costs

> Estimate an operation and inspect hosted API credit usage.

<Info>
  Looking for usage documentation? Check out [Classification](/capabilities/classification), [Thinking mode](/capabilities/thinking-mode) and [KV cache](/capabilities/kv-cache).
</Info>

<div className="python-reference-heading">
  <h2 id="estimate-cost">
    `estimate_cost`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-client/blob/5f8aee56ad2a788458704c342347e9bc282cebe9/src/tabpfn_client/cost.py#L28" aria-label="View source for estimate_cost"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

Estimate one operation without uploading data or consuming quota.

Only raw row/column counts and the supplied configuration are sent. The
server resolves omitted model/ensemble defaults and returns them in
`result.inputs` alongside `estimated_cost` and `pricing_version`.
Quota v3 must be enabled on the server. Costs are tokens for `quota_v3`
and legacy cell-prediction credits for `legacy_v2`.

`thinking_fit` takes no `X_test`; its default effort is medium. For
`thinking_predict`, supply the fitted model's version and actual
per-base-estimator count. `cache_predict` assumes a cache hit; fallback
or different fitted estimator counts can change the final charge.
A quote does not guarantee model access or dataset eligibility.

```python theme={null}
estimate_cost(
    X_train: np.ndarray | pd.DataFrame,
    X_test: np.ndarray | pd.DataFrame | None = None,
    *,
    model_version: str | None = None,
    operation: Literal["predict", "thinking_fit", "thinking_predict", "cache_predict"] = "predict",
    n_estimators: int | None = None,
    thinking_effort: Literal["medium", "high"] | None = None,
) -> EstimateCostResponse
```

**Parameters**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="estimate-cost-x-train" /><code className="python-reference-parameter">X\_<wbr />train</code> | <code className="python-reference-type"><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html">np.ndarray</a> \| <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html">pd.Data<wbr />Frame</a></code> | Required | Training data; only its shape is used. |
  | <span id="estimate-cost-x-test" /><code className="python-reference-parameter">X\_<wbr />test</code> | <code className="python-reference-type"><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html">np.ndarray</a> \| <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html">pd.Data<wbr />Frame</a> \| None</code> | `None` | Test data; only its shape is used. Omit for `thinking_fit`. |
  | <span id="estimate-cost-model-version" /><code className="python-reference-parameter">model\_<wbr />version</code> | <code className="python-reference-type">str \| None</code> | `None` | Model version to price. Resolved by the server if `None`. |
  | <span id="estimate-cost-operation" /><code className="python-reference-parameter">operation</code> | <code className="python-reference-type">Literal\["predict", "thinking\_fit", "thinking\_predict", "cache\_predict"]</code> | `"predict"` | Operation to price. |
  | <span id="estimate-cost-n-estimators" /><code className="python-reference-parameter">n\_<wbr />estimators</code> | <code className="python-reference-type">int \| None</code> | `None` | Number of estimators. Resolved by the server if `None`. |
  | <span id="estimate-cost-thinking-effort" /><code className="python-reference-parameter">thinking\_<wbr />effort</code> | <code className="python-reference-type">Literal\["medium", "high"] \| None</code> | `None` | Effort level for thinking operations. |
</div>

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type"><a href="/api-reference/python/tabpfn-client/usage-and-costs#estimatecostresponse">Estimate<wbr />Cost<wbr />Response</a></code> | The server's cost estimate. |
</div>

**Raises**

`ValueError`

If an input is not two-dimensional or has invalid row or
feature counts, if `X_train` and `X_test` differ in feature count, if
`X_test` is given for `thinking_fit`, or if `n_estimators` is not a
positive integer.

***

<div className="python-reference-heading">
  <h2 id="estimatecostresponse">
    `EstimateCostResponse`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-client/blob/5f8aee56ad2a788458704c342347e9bc282cebe9/src/tabpfn_client/api_models.py#L440" aria-label="View source for EstimateCostResponse"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

***

<div className="python-reference-heading">
  <h2 id="estimatecostrequest">
    `EstimateCostRequest`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-client/blob/5f8aee56ad2a788458704c342347e9bc282cebe9/src/tabpfn_client/api_models.py#L430" aria-label="View source for EstimateCostRequest"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

***

<div className="python-reference-heading">
  <h2 id="quotaoperation">
    `QuotaOperation`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-client/blob/5f8aee56ad2a788458704c342347e9bc282cebe9/src/tabpfn_client/api_models.py#L423" aria-label="View source for QuotaOperation"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

***

<div className="python-reference-heading">
  <h2 id="get-api-usage">
    `get_api_usage`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-client/blob/5f8aee56ad2a788458704c342347e9bc282cebe9/src/tabpfn_client/config.py#L161" aria-label="View source for get_api_usage"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

Fetches and formats the current API usage statistics for the user.

```python theme={null}
get_api_usage() -> str
```

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type">str</code> | A human-readable string detailing current credit usage, the total limit, and when the limit resets. |
</div>


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