Documentation
Fine-tuning
View .mdOpenAPI

Get a price quote

GEThttps://weights.fyi/run/v1/quotescope: read
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). 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.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and your token. The token needs the read scope. Reads are not counted against the token's request rate.
kindqueryyesfinetune.
datasetqueryone of the twoThe dataset to quote for, ds_ followed by 24 hexadecimal characters; it must be yours and ready. Its row counts are used.
train_rowsqueryone of the twoWhen you name no dataset: the number of training rows, a whole number of at least 1.
validation_rowsquerynoWith train_rows: the number of validation rows, 0 or more; 0 by default.
epochsquerynoThe number of epochs, from 1 to 10; the recipe's default, 10, when left out.
recipequerynolaya-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.
modelquerynoThe 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 lists which recipe and dataset format go with each.

Return value

200 OK with the estimate.

FieldMeaning
modelThe base the job would train.
kindfinetune.
datasetThe dataset you named, or null when you gave row counts.
recipeThe recipe the estimate is for.
epochsThe number of epochs the estimate is for.
train_rows, validation_rowsThe training and validation rows counted, from the dataset or from your parameters.
pages_per_epochThe training pages one epoch trains.
estimate_training_tokensThe training tokens the estimate assumes: epochs x training pages x the tokens a page usually holds.
usd_per_1m_training_tokensThe price per 1M training tokens.
estimate_usd_for_jobThe estimate for the whole job in US dollars.
estimatetrue: the job is charged for the tokens it trains.
basisThe estimate in words.

Errors

StatusCodeWhen it happensWhat to do
400invalid_parameterA 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.
400parameter_out_of_rangeepochs, train_rows or validation_rows is outside its bounds; low and high give them.Stay inside them.
400model_not_availableThe 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.
400recipe_not_availableThe recipe is unknown; available lists the recipes.Name one of them.
401unauthorized, invalid_token, token_revoked, token_expiredNo token, or one that does not work (any more).Use a valid token.
403scope_required, account_suspendedThe token lacks read, or the account is suspended.Use a token with read.
404dataset_not_foundThe dataset does not exist or belongs to another account.Check the id.
404not_configuredFine-tuning is not switched on for this service (feature: training).See Fine-tune a model.
409dataset_not_readyThe 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, Prices and billing.