Create a batch or training job
POST https://weights.fyi/run/v1/jobs
Authorization: Bearer <token> scope: submit
Content-Type: application/json
[Idempotency-Key: <your key>]
[traceparent: <W3C trace context>]
{"kind": "finetune", "dataset": "<dataset_id>", ["model": "<base model>",] ["recipe": "<recipe>",]
["objective": "sft" | "dpo" | "specialist_heads",] ["replay_weights": {"<cohort>": w},]
["manifest_uri": "<uri>", "manifest_sha256": "<64 hex>",] ["schedule": {...},]
["options": {"epochs": n, "patience": n, "seed": n, "checkpoint_seconds": s}]}- Available since
- 2026-10-08, when fine-tuning went live on weights.fyi/run. Fine-tuning is switched on for this service. Training further from a model you trained: not available yet.
- Answer time
- synchronous for the admission only: the answer comes as soon as the job is checked against your credit and queued. The training itself runs afterwards, at about 72 pages a second (measured on a training run of this model on 2026-10-08).
Starts a training job on a ready dataset of yours and leaves a model of your own, ft_ and the job's 24 hexadecimal characters. The dataset's format decides what is trained: the page classifier, a Laya specialist, a multi-head specialist, or a generative student by supervised fine-tuning (SFT) or preference optimisation (DPO); the table below pairs formats, base models and recipes. Only a JSON body with "kind": "finetune" comes here; other bodies are page batches. The job waits for the model and for any other training job, then prepares, trains, and resumes from its last checkpoint after a move (Fine-tune a model).
Admission checks an estimate: epochs x training pages x the tokens a page usually holds, at the price per 1M training tokens the job keeps; it is charged per token trained. Your available credit must cover it (402 training_not_covered), and it is then set aside while the job is open. Starting the model and a move cost nothing. A token's daily cap counts what is left of open estimates every UTC day, and a job at the cap stops cleanly with waiting_for: "token_daily_cap" until a later day or a higher cap; if credit runs out, it waits for credit. Dataset rules the upload does not check fail the job in its preparing step: check them first (PUT /v1/datasets/{dataset_id}/content).
Request
| Name | Where | Required | Meaning |
|---|---|---|---|
Authorization | header | yes | Bearer and your token. The token needs the submit scope, and the call counts against the token's request rate. |
Content-Type | header | yes | application/json. |
Idempotency-Key | header | no | Any string you choose, one per training job. The same request sent again with the same key returns the first answer and starts no second job. |
traceparent, tracestate | header | no | A W3C trace context; when it is valid, the job's spans join your trace. |
kind | body | yes | finetune. Without it the body is read as a page batch. |
dataset | body | yes | The dataset to train on, ds_ followed by 24 hexadecimal characters; it must be yours and ready. dataset_id is accepted as the same field. |
model | body | no | The base to train; base_model is accepted as the same field. Left out, it is the dataset's own base model for a specialist or student dataset, else laya-page-role-base. A base the dataset cannot train answers 400 model_not_available, whose trainable lists those it can. |
recipe | body | no | A recipe from the table below. Left out, the dataset's format decides. For page roles: laya-page-role/v2 (default: AdamW at 2e-5 after 200 warm-up steps, then a linear decay to zero, 8 pages a step) or laya-page-role/v1 (a constant rate after the warm-up). |
objective | body | no | sft, dpo or specialist_heads. Without a recipe, dpo and specialist_heads select their recipes. It must agree with the recipe, and the recipe with the dataset's format. |
replay_weights | body | no | A nonempty object from cohort name to a positive finite weight, such as {"new_delta": 3.0, "historical_replay": 1.0}: a row naming that cohort trains at it unless the row carries its own weight. |
manifest_uri, manifest_sha256 | body | no | The dataset release the job trains from: a storage or HTTPS URI, and 64 lower-case hexadecimal digits. For a dataset registered from an external source they must equal the registered values. |
base_checkpoint_uri | body | no | Accepted only empty or absent. A job starts from its base model; any other value answers 400 checkpoint_reference_unsupported. |
schedule | body | no | When the job may ask for the model to be started, with the fields of a page batch's schedule. |
options | body | no | Any of epochs (1 to 10, default 10), patience (epochs without a better validation macro-F1 before stopping; default 3 in v2, 10 in v1; at most epochs, so {"epochs": 2} alone is refused for patience, bounds 1 to 2), seed (default 1729) and checkpoint_seconds (default 300; down to 16.8, one checkpoint's measured write and store on 2026-10-08, never above the default). Other keys are refused. |
| Dataset format | Base model | Recipe | Trained objective |
|---|---|---|---|
laya-page-role/jsonl | laya-page-role-base | laya-page-role/v2, laya-page-role/v1 | sft |
laya-specialist/jsonl | The dataset's own Laya specialist | laya-specialist/v1 | sft |
laya-specialist-heads/jsonl | laya-specialist-heads-base | laya-specialist-heads/v1 | specialist_heads |
laya-sft-chat/jsonl | The dataset's own generative student base | laya-student-lora-sft/v1 | sft |
laya-dpo-preference/jsonl | The dataset's own generative student base | laya-student-lora-dpo/v1 | dpo |
Return value
201 Created when the job is admitted and queued.
| Field | Meaning |
|---|---|
job_id | The job's identifier, job_ followed by 24 hexadecimal characters. The trained model will be ft_ followed by the same 24 characters. |
kind | finetune. |
model | The base being trained. |
dataset | The dataset it trains on. |
recipe, objective | The recipe it follows and the objective that recipe trains. |
training_intent | Only when the request carried intent: the objective, replay_weights, manifest_uri and manifest_sha256 kept with the job. |
model_state, cold_start, schedule | As on a page batch: the model's state, the expected start when it was not ready, and the schedule's verdict for a scheduled job. |
options | Every option in force, your choices over the recipe's defaults: epochs, patience, seed and checkpoint_seconds. |
status | QUEUED. |
state | queued. |
traceparent | The job's own trace context, to link your traces to. |
estimate.usd_for_job | The estimate in US dollars. |
estimate.usd_micros | The same in micro-dollars, rounded: the amount set aside from your available credit while the job is open. |
estimate.training_tokens, estimate.usd_per_1m_training_tokens | The training tokens the estimate assumes, and the price per 1M the job keeps. |
estimate.basis | The estimate in words, with the speed it rests on and its date. |
Location, traceparent (headers) | The job's path, and its trace context. |
Errors
| Status | Code | When it happens | What to do |
|---|---|---|---|
400 | invalid_body, invalid_json | The body is not JSON, names no dataset, or options is not an object; expected shows the shape. | Send the body as above. |
400 | model_not_available | The model named is not one this dataset can train; trainable lists those it can. | Name one of them, or leave it out. |
400 | recipe_not_available | The recipe is unknown; available lists the recipes. | Name one of them, or leave it out. |
400 | invalid_objective, objective_recipe_mismatch, dataset_format_mismatch | An unknown objective (expected lists them), one the recipe does not train (recipe_objective), or a recipe whose record format (expected) is not the dataset's. | Align objective, recipe and dataset by the table above. |
400 | invalid_replay_weights, invalid_manifest_uri, invalid_manifest_sha256, manifest_mismatch | A malformed intent field, or a manifest other than the one the dataset was registered with (field). | Fix the field named. |
400 | checkpoint_reference_unsupported | A nonempty base_checkpoint_uri. | Leave it out. |
400 | invalid_schedule, invalid_schedule_window | A schedule that is not valid; message says why. | Fix the field named. |
400 | option_out_of_range | An option is outside its bounds, not a number, or not one of the four; option names it, low and high give the bounds where there are any. | Stay inside the bounds; lower patience with epochs. |
400 | dataset_label_mismatch | The dataset was made for a label set other than the base model's. | Make the dataset for this base. |
401 | unauthorized, invalid_token, token_revoked, token_expired | No token, or one that does not work (any more). | Use a valid token. |
402 | training_not_covered | Your available credit is less than the estimate; needed_usd_micros and available_usd_micros give both. | Add credit, or ask for fewer epochs. |
402 | token_daily_cap | The estimate would pass the token's spend cap for the UTC day; resets_at says when the day ends. | Wait for the reset, or raise the cap on your panel. |
403 | scope_required, account_suspended | The token lacks submit, or the account is suspended. | Use a token with submit. |
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. |
409 | dataset_not_ready | The dataset's upload is not finished, or it failed; status says which. | Upload it, or make a new dataset. |
409 | idempotency_key_in_progress | An earlier request with this key is still running. | Wait, then send again with the same key. |
422 | idempotency_key_reused | The key was used before for a different request. | Use a new key. |
429 | rate_limited | The token sends work faster than its request rate. | Wait the Retry-After seconds, then send again with the same key. |
429 | overloaded | The service holds as much unfinished work as it takes (reason: queue_full); nothing was accepted. | Wait the Retry-After seconds, then send again with the same key. |
Examples
Four epochs on a small test dataset, from a test copy of the service (so the estimate is not a live price; model_state is left out):
curl -s -i https://weights.fyi/run/v1/jobs \
-H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: finetune-my-pages-1" \
-d '{"kind": "finetune", "model": "laya-page-role-base", "dataset": "DATASET_ID", "recipe": "laya-page-role/v2", "options": {"epochs": 4, "patience": 3}}'HTTP/1.1 201 Created
Content-Type: application/json
Location: /run/v1/jobs/job_a698e920d5f0db918008bc43
traceparent: 00-22f0dbf2bea34f47b832073adda56a66-459770a64a0f7855-01
{
"job_id": "job_a698e920d5f0db918008bc43",
"kind": "finetune",
"model": "laya-page-role-base",
"dataset": "ds_12be8b8818ceaf13696e7ff9",
"recipe": "laya-page-role/v2",
"objective": "sft",
"options": {"epochs": 4, "patience": 3, "seed": 1729, "checkpoint_seconds": 300.0},
"status": "QUEUED",
"state": "queued",
"traceparent": "00-22f0dbf2bea34f47b832073adda56a66-459770a64a0f7855-01",
"estimate": {
"usd_for_job": 0.0011111111111111111,
"usd_micros": 1111,
"training_tokens": 181346,
"usd_per_1m_training_tokens": 0.006127,
"basis": "An estimate: 4 epochs over 40 training pages at about 1,133 tokens a page, the tokens our trainer fed a page of a real release, about 181,346 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-10-08: live, with the estimate as admission; the live drill moved a training job mid-epoch without losing a step.
- 2026-10-09 (merged): admission counts waiting pages; the daily cap counts open training and stops a job at the cap.
- 2026-10-10 implementation review:
429 overloaded, recovered retries, the dataset checked at upload. - 2026-11-16: documented specialist, multi-head and student (SFT, DPO) training, the intent fields and
schedule;laya-page-role-baseis one base among several.
See also
GET /v1/quote (finetune), GET /v1/jobs/{job_id}, GET /v1/jobs/{job_id}/results, Errors and limits for retries.