Quote a training job with its options
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
| 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. |
Content-Type | header | yes | application/json. |
kind | body | yes | finetune. |
recipe | body | no | The recipe to estimate; laya-page-role/v2 when left out. |
model | body | no | The base to train; left out, the recipe's default base, or for a grpo or opd recipe the dataset's own. |
dataset | body | 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 | body | one of the two | When you name no dataset: the number of training rows, a whole number of at least 1. |
validation_rows | body | no | With train_rows: the number of validation rows, 0 or more; 0 by default. |
options | body | no | The 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).
| Field | Meaning |
|---|---|
model, kind, dataset, recipe | The base the job would train, finetune, the dataset you named or null, and the recipe. |
epochs, train_rows, validation_rows | What the estimate is for. |
estimate_training_tokens, usd_per_1m_training_tokens | The training tokens assumed and the price per 1M of them. |
estimate_usd_for_job | The estimate for the whole job in US dollars: the figure your credit must cover when you create it. |
basis | The estimate in words. |
Errors
| Status | Code | When it happens | What to do |
|---|---|---|---|
400 | invalid_json, invalid_body | The body is not a JSON object, or holds a field this call does not take; unknown lists them. | Send the fields above. |
400 | unsupported_quote_kind | kind is not finetune. | Quote pages and tokens with GET /v1/quote. |
400 | option_out_of_range | An option is outside the recipe's bounds, or is not one the recipe takes; option, low and high say which. | Stay inside them. |
400 | invalid_parameter, parameter_out_of_range | You 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. |
400 | model_not_available, recipe_not_available, dataset_format_mismatch | The 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). |
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, not_configured | The 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. |
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. |
415 | unsupported_media_type | The 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:
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}}'{
"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.