Documentation
Fine-tuning
View .mdOpenAPI

Quote a training job with its options

POSThttps://weights.fyi/run/v1/quotescope: read
text
POST https://weights.fyi/run/v1/quote
Authorization: Bearer <token>                    scope: read
Content-Type: application/json

{"kind": "finetune", ["recipe": "<recipe>",] ["model": "<base>",]
 "dataset": "<dataset_id>" | "train_rows": n, ["validation_rows": n,]
 ["options": {"epochs": n, ...}]}
Available since
2026-11-20: included in this build; see What is live for deployment status.
Answer time
synchronous: the estimate is computed from the current prices while you wait.

Estimates one training job as it would run: the recipe, the base, a dataset or row counts, and the options you would create the job with. The options are checked exactly as POST /v1/jobs (finetune) checks them, so a quote that answers is for a job that would be taken, and one outside the recipe's bounds is refused here first. Nothing is stored and nothing is charged.

GET /v1/quote (finetune) estimates the same job for the recipe's own settings and a number of epochs. Use the body when an option changes the work: for a laya-student-lora-grpo/v1 or laya-student-lora-opd/v1 recipe, num_generations (the completions sampled for each prompt) and teacher_model. Those two recipes are estimated on the working time the job needs, not on training tokens; basis says which. Pages and a language model's tokens have no body: GET /v1/quote.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and your token. The token needs the read scope. Reads are not counted against the token's request rate.
Content-Typeheaderyesapplication/json.
kindbodyyesfinetune.
recipebodynoThe recipe to estimate; laya-page-role/v2 when left out.
modelbodynoThe base to train; left out, the recipe's default base, or for a grpo or opd recipe the dataset's own.
datasetbodyone 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_rowsbodyone of the twoWhen you name no dataset: the number of training rows, a whole number of at least 1.
validation_rowsbodynoWith train_rows: the number of validation rows, 0 or more; 0 by default.
optionsbodynoThe job's options: epochs, patience, seed, checkpoint_seconds, and the recipe's own. For a grpo or opd recipe those include num_generations, temperature, max_completion_length and verifier (grounded_json_v1 or global_scraper_decision_v1: the one verifier every row must be scored by); kl_ref_coef for grpo; teacher_model, distill_coef and reward_weight for opd.

Any other field is refused (400 invalid_body).

Return value

200 OK with the estimate, in the fields of GET /v1/quote (finetune).

FieldMeaning
model, kind, dataset, recipeThe base the job would train, finetune, the dataset you named or null, and the recipe.
epochs, train_rows, validation_rowsWhat the estimate is for.
estimate_training_tokens, usd_per_1m_training_tokensThe training tokens assumed and the price per 1M of them.
estimate_usd_for_jobThe estimate for the whole job in US dollars: the figure your credit must cover when you create it.
basisThe estimate in words.

Errors

StatusCodeWhen it happensWhat to do
400invalid_json, invalid_bodyThe body is not a JSON object, or holds a field this call does not take; unknown lists them.Send the fields above.
400unsupported_quote_kindkind is not finetune.Quote pages and tokens with GET /v1/quote.
400option_out_of_rangeAn option is outside the recipe's bounds, or is not one the recipe takes; option, low and high say which.Stay inside them.
400invalid_parameter, parameter_out_of_rangeYou named neither a dataset nor train_rows, or a row count is not a whole number inside its bounds.Name a dataset, or give train_rows.
400model_not_available, recipe_not_available, dataset_format_mismatchThe base, the recipe or the dataset's format does not fit the others; the answer lists what does.Name ones that go together (Fine-tune a model).
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_found, not_configuredThe dataset is not yours or does not exist, or fine-tuning is not switched on for this service (feature: training).Check the id; 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.
415unsupported_media_typeThe body is not sent as application/json.Send JSON.

Examples

Three epochs of a student on 20,000 training and 1,000 validation rows, before any upload, from a test copy of the service on 2026-11-20:

sh
curl -s https://weights.fyi/run/v1/quote \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
  -d '{"kind": "finetune", "recipe": "laya-student-lora-sft/v1", "model": "qwen3.5-4b", "train_rows": 20000, "validation_rows": 1000, "options": {"epochs": 3, "lora_rank": 16}}'
json
{
  "model": "qwen3.5-4b",
  "kind": "finetune",
  "dataset": null,
  "recipe": "laya-student-lora-sft/v1",
  "epochs": 3,
  "train_rows": 20000,
  "validation_rows": 1000,
  "pages_per_epoch": 20000,
  "estimate_training_tokens": 68004937,
  "usd_per_1m_training_tokens": 0.006127,
  "estimate_usd_for_job": 0.41666666666666674,
  "estimate": true,
  "basis": "An estimate: 3 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 68,004,937 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."
}

History

  • 2026-11-20: added, so that a training job is estimated with the options it would be created with.

See also

GET /v1/quote (finetune), POST /v1/jobs (finetune), Fine-tune a model, Python SDK.