> ## Documentation Index
> Fetch the complete documentation index at: https://weights.fyi/run/llms.txt

# GET /v1/quote (finetune)

```text
GET https://weights.fyi/run/v1/quote?kind=finetune&dataset=<dataset_id>[&epochs=<n>][&recipe=<recipe>][&model=<base>]
GET https://weights.fyi/run/v1/quote?kind=finetune&train_rows=<n>[&validation_rows=<n>][&epochs=<n>][&recipe=<recipe>][&model=<base>]
Authorization: Bearer <token>                    scope: read
```

**Available since:** 2026-10-08, when fine-tuning went live on weights.fyi/run. Fine-tuning is switched on for this service.

**Answer time:** synchronous: the estimate is computed from the current prices and the measured training speed while you wait.

Estimates a training job before you start it, for an uploaded dataset by id, or for one you have not made yet by its row counts, so you can weigh epochs and size before uploading. A fine-tune is charged per training token: the tokens of your training pages as the trainer reads them, every epoch, never the validation pass. Before the trainer has read your pages their tokens are not known, so the estimate takes the tokens a page of a real release held, about 1,133, times your training pages times the epochs, at the price per 1M training tokens. Only `epochs` changes it; `patience`, `seed` and `checkpoint_seconds` do not.

The job is charged for the tokens it actually trains, as it trains: early stopping costs less, a page longer than usual more, and a move nothing, since steps trained again after one are not charged twice. Your credit is checked against the job's own estimate at [POST /v1/jobs (finetune)](/run/docs/reference/jobs-create-finetune.md). Every base is estimated with that same page figure, so for a specialist or a student base, whose rows are not pages of that classifier, read the estimate as rough. Without `kind=finetune` the path [quotes pages](/run/docs/reference/quote.md).

## Request

| Name | Where | Required | Meaning |
|---|---|---|---|
| `Authorization` | header | yes | `Bearer` and your token. The token needs the `read` scope. Reads are not counted against the token's request rate. |
| `kind` | query | yes | `finetune`. |
| `dataset` | query | one of the two | The dataset to quote for, `ds_` followed by 24 hexadecimal characters; it must be yours and `ready`. Its row counts are used. |
| `train_rows` | query | one of the two | When you name no dataset: the number of training rows, a whole number of at least 1. |
| `validation_rows` | query | no | With `train_rows`: the number of validation rows, 0 or more; 0 by default. |
| `epochs` | query | no | The number of epochs, from 1 to 10; the recipe's default, 10, when left out. |
| `recipe` | query | no | `laya-page-role/v2` (the default) or `laya-page-role/v1` for the five-label page classifier; `laya-specialist/v1` for a Laya specialist; `laya-specialist-heads/v1` for the multi-head specialist; `laya-student-lora-sft/v1` or `laya-student-lora-dpo/v1` for a generative student. Its default `epochs` apply when you send none. |
| `model` | query | no | The base to train. `laya-page-role-base`, the default, is the five-label page classifier. Also taken: a Laya specialist's own id, such as `laya-link-scorer` (the specialist `laya-page-role` only together with `recipe=laya-specialist/v1`); `laya-specialist-heads-base`; and a student base, such as `qwen3.5-4b` or `gemma3-4b`. [Fine-tune a model](/run/docs/fine-tune.md) lists which recipe and dataset format go with each. |

## Return value

**200 OK** with the estimate.

| Field | Meaning |
|---|---|
| `model` | The base the job would train. |
| `kind` | `finetune`. |
| `dataset` | The dataset you named, or `null` when you gave row counts. |
| `recipe` | The recipe the estimate is for. |
| `epochs` | The number of epochs the estimate is for. |
| `train_rows`, `validation_rows` | The training and validation rows counted, from the dataset or from your parameters. |
| `pages_per_epoch` | The training pages one epoch trains. |
| `estimate_training_tokens` | The training tokens the estimate assumes: epochs x training pages x the tokens a page usually holds. |
| `usd_per_1m_training_tokens` | The price per 1M training tokens. |
| `estimate_usd_for_job` | The estimate for the whole job in US dollars. |
| `estimate` | `true`: the job is charged for the tokens it trains. |
| `basis` | The estimate in words. |

## Errors

| Status | Code | When it happens | What to do |
|---|---|---|---|
| `400` | `invalid_parameter` | A number is not a whole number, or you named neither a dataset nor `train_rows` (the `message` says so). | Name a dataset, or give `train_rows`. |
| `400` | `parameter_out_of_range` | `epochs`, `train_rows` or `validation_rows` is outside its bounds; `low` and `high` give them. | Stay inside them. |
| `400` | `model_not_available` | The model named is not a base this recipe trains; `trainable` lists the bases it does. | Name one of them, or leave `model` out for the page classifier. |
| `400` | `recipe_not_available` | The recipe is unknown; `available` lists the recipes. | Name one of them. |
| `401` | `unauthorized`, `invalid_token`, `token_revoked`, `token_expired` | No token, or one that does not work (any more). | Use a valid token. |
| `403` | `scope_required`, `account_suspended` | The token lacks `read`, or the account is suspended. | Use a token with `read`. |
| `404` | `dataset_not_found` | The dataset does not exist or belongs to another account. | Check the id. |
| `404` | `not_configured` | Fine-tuning is not switched on for this service (`feature: training`). | See [Fine-tune a model](/run/docs/fine-tune.md). |
| `409` | `dataset_not_ready` | The dataset's upload is not finished, or it failed; `status` says which. | Finish the upload, or quote by row counts. |

## Examples

Ten epochs over 20,000 training and 5,000 validation pages, before any upload, from a test copy of the service on 2026-10-10:

```sh
curl -s "https://weights.fyi/run/v1/quote?kind=finetune&train_rows=20000&validation_rows=5000&epochs=10" \
  -H "Authorization: Bearer $WEIGHTS_API_KEY"
```

```json
{
  "model": "laya-page-role-base",
  "kind": "finetune",
  "dataset": null,
  "recipe": "laya-page-role/v2",
  "epochs": 10,
  "train_rows": 20000,
  "validation_rows": 5000,
  "pages_per_epoch": 20000,
  "estimate_training_tokens": 226683125,
  "usd_per_1m_training_tokens": 0.006127,
  "estimate_usd_for_job": 1.3888888888888888,
  "estimate": true,
  "basis": "An estimate: 10 epochs over 20,000 training pages at about 1,133 tokens a page, the tokens our trainer fed a page of a real release, about 226,683,125 training tokens at $0.0061 per 1M. The validation pass is not charged. The job is charged for the tokens the trainer actually trains, as it trains; its cost so far is on your panel and its job page."
}
```

## Patterns

### Choosing the number of epochs

Quote the full 10 to know the most the job can cost and check your credit covers it; the default recipe stops after three epochs without a better score, so you pay only for the epochs that run.

## History

- 2026-10-08: live with fine-tuning: by dataset or by row counts, at the speed measured that day.
- 2026-10-10: priced per training token; the validation pass and the start of the model are no longer in it.
- 2026-11-16: the specialist and student bases and their recipes documented; `laya-page-role-base` is the default, not the only base.

## See also

[Fine-tune a model](/run/docs/fine-tune.md), [Prices and billing](/run/docs/prices.md).
